Basic properties of the main table's cells
        /// <summary>
        /// Maps ItemTemplate.BasicProperties to pdfRptTableCellDefinition.BasicProperties.
        /// </summary>
        /// <param name="fromPdfCellAttributes">From PdfCell Attributes</param>
        /// <param name="toPdfCellAttributes">To PdfCell Attributes</param>
        public static void MapBasicPropertiesTo(this CellBasicProperties fromPdfCellAttributes, CellBasicProperties toPdfCellAttributes)
        {
            if (fromPdfCellAttributes != null)
            {
                var borderWidth = fromPdfCellAttributes.BorderWidth;
                if (borderWidth > 0)
                    toPdfCellAttributes.BorderWidth = borderWidth;

                var cellPadding = fromPdfCellAttributes.CellPadding;
                if (cellPadding > 0)
                    toPdfCellAttributes.CellPadding = cellPadding;

                var fixedHeight = fromPdfCellAttributes.FixedHeight;
                if (fixedHeight > 0)
                    toPdfCellAttributes.FixedHeight = fixedHeight;

                var minimumHeight = fromPdfCellAttributes.MinimumHeight;
                if (minimumHeight > 0)
                    toPdfCellAttributes.MinimumHeight = minimumHeight;

                var fontColor = fromPdfCellAttributes.FontColor;
                if (fontColor != null)
                    toPdfCellAttributes.FontColor = fontColor;

                var backgroundColor = fromPdfCellAttributes.BackgroundColor;
                if (backgroundColor != null)
                    toPdfCellAttributes.BackgroundColor = backgroundColor;

                var pdfFont = fromPdfCellAttributes.PdfFont;
                if (pdfFont != null)
                    toPdfCellAttributes.PdfFont = pdfFont;

                var rotation = fromPdfCellAttributes.Rotation;
                if (rotation != 0)
                    toPdfCellAttributes.Rotation = rotation;

                var runDirection = fromPdfCellAttributes.RunDirection;
                if (runDirection != null && runDirection != PdfRunDirection.None)
                    toPdfCellAttributes.RunDirection = runDirection;

                var horizontalAlignment = fromPdfCellAttributes.HorizontalAlignment;
                if (horizontalAlignment != null && horizontalAlignment != HorizontalAlignment.None)
                    toPdfCellAttributes.HorizontalAlignment = horizontalAlignment;

                var displayFormatFormula = fromPdfCellAttributes.DisplayFormatFormula;
                if (displayFormatFormula != null && toPdfCellAttributes.DisplayFormatFormula == null)
                    toPdfCellAttributes.DisplayFormatFormula = displayFormatFormula;
            }
        }
 /// <summary>
 /// Table's Cells Definitions. If you don't set this value, it will be filled by using current template's settings internally.
 /// </summary>
 public void BasicProperties(CellBasicProperties data)
 {
     _columnItemsTemplate.BasicProperties = data;
 }
 /// <summary>
 /// Table's Cells Definitions. If you don't set this value, 
 /// it will be filled by using current template's settings internally.
 /// </summary>
 public void BasicProperties(CellBasicProperties properties)
 {
     _builder.BasicProperties = properties;
 }
        private static void applyTemplateColors(CellBasicProperties from, CellBasicProperties to)
        {
            if (to.PdfFont != null)
            {
                if (from.PdfFontStyle != null)
                    to.PdfFont.Style = from.PdfFontStyle.Value;

                if (from.FontColor != null)
                    to.PdfFont.Color = from.FontColor;
            }
        }
Exemple #5
0
        private static void addSimpleRowCell(PdfGrid table, Action<CellRowData, CellBasicProperties> cellDataItem)
        {
            var cellBasicProperties = new CellBasicProperties
            {
                BorderColor = BaseColor.BLACK,
                HorizontalAlignment = HorizontalAlignment.Center,
                RunDirection = PdfRunDirection.LeftToRight,
                FontColor = new BaseColor(Color.Black.ToArgb()),
                BackgroundColor = BaseColor.WHITE,
                PdfFontStyle = DocumentFontStyle.Normal
            };
            var cellData = new CellRowData { Value = string.Empty, FormattedValue = string.Empty };

            if (cellDataItem != null)
                cellDataItem(cellData, cellBasicProperties);

            if (cellData.CellTemplate == null)
                cellData.CellTemplate = new TextBlockField();

            var cellAttributes = new CellAttributes
            {
                BasicProperties = cellBasicProperties,
                RowData = cellData
            };
            table.AddCell(cellAttributes.CreateSafePdfPCell(cellData.CellTemplate));
        }