Ejemplo n.º 1
0
 /// <summary>
 /// Custom cell's content template as a PdfPCell
 /// </summary>
 /// <returns>Content as a PdfPCell</returns>
 public PdfPCell RenderingCell(CellAttributes attributes)
 {
     var html = FuncHelper.ApplyFormula(attributes.BasicProperties.DisplayFormatFormula, attributes.RowData.Value);
     attributes.RowData.FormattedValue = html;
     var cell = new HtmlWorkerHelper
     {
         PdfFont = attributes.BasicProperties.PdfFont,
         HorizontalAlignment = attributes.BasicProperties.HorizontalAlignment.Value,
         Html = html,
         RunDirection = attributes.BasicProperties.RunDirection.Value,
         StyleSheet = StyleSheet
     }.RenderHtml();
     return cell;
 }
        private PdfGrid createTable(string html)
        {
            var table = new PdfGrid(1)
            {
                RunDirection = (int)FooterProperties.RunDirection,
                WidthPercentage = FooterProperties.TableWidthPercentage
            };
            var htmlCell = new HtmlWorkerHelper
            {
                PdfFont = FooterProperties.PdfFont,
                HorizontalAlignment = FooterProperties.HorizontalAlignment,
                Html = html,
                RunDirection = FooterProperties.RunDirection,
                StyleSheet = FooterProperties.StyleSheet,
                PdfElement = _totalPageCountImage
            }.RenderHtml();
            htmlCell.HorizontalAlignment = (int)FooterProperties.HorizontalAlignment;
            htmlCell.Border = 0;
            table.AddCell(htmlCell);

            if (FooterProperties.ShowBorder)
                return table.AddBorderToTable(FooterProperties.BorderColor, FooterProperties.SpacingBeforeTable);
            table.SpacingBefore = this.FooterProperties.SpacingBeforeTable;

            return table;
        }
        private PdfGrid createTable(string html, HeaderBasicProperties basicProperties)
        {
            var table = new PdfGrid(1)
            {
                RunDirection = (int)basicProperties.RunDirection,
                WidthPercentage = basicProperties.TableWidthPercentage
            };
            var htmlCell = new HtmlWorkerHelper
            {
                PdfFont = basicProperties.PdfFont,
                HorizontalAlignment = basicProperties.HorizontalAlignment,
                Html = html,
                RunDirection = basicProperties.RunDirection,
                StyleSheet = basicProperties.StyleSheet
            }.RenderHtml();
            htmlCell.HorizontalAlignment = (int)basicProperties.HorizontalAlignment;
            htmlCell.Border = 0;
            table.AddCell(htmlCell);

            if (basicProperties.ShowBorder)
                return table.AddBorderToTable(basicProperties.BorderColor, basicProperties.SpacingBeforeTable);
            table.SpacingBefore = basicProperties.SpacingBeforeTable;

            return table;
        }