This project has moved. For the latest updates, please go here.

Group Footer & Main Table Summary Settings

Jan 8, 2015 at 8:05 PM
I saw on a thread where you spoke about the GroupAdded Event which looked like you would be creating a new table. Is there a way to inject HTML into this instead or is there another way to do something similar to the AddGroupHeader with HTML?
Also, if I wanted to use a property from a group in the Overall Summary Settings label, what would be the best approach to get the groups data there?
Coordinator
Jan 8, 2015 at 9:20 PM
Edited Jan 8, 2015 at 9:26 PM
Overall Summary Settings label is not dynamic, but you can inject an arbitrary HTML data at the end of the each group this way:
events.GroupAdded(args =>
    {
        //args.PdfDoc.Add(new Phrase("\nGroup added event."));
 
        /*var data = args.ColumnCellsSummaryData
                .Where(data => data.CellData.PropertyName.Equals("propertyName")
                           && data.GroupNumber == 1);*/
 
        var salary = args.LastOverallAggregateValueOf<Employee>(x => x.Salary);
        var table = new PdfGrid(1)
        {
            RunDirection = (int)PdfRunDirection.LeftToRight,
            WidthPercentage = args.PageSetup.MainTablePreferences.WidthPercentage
        };
        var htmlCell = new XmlWorkerHelper
        {
            // the registered fonts (DefaultFonts section) should be specified here
            Html = string.Format(
                     @"<br/><span style='font-size:9pt;font-family:verdana;'>
                         <b>Group <i>added</i> event.</b>
                         Total Salary: {0}</span>", salary),
            RunDirection = PdfRunDirection.LeftToRight,
            CssFilesPath = null, // optional
            ImagesPath = null, // optional
            InlineCss = null, // optional
            DefaultFont = args.PdfFont.Fonts[1] // verdana
        }.RenderHtml();
        htmlCell.Border = 0;
        table.AddCell(htmlCell);
        table.SpacingBefore = args.PageSetup.MainTablePreferences.SpacingBefore;
 
        args.PdfDoc.Add(table);
    });
GroupingPdfReport.cs
Jan 14, 2015 at 3:11 PM
thanks!

Also, do you have any examples of merging reports without writing them out first? I looked into the .AsPdfStream, but did not quite get what I was wanting. Basically want to create multiple reports in memory and then merge them together before sending the final report in MemoryStream back.
Coordinator
Jan 15, 2015 at 9:23 PM
Jan 16, 2015 at 12:30 PM
Ok, sorry about that but thanks!


Sent via the Samsung GALAXY S® 5, an AT&T 4G LTE smartphone