This project has moved and is read-only. For the latest updates, please go here.

Summary on last page

Apr 7, 2014 at 5:11 PM
Is it possible to add a Document summary (like page summary but only in the last page)??

Thank you
Coordinator
Apr 7, 2014 at 9:20 PM
You can create a custom summary
Apr 8, 2014 at 11:47 AM
i've lloked for this:
https://pdfreport.codeplex.com/SourceControl/latest#Samples/PdfReportSamples/Events/EventsPdfReport.cs


It work great but i've only an error:
                events.MainTableAdded(args =>
                {
                    var data = args.LastOverallAggregateValueOf<Row>(y => y.Price);
                    var msg = "Total Price: " + data
                    var infoTable = new PdfGrid(numColumns: 1)
                    {
                        WidthPercentage = 100,
                    };
                    infoTable.AddSimpleRow(
                         (cellData, properties) =>
                         {
                             cellData.Value = msg;
                             properties.PdfFont = events.PdfFont;
                             properties.RunDirection = PdfRunDirection.LeftToRight;
                             properties.BorderWidth = 0;
                             properties.HorizontalAlignment = HorizontalAlignment.Right;
                         });
                    args.PdfDoc.Add(infoTable.AddBorderToTable(borderColor: BaseColor.LIGHT_GRAY, spacingBefore: 10f));
                });
Price is a decimal value, in total Price it show total price without comma:

ex.

i've 6 row with Price value 17,53.
In total price it show 10518 instead of 105,18


Any help?
Coordinator
Apr 8, 2014 at 1:27 PM
Edited Apr 8, 2014 at 1:28 PM
You can access to OverallAggregateValue as an object this way as well:
var objData = args.ColumnCellsSummaryData
                            .Where(x => x.CellData.PropertyName.Equals("Price"))
                            .OrderByDescending(x => x.OverallRowNumber)
                            .First()
                            .OverallAggregateValue;
Apr 8, 2014 at 2:49 PM
I've the same result ...

ever 10518 instead of 105,18

for now i've solved using (Convert.ToDecimal(data)/100) but i don't know if it is the best way
Coordinator
Apr 8, 2014 at 3:16 PM
You can change the sum class and replace it with your custom implementation (change its double.TryParse part)
https://pdfreport.codeplex.com/SourceControl/latest#Lib/Aggregates/Numbers/Sum.cs
Then to use this new IAggregateFunction, just try
column.AggregateFunction(aggregateFunction =>
                    {
                        aggregateFunction.CustomAggregateFunction(new CustomSum());