Esempio n. 1
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));
        }