public AddFooterRow ( RowType pdfRowType ) : void | ||
pdfRowType | RowType | |
return | void |
public void AddFooterRow(RowType pdfRowType)
{
if (SharedData.SummarySettings == null || SharedData.SummarySettings.OverallSummarySettings == null ||
!SharedData.SummarySettings.OverallSummarySettings.ShowOnEachPage) return;
if (SharedData.MainTableEvents != null)
SharedData.MainTableEvents.RowStarted(new EventsArguments { PdfDoc = SharedData.PdfDoc, PdfWriter = SharedData.PdfWriter, Table = MainTable, RowType = pdfRowType, ColumnCellsSummaryData = SharedData.ColumnCellsSummaryData, PreviousTableRowData = _previousTableRowData, PageSetup = SharedData.PageSetup, PdfFont = SharedData.PdfFont, PdfColumnsAttributes = SharedData.PdfColumnsAttributes });
for (var columnNumber = 0; columnNumber < SharedData.ColumnsCount; columnNumber++)
{
var backgroundColor = SharedData.Template.SummaryRowBackgroundColor;
var foreColor = SharedData.Template.SummaryRowFontColor;
var col = SharedData.PdfColumnsAttributes[columnNumber];
int location = -1;
switch (SharedData.SummarySettings.OverallSummarySettings.SummaryLocation)
{
case SummaryLocation.AtFirstDefinedAggregateCell:
if (columnNumber == getFirstDefinedAggregateCell())
location = columnNumber;
break;
case SummaryLocation.AtRowNumberColumn:
if (columnNumber == 0)
location = 0;
break;
case SummaryLocation.AtSpecifiedLabelColumnProperty:
if (SharedData.SummarySettings.OverallSummarySettings.LabelColumnProperty == col.PropertyName)
location = columnNumber;
break;
}
if (location != -1)
TableCellHelper.AddSummaryCell(backgroundColor[0], foreColor, location, CellType.SummaryRowCell, pdfRowType);
else
TableCellHelper.AddSummaryCell(backgroundColor[0], foreColor, null, columnNumber, pdfRowType, CellType.SummaryRowCell);
}
if (SharedData.MainTableEvents != null)
SharedData.MainTableEvents.RowAdded(new EventsArguments { PdfDoc = SharedData.PdfDoc, PdfWriter = SharedData.PdfWriter, Table = MainTable, RowType = pdfRowType, ColumnCellsSummaryData = SharedData.ColumnCellsSummaryData, PreviousTableRowData = _previousTableRowData, PageSetup = SharedData.PageSetup, PdfFont = SharedData.PdfFont, PdfColumnsAttributes = SharedData.PdfColumnsAttributes });
}
// Public Methods (3) /// <summary> /// Creates a new summary row table to display summary of the all of the available groups /// </summary> public void AddAllGroupsSummary() { if (!SharedData.IsGroupingEnabled) { return; } if (SharedData.SummarySettings == null) { return; } if (!SharedData.SummarySettings.OverallSummarySettings.ShowOnEachPage && !SharedData.SummarySettings.PreviousPageSummarySettings.ShowOnEachPage) { return; } if (SharedData.PageSetup.PagePreferences.RunDirection == null) { SharedData.PageSetup.PagePreferences.RunDirection = PdfRunDirection.LeftToRight; } var mainTableAbsoluteWidths = MainTable.AbsoluteWidths; var len = SharedData.ColumnsWidths.Length; if (SharedData.IsMainTableHorizontalStackPanel) { len = SharedData.HorizontalStackPanelColumnsPerRow; } MainTable = new PdfGrid(len) { RunDirection = (int)SharedData.PageSetup.PagePreferences.RunDirection, WidthPercentage = SharedData.PageSetup.MainTablePreferences.WidthPercentage, HeadersInEvent = true, HeaderRows = 0, FooterRows = 1, SkipFirstHeader = true, SplitLate = SharedData.PageSetup.MainTablePreferences.SplitLate, SpacingAfter = spacingAfterAllGroupsSummary, SpacingBefore = spacingBeforeAllGroupsSummary, KeepTogether = SharedData.PageSetup.MainTablePreferences.KeepTogether, SplitRows = SharedData.PageSetup.MainTablePreferences.SplitRows }; setSetTotalWidths(mainTableAbsoluteWidths); TableCellHelper = new TableCellHelper { SharedData = SharedData, MainTable = MainTable, ShowAllGroupsSummaryRow = showAllGroupsSummaryRow, CurrentRowInfoData = CurrentRowInfoData }; RowsManager.MainTable = MainTable; RowsManager.TableCellHelper = TableCellHelper; if (showAllGroupsSummaryRow) { RowsManager.AddFooterRow(RowType.AllGroupsSummaryRow); } MainTable.ElementComplete = true; //print footer if (SharedData.ShouldWrapTablesInColumns) { MainGroupTable.AddCell(new PdfPCell(MainTable) { Border = 0 }); } else { MainTable.SpacingAfter += MainTable.HeaderHeight + 2.5f; SharedData.PdfDoc.Add(MainTable); } }