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 RenderBulletedList(ResumeBulletedList bulletedList) { var currentNumberingId = numberberingId++; GenerateNumberingDefinitions(currentNumberingId); foreach (var listItem in bulletedList.Paragraphs) { var run = new Run(); run.AppendChild(WordConverter.GetRunProperties(listItem.ResumeFont)); run.Append(WordConverter.CreateLineBreaks(listItem.Text)); var extraProperties = new List <OpenXmlElement>() { new ParagraphStyleId() { Val = "ListParagraph" }, new NumberingProperties( new NumberingLevelReference() { Val = 0 }, new NumberingId() { Val = currentNumberingId }) }; var paragraphProperties = WordConverter.GetParagraphProperties(listItem, extraProperties); var wordParagraph = new Paragraph(paragraphProperties, run); this.body.AppendChild(wordParagraph); } }
protected override void RenderParagraph(ResumeParagraph resumeParagraph) { var wordParagraph = WordConverter.GetWordParagraph(resumeParagraph); this.body.AppendChild(wordParagraph); }