Exemple #1
0
        private void FillRow(TableRow targetRow, MyTableRow sourceRow)
        {
            foreach (var cell in sourceRow.Cells)
            {
                TableCellProperties tableCellProperties = new TableCellProperties(
                    new TableCellMargin()
                {
                    LeftMargin = new LeftMargin()
                    {
                        Width = cell.Style.LeftPadding.ToString()
                    },
                    RightMargin = new RightMargin()
                    {
                        Width = cell.Style.RightPadding.ToString()
                    },
                    TopMargin = new TopMargin()
                    {
                        Width = cell.Style.TopPadding.ToString()
                    },
                    BottomMargin = new BottomMargin()
                    {
                        Width = cell.Style.BottomPadding.ToString()
                    }
                },
                    new GridSpan()
                {
                    Val = cell.Style.Colspan
                }
                    );
                TableCell tableCell = new TableCell(tableCellProperties);

                ParagraphProperties paraProp = new ParagraphProperties(new Justification()
                {
                    Val = cell.Style.Justification == MyJustification.Left ? JustificationValues.Left :
                          cell.Style.Justification == MyJustification.Right ? JustificationValues.Right :
                          JustificationValues.Center
                })
                {
                    SpacingBetweenLines = new SpacingBetweenLines()
                    {
                        After = "50", Line = "240"
                    }
                };

                RunProperties runProp = GetRunProperties(cell.Style.Font, cell.Style.FontSize, cell.Style.Emphasis);

                Paragraph para = new Paragraph(paraProp, new Run(runProp, new Text(cell.Text)));
                tableCell.Append(para);
                targetRow.Append(tableCell);
            }
        }
Exemple #2
0
 public void AddRow(MyTableRow row)
 {
     Rows.Add(row);
 }
Exemple #3
0
 public MyTable(MyTableRow headers, IEnumerable <MyTableRow> rows)
 {
     Headers = headers;
     AddRows(rows);
 }
Exemple #4
0
 public MyTable(MyTableRow headers)
 {
     Headers = headers;
 }