Column aggregation in PdfGrid

I am using PdfGrid to create a table in a PDF, from a list of objects. Is there a way to sum up all of the values in one of the columns and provide either an extra row in the table with the sum, or in a field directly below the table?


byte[] bytes = GetFileBytes(filePath);
PdfLoadedDocument loadedDocument = new PdfLoadedDocument(bytes);

PdfLoadedForm form = loadedDocument.Form;

PdfGrid grid = new PdfGrid();

List<LateCharge> lateCharges = GetLateCharges();

grid.DataSource = lateCharges;


Ex:

Column 1
Column 2
Column 3
abc
true
12.00
efg
false
13.00




TOTAL25.00



1 Reply 1 reply marked as answer

GK Gowthamraj Kumar Syncfusion Team September 20, 2021 01:25 PM UTC

Hi MedDev, 

Thank you for contacting Syncfusion support. 
  
We can calculate the sum of grid column on each rows by using EndPageLayout and EndCellLayout and event helpers. Using this event, we can sum the grid column values manually and draw it on below the table on the same page. We have created a simple sample to achieve your requirement, attached the sample and output document for your reference. Please find the sample from below,  
 
  
Kindly try the above sample on your end and let us know whether it is suites or not.  

Regards, 
Gowthamraj K 


Marked as answer
Loader.
Up arrow icon