public void TestCreateFootnotes() { XWPFDocument docOut = new XWPFDocument(); XWPFFootnotes footnotes = docOut.CreateFootnotes(); Assert.IsNotNull(footnotes); XWPFFootnotes secondFootnotes = docOut.CreateFootnotes(); Assert.AreSame(footnotes, secondFootnotes); docOut.Close(); }
public XWPFDocument Render(USFMDocument input) { UnrenderableMarkers = new List <string>(); CrossRefMarkers = new Dictionary <string, Marker>(); newDoc = new XWPFDocument(); if (FrontMatter != null) { RenderFrontMatter(FrontMatter); } if (configDocx.renderTableOfContents) { DocumentStylesBuilder.BuildStylesForTOC(newDoc); RenderTOC(); } newDoc.CreateFootnotes(); setStartPageNumber(); newDoc.ColumnCount = configDocx.columnCount; foreach (Marker marker in input.Contents) { RenderMarker(marker, new StyleConfig()); } // Add section header for final book if (previousBookHeader != null) { createBookHeaders(previousBookHeader); } // Make final document section continuous so that it doesn't // create an extra page at the end. Final section is unique: // it's a direct child of the document, not a child of the last // paragraph. CT_SectPr finalSection = new CT_SectPr(); finalSection.type = new CT_SectType(); finalSection.type.val = ST_SectionMark.continuous; newDoc.Document.body.sectPr = finalSection; finalSection.cols.num = configDocx.columnCount.ToString(); CT_PageNumber pageNum = new CT_PageNumber { fmt = ST_NumberFormat.@decimal }; finalSection.pgNumType = pageNum; return(newDoc); }
public void TestAddFootnotesToDocument() { XWPFDocument docOut = new XWPFDocument(); int noteId = 1; XWPFFootnotes footnotes = docOut.CreateFootnotes(); CT_FtnEdn ctNote = new CT_FtnEdn(); ctNote.id = (noteId.ToString()); ctNote.type = (ST_FtnEdn.normal); footnotes.AddFootnote(ctNote); XWPFDocument docIn = XWPFTestDataSamples.WriteOutAndReadBack(docOut); XWPFFootnote note = docIn.GetFootnoteByID(noteId); Assert.AreEqual(note.GetCTFtnEdn().type, ST_FtnEdn.normal); }