protected override void RenderTable(ResumeTable resumeTable) { var wordTable = new Table(); var tableProperties = wordTable.AppendChild(new TableProperties()); tableProperties.AppendChild(new TableWidth() { Width = ConvertToPctWidth(resumeTable.WidthPercentage), Type = TableWidthUnitValues.Pct }); tableProperties.AppendChild(WordConverter.GetJustification(resumeTable.HorisontalAlignment)); // need this table grid for validation purposes. Otherwise the validation by schema is failed var tableGrid = wordTable.AppendChild(new TableGrid()); for (var i = 0; i < resumeTable.RelativeColumnWidths.Count(); i++) { // for each column we need to add a GridColumn. // No idea why we need this, but without this validation fails tableGrid.AppendChild(new GridColumn()); } foreach (var resumeRow in resumeTable) { var wordRow = wordTable.AppendChild(new TableRow()); for (var i = 0; i < resumeRow.Count; i++) { var resumeCell = resumeRow[i]; var wordCell = wordRow.AppendChild(new TableCell()); var tableCellProperties = new TableCellProperties( new TableCellWidth() { Width = ConvertToPctWidth(resumeTable.RelativeColumnWidths[i]), Type = TableWidthUnitValues.Pct }); wordCell.AppendChild(tableCellProperties); wordCell.AppendChild(WordConverter.GetWordParagraph(resumeCell.Paragraph)); } } this.body.AppendChild(wordTable); }
protected override void RenderParagraph(ResumeParagraph resumeParagraph) { var wordParagraph = WordConverter.GetWordParagraph(resumeParagraph); this.body.AppendChild(wordParagraph); }