コード例 #1
0
        public void Format(Body body, Table table)
        {
            var wordTable = new DocumentFormat.OpenXml.Wordprocessing.Table();

            wordTable.Append(GenerateTableProperties());
            var headerRow = new TableRow();

            foreach (string cell in table.HeaderRow)
            {
                var wordCell = new TableCell();
                wordCell.Append(new Paragraph(new Run(new Text(cell))));
                headerRow.Append(wordCell);
            }
            wordTable.Append(headerRow);

            foreach (Parser.TableRow row in table.DataRows)
            {
                var wordRow = new TableRow();

                foreach (string cell in row)
                {
                    var wordCell = new TableCell();
                    wordCell.Append(new Paragraph(new Run(new Text(cell))));
                    wordRow.Append(wordCell);
                }

                wordTable.Append(wordRow);
            }

            body.Append(wordTable);
        }
コード例 #2
0
        public void Format(Body body, Table table)
        {
            var wordTable = new DocumentFormat.OpenXml.Wordprocessing.Table();
            wordTable.Append(GenerateTableProperties());
            var headerRow = new TableRow();
            foreach (string cell in table.HeaderRow)
            {
                var wordCell = new TableCell();
                wordCell.Append(new Paragraph(new Run(new Text(cell))));
                headerRow.Append(wordCell);
            }
            wordTable.Append(headerRow);

            foreach (Parser.TableRow row in table.DataRows)
            {
                var wordRow = new TableRow();

                foreach (string cell in row)
                {
                    var wordCell = new TableCell();
                    wordCell.Append(new Paragraph(new Run(new Text(cell))));
                    wordRow.Append(wordCell);
                }

                wordTable.Append(wordRow);
            }

            body.Append(wordTable);
        }