PdfRpt.Core.PdfTable.TableCellHelper.AddGeneralCell C# (CSharp) Method

AddGeneralCell() public method

Adds a new PdfPCell to the MainTable
public AddGeneralCell ( BaseColor backgroundColor, BaseColor foreColor, object rawData, int columnNumber, RowType pdfRowType, CellType pdfCellType, IList rowValues = null, HorizontalAlignment horizontalAlignment = HorizontalAlignment.None, DocumentFontStyle pdfFontStyle = DocumentFontStyle.None, int rotation, bool setItemTemplate = false, int colSpan = 1 ) : PdfRpt.Core.Contracts.CellAttributes
backgroundColor iTextSharp.text.BaseColor
foreColor iTextSharp.text.BaseColor
rawData object
columnNumber int
pdfRowType RowType
pdfCellType CellType
rowValues IList
horizontalAlignment HorizontalAlignment
pdfFontStyle DocumentFontStyle
rotation int
setItemTemplate bool
colSpan int
return PdfRpt.Core.Contracts.CellAttributes
        public CellAttributes AddGeneralCell(
                    BaseColor backgroundColor,
                    BaseColor foreColor,
                    object rawData,
                    int columnNumber,
                    RowType pdfRowType,
                    CellType pdfCellType,
                    IList<CellData> rowValues = null,
                    HorizontalAlignment horizontalAlignment = HorizontalAlignment.None,
                    DocumentFontStyle pdfFontStyle = DocumentFontStyle.None,
                    int rotation = 0,
                    bool setItemTemplate = false,
                    int colSpan = 1)
        {
            var col = SharedData.PdfColumnsAttributes[columnNumber];

            var cellData = new CellAttributes
            {
                RowData = new CellRowData
                {
                    TableRowData = rowValues,
                    Value = rawData,
                    PdfRowType = pdfRowType,
                    ColumnNumber = columnNumber,
                    PropertyName = col.PropertyName,
                    LastRenderedRowNumber = CurrentRowInfoData.LastRenderedRowNumber
                },
                SharedData = new CellSharedData
                {
                    PdfColumnAttributes = col,
                    DataRowNumber = CurrentRowInfoData.LastOverallDataRowNumber,
                    GroupNumber = CurrentRowInfoData.LastGroupRowNumber,
                    PdfDoc = SharedData.PdfDoc,
                    PdfWriter = SharedData.PdfWriter,
                    SummarySettings = SharedData.SummarySettings,
                    Template = SharedData.Template
                },
                ItemTemplate = setItemTemplate ? col.ColumnItemsTemplate : null,
                BasicProperties = new CellBasicProperties
                {
                    PdfFont = SharedData.PdfFont,
                    Rotation = rotation,
                    PdfFontStyle = (pdfFontStyle == DocumentFontStyle.None) ? DocumentFontStyle.Normal : pdfFontStyle,
                    BackgroundColor = backgroundColor,
                    BorderColor = SharedData.Template.CellBorderColor,
                    FontColor = foreColor,
                    RunDirection = SharedData.PageSetup.PagePreferences.RunDirection,
                    ShowBorder = SharedData.Template.ShowGridLines,
                    HorizontalAlignment = (horizontalAlignment == HorizontalAlignment.None) ? col.CellsHorizontalAlignment : horizontalAlignment,
                    FixedHeight = col.FixedHeight,
                    MinimumHeight = col.MinimumHeight,
                    CellPadding = col.Padding,
                    PaddingBottom = col.PaddingBottom,
                    PaddingLeft = col.PaddingLeft,
                    PaddingRight = col.PaddingRight,
                    PaddingTop = col.PaddingTop
                }
            };

            if (SharedData.MainTableEvents != null) SharedData.MainTableEvents.CellCreated(new EventsArguments { PdfDoc = SharedData.PdfDoc, PdfWriter = SharedData.PdfWriter, Cell = cellData, CellType = pdfCellType, RowType = pdfRowType, ColumnNumber = columnNumber, ColumnCellsSummaryData = SharedData.ColumnCellsSummaryData, PreviousTableRowData = CurrentRowInfoData.PreviousTableRowData, PageSetup = SharedData.PageSetup, PdfFont = SharedData.PdfFont, PdfColumnsAttributes = SharedData.PdfColumnsAttributes });
            var cell = cellData.CreateSafePdfPCell(new TextBlockField());

            if (SharedData.ColumnCellsFinalSummaryData == null)
                SharedData.ColumnCellsFinalSummaryData = new List<CellRowData>();

            cell.CellEvent = new MainTableCellsEvent(cellData)
            {
                SummaryCellsData = SharedData.ColumnCellsSummaryData,
                IsGroupingEnabled = SharedData.IsGroupingEnabled,
                CurrentRowInfoData = CurrentRowInfoData,
                SharedData = SharedData,
                CellType = pdfCellType
            };

            if (colSpan > 1) cell.Colspan = colSpan;

            MainTable.AddCell(cell);
            if (SharedData.MainTableEvents != null) SharedData.MainTableEvents.CellAdded(new EventsArguments { PdfDoc = SharedData.PdfDoc, PdfWriter = SharedData.PdfWriter, Cell = cellData, CellType = pdfCellType, RowType = pdfRowType, ColumnNumber = columnNumber, ColumnCellsSummaryData = SharedData.ColumnCellsSummaryData, PreviousTableRowData = CurrentRowInfoData.PreviousTableRowData, PageSetup = SharedData.PageSetup, PdfFont = SharedData.PdfFont, PdfColumnsAttributes = SharedData.PdfColumnsAttributes });

            return cellData;
        }