InlineStoryParagraphs Property |
Namespace: Aspose.Words
Document doc = new Document(); DocumentBuilder builder = new DocumentBuilder(doc); builder.Write("Some text is added."); Comment comment = new Comment(doc, "Amy Lee", "AL", DateTime.Today); builder.CurrentParagraph.AppendChild(comment); comment.Paragraphs.Add(new Paragraph(doc)); comment.FirstParagraph.Runs.Add(new Run(doc, "Comment text."));
// Create a new document and append some text that we will reference with a footnote Document doc = new Document(); DocumentBuilder builder = new DocumentBuilder(doc); builder.Write("Main body text."); // Add a footnote and give it text, which will appear at the bottom of the page Footnote footnote = builder.InsertFootnote(FootnoteType.Footnote, "Footnote text."); // This attribute means the footnote in the main text will automatically be assigned a number, "1" in this instance // The next footnote will get "2" Assert.True(footnote.IsAuto); // We can edit the footnote's text like this // Make sure to move the builder back into the document body afterwards builder.MoveTo(footnote.FirstParagraph); builder.Write(" More text added by a DocumentBuilder."); builder.MoveToDocumentEnd(); Assert.AreEqual("Footnote text. More text added by a DocumentBuilder.", footnote.Paragraphs[0].ToString(SaveFormat.Text).Trim()); builder.Write(" More main body text."); footnote = builder.InsertFootnote(FootnoteType.Footnote, "Footnote text."); // Substitute the reference number for our own custom mark by setting this variable, "IsAuto" will also be set to false footnote.ReferenceMark = "RefMark"; Assert.False(footnote.IsAuto); // This bookmark will get a number "3" even though there was no "2" builder.Write(" More main body text."); footnote = builder.InsertFootnote(FootnoteType.Footnote, "Footnote text."); Assert.True(footnote.IsAuto); doc.Save(ArtifactsDir + "InlineStory.AddFootnote.docx");