The sum over rows is easy to implement. Simply add an extra property to your data model that returns the sum of all the other columns and create a representative column for it.
The sum over columns is a little trickier as there is no concept of "footers". One possible way would be to add a "last row" item--a data object whose members each hold the sum of the values in its column. You can loop over each row object to do the calculations. Remember that the values of this object would need to be recalculated each time any cell is updated. And don't forget to exclude this object from your calculations! This may not be an efficient solution but it's the first one that came to mind.