Esempio n. 1
0
        private PdfPTable GetFooter(Notes.Footer footer)
        {
            var table = new PdfPTable(2);

            table.HorizontalAlignment = Element.ALIGN_CENTER;
            table.SpacingBefore       = 10;
            table.SetWidths(new float[] { 0.6f, 0.4f });
            table.WidthPercentage         = 100.0f;
            table.DefaultCell.Padding     = 6;
            table.DefaultCell.BorderWidth = 0;

            PdfPCell cell1 = new PdfPCell(new Phrase(footer.Left.Title, paragraphTextFont))
            {
                BorderWidth = 0
            };
            PdfPCell cell2 = new PdfPCell(new Phrase(footer.Right.Title, paragraphTextFont))
            {
                BorderWidth = 0
            };
            PdfPCell cell3 = new PdfPCell(new Phrase(footer.Left.Text.ToUpper(), paragraphTextFont))
            {
                BorderWidth = 0
            };
            PdfPCell cell4 = new PdfPCell(new Phrase(footer.Right.Text.ToUpper(), paragraphTextFont))
            {
                BorderWidth = 0
            };

            table.AddCell(cell1);
            table.AddCell(cell2);
            table.AddCell(cell3);
            table.AddCell(cell4);

            return(table);
        }
        public static Table GetFooterTable(Reports.Footer footer)
        {
            Table      table      = new Table();
            TableStyle tableStyle = new TableStyle()
            {
                Val = "TableGrid"
            };

            table.AppendChild(tableStyle);

            TableProperties tblProp = new TableProperties(
                new TableBorders(
                    new TopBorder()
            {
                Val = new EnumValue <BorderValues>(BorderValues.None)
            },
                    new BottomBorder()
            {
                Val = new EnumValue <BorderValues>(BorderValues.None)
            },
                    new LeftBorder()
            {
                Val = new EnumValue <BorderValues>(BorderValues.None)
            },
                    new RightBorder()
            {
                Val = new EnumValue <BorderValues>(BorderValues.None)
            },
                    new InsideHorizontalBorder()
            {
                Val = new EnumValue <BorderValues>(BorderValues.None)
            },
                    new InsideVerticalBorder()
            {
                Val = new EnumValue <BorderValues>(BorderValues.None)
            }
                    ),
                //new TableCellMargin()
                //{
                //    TopMargin = new TopMargin() { Width = new StringValue("400") },
                //    BottomMargin = new BottomMargin() { Width = new StringValue("400") },
                //    LeftMargin = new LeftMargin() { Width = new StringValue("400") },
                //    RightMargin = new RightMargin() { Width = new StringValue("400") }
                //},
                new TableJustification()
            {
                Val = TableRowAlignmentValues.Left
            },
                new TableWidth()
            {
                Type = TableWidthUnitValues.Pct, Width = new StringValue("5000")
            }
                );

            // Append the TableProperties object to the empty table.
            table.AppendChild <TableProperties>(tblProp);

            TableGrid grid = new TableGrid(new GridColumn()
            {
                Width = new StringValue("1500")
            }, new GridColumn()
            {
                Width = new StringValue("1500")
            });

            table.AppendChild <TableGrid>(grid);


            var cellProperties = new TableCellProperties()
            {
                TableCellWidth = new TableCellWidth()
                {
                    Width = new StringValue("2500"), Type = TableWidthUnitValues.Pct
                }
            };

            TableRow  tr1 = new TableRow();
            TableCell tc1 = new TableCell(new Paragraph(new Run(new Text(footer.Left.Title))));

            tc1.AppendChild <TableCellProperties>((TableCellProperties)cellProperties.Clone());
            tr1.Append(tc1);

            TableCell tc2 = new TableCell(new Paragraph(new Run(new Text(footer.Right.Title))));

            tc2.AppendChild <TableCellProperties>((TableCellProperties)cellProperties.Clone());
            tr1.Append(tc2);

            table.Append(tr1);

            TableRow tr2 = new TableRow();

            TableCell tc3 = new TableCell(new Paragraph(new Run(new Text(footer.Left.Text))));

            tc3.AppendChild <TableCellProperties>((TableCellProperties)cellProperties.Clone());
            tr2.Append(tc3);

            TableCell tc4 = new TableCell(new Paragraph(new Run(new Text(footer.Right.Text))));

            tc4.AppendChild <TableCellProperties>((TableCellProperties)cellProperties.Clone());
            tr2.Append(tc4);

            table.Append(tr2);

            return(table);
        }
Esempio n. 3
0
 public NotesDocument()
 {
     Sections = new List <Entry>();
     Header   = new Header();
     Footer   = new Footer();
 }