private void defaultValues()
 {
     Color = BaseColor.BLACK;
     Size = 9;
     Style = DocumentFontStyle.Normal;
 }
 private void setDefaults(Font font)
 {
     Color = font.Color;
     Size = (int)font.Size;
     Style = (DocumentFontStyle)font.Style;
 }
Exemple #3
0
        // Public Methods (7)

        /// <summary>
        /// Adds a new PdfPCell to the MainTable
        /// </summary>
        /// <param name="backgroundColor"></param>
        /// <param name="foreColor"></param>
        /// <param name="rawData"></param>
        /// <param name="columnNumber"></param>
        /// <param name="pdfRowType"></param>
        /// <param name="pdfCellType"></param>
        /// <param name="rowValues"></param>
        /// <param name="horizontalAlignment"></param>
        /// <param name="pdfFontStyle"></param>
        /// <param name="rotation"></param>
        /// <param name="setItemTemplate"></param>
        /// <param name="colSpan"></param>
        /// <returns></returns>
        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);
        }
 /// <summary>
 /// Message's FontStyle.
 /// </summary>
 public void MessageFontStyle(DocumentFontStyle fontStyle)
 {
     _defaultHeaderProvider.MessageFontStyle = fontStyle;
 }
        // Public Methods (7)
        /// <summary>
        /// Adds a new PdfPCell to the MainTable
        /// </summary>
        /// <param name="backgroundColor"></param>
        /// <param name="foreColor"></param>        
        /// <param name="rawData"></param>
        /// <param name="columnNumber"></param>
        /// <param name="pdfRowType"></param>
        /// <param name="pdfCellType"></param>
        /// <param name="rowValues"></param>
        /// <param name="horizontalAlignment"></param>
        /// <param name="pdfFontStyle"></param>
        /// <param name="rotation"></param>
        /// <param name="setItemTemplate"></param>
        /// <param name="colSpan"></param>         
        /// <returns></returns>
        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
                },
                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 = pdfRowType == RowType.DataTableRow ? col.FixedHeight : 0,
                    MinimumHeight = pdfRowType == RowType.DataTableRow ? col.MinimumHeight : 0
                }
            };

            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());
            cell.CellEvent = new MainTableCellsEvent(cellData)
            {
                SummaryCellsData = SharedData.ColumnCellsSummaryData,
                IsGroupingEnabled = SharedData.IsGroupingEnabled,
                CurrentRowInfoData = CurrentRowInfoData
            };

            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;
        }
Exemple #6
0
 /// <summary>
 /// Font's style. Its default value is Normal.
 /// </summary>
 public void Style(DocumentFontStyle value)
 {
     _fontStyle = value;
 }
Exemple #7
0
 /// <summary>
 /// Message's FontStyle.
 /// </summary>
 public void MessageFontStyle(DocumentFontStyle fontStyle)
 {
     _defaultHeaderProvider.MessageFontStyle = fontStyle;
 }