private void initTable()
 {
     _initTable = new InitTable
     {
         SharedData         = _commonManagersInfoData,
         CurrentRowInfoData = CurrentRowInfoData
     };
     _initTable.CreateMainTable();
     _mainTable       = _initTable.MainTable;
     _tableCellHelper = _initTable.TableCellHelper;
 }
Esempio n. 2
0
        // Public Methods (2)


        /// <summary>
        /// Creates and initializes the MainTable's settings
        /// </summary>
        public void CreateMainTable()
        {
            setHeaderAndFooterRows();

            var len = SharedData.ColumnsWidths.Length;

            if (SharedData.IsMainTableHorizontalStackPanel)
            {
                len = SharedData.HorizontalStackPanelColumnsPerRow;
            }
            if (len == 0)
            {
                throw new InvalidOperationException("At least one column should be defined or visible.");
            }

            if (SharedData.PageSetup.PagePreferences.RunDirection == null)
            {
                SharedData.PageSetup.PagePreferences.RunDirection = PdfRunDirection.LeftToRight;
            }

            setDefaultSpacingAfterForGroups();

            MainTable = new PdfGrid(len)
            {
                RunDirection    = (int)SharedData.PageSetup.PagePreferences.RunDirection,
                WidthPercentage = SharedData.PageSetup.MainTablePreferences.WidthPercentage,
                HeadersInEvent  = true,
                HeaderRows      = _headerRows,
                FooterRows      = _footerRows,
                SkipFirstHeader = true,
                SplitLate       = SharedData.PageSetup.MainTablePreferences.SplitLate,
                SpacingAfter    = SharedData.PageSetup.MainTablePreferences.SpacingAfter,
                SpacingBefore   = SharedData.PageSetup.MainTablePreferences.SpacingBefore,
                KeepTogether    = SharedData.PageSetup.MainTablePreferences.KeepTogether,
                SplitRows       = SharedData.PageSetup.MainTablePreferences.SplitRows
            };

            setWidths();

            TableCellHelper = new TableCellHelper
            {
                SharedData              = SharedData,
                MainTable               = MainTable,
                CurrentRowInfoData      = CurrentRowInfoData,
                ShowAllGroupsSummaryRow = showAllGroupsSummaryRow
            };
        }
Esempio n. 3
0
        // 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);
            }
        }