View on GitHub ClosedXML.Report

Totals in a Column

In order to get the totals for the column in ClosedXML.Report there are aggregation tags:

To calculate the results of ClosedXML.Report uses Excel tools, i.e. Each of these tags will be replaced by the corresponding Excel formula. For example, to calculate the Amount paid amount, we need to add the <<sum>> tag to the options line.


Each aggregation tag has a over parameter providing you with a powerful tool that allows you to perform more complex calculations that Excel cannot do for various reasons. In particular, Excel will not be able to calculate the amount of a complex (multi-line) area. The argument to over is an expression. Example:


<<sum over="item.AmountPaid">>

This function is very useful for computing subtotals in master-detail reports. You can see an example in the Report examples section