private Table CreateTitleTable(string title) { var table = new Table(); // Append the TableProperties object to the empty table. table.AppendChild <TableProperties>(WordTableFormats.TitleTableFormat()); // Create a row. var tr = new TableRow(new TableRowProperties(new TableRowHeight() { Val = Convert.ToUInt32(500) })); // Create a cell. var tc = new TableCell(); var rp = new RunProperties(new RunFonts() { Ascii = "Times New Roman" }, new Bold(), new FontSize() { Val = "24" }); // Specify the table cell content. tc.AppendChild(new TableCellProperties(new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center })); tc.AppendChild(new Paragraph(new ParagraphProperties(new Justification() { Val = JustificationValues.Center }), new Run(rp, new Text(title)))); // Append the table cell to the table row. tr.AppendChild(tc); // Append the table row to the table. table.AppendChild(tr); return(table); }
private Table CreateSubTable(TestResultGroup testResultGroup) { int numResults = testResultGroup.Tests.Count(); Table table = new Table(); // Append the TableProperties object to the empty table. table.AppendChild <TableProperties>(WordTableFormats.SubTableFormat()); // Create a row. int cellHeight = 375; TableRow tr = new TableRow(new TableRowProperties(new TableRowHeight() { Val = Convert.ToUInt32(cellHeight) })); TableCell testName = new TableCell(WordTableFormats.LabelCellFormat(), new Paragraph(new Run(new RunProperties(new RunFonts() { Ascii = "Times New Roman" }, new Bold(), new FontSize() { Val = "24" }), new Text("Tests")))); TableCell zScore = new TableCell(WordTableFormats.LabelCellFormat(), new Paragraph(new Run(new RunProperties(new RunFonts() { Ascii = "Times New Roman" }, new Bold(), new FontSize() { Val = "24" }), new Text("StandardizedScore")))); TableCell percentile = new TableCell(WordTableFormats.LabelCellFormat(), new Paragraph(new Run(new RunProperties(new RunFonts() { Ascii = "Times New Roman" }, new Bold(), new FontSize() { Val = "24" }), new Text("Percentile")))); tr.Append(testName, zScore, percentile); table.AppendChild(tr); foreach (TestResult result in testResultGroup.Tests) { tr = new TableRow(new TableRowProperties(new TableRowHeight() { Val = Convert.ToUInt32(cellHeight) })); testName = new TableCell(WordTableFormats.DataCellFormat(), new Paragraph(new Run(new Text(result.Test.Name)))); zScore = new TableCell(WordTableFormats.DataCellFormat(), new Paragraph(new Run(new Text(result.StandardizedScore.ToString())))); percentile = new TableCell(WordTableFormats.DataCellFormat(), new Paragraph(new Run(new Text(result.Percentile.ToString())))); tr.AppendChild(testName); tr.AppendChild(zScore); tr.AppendChild(percentile); table.AppendChild(tr); } return(table); }