private void AddAllContentToDocument(TextDocument document) { AddPictureFromFile(document, "The Title Page"); //Create a paragraph with a header var p = document.AddNamedParagraph("Introduction", SonnetIntroduction(), 1, "1"); p.SetParagraphType("Introdcution"); //Create a paragraph with a header var p1 = document.AddNamedParagraph("Sonnet 1", Sonnet1(), 1, "1"); p1.SetParagraphType("Sonnet"); //Create a paragraph with a header on the level 0. var p0 = document.AddParagraph("Other sonnets", "Other sonnets from Shakespeare", 0); //Now we create a second pargraph as a sub paragraph of the previous one. //As the paragraphs are added sequentialy this paragraph will be directly added after p1 and because the paragraph level is 2 //it will become a subparagraph. var subOfP1 = document.AddNamedParagraph("Sonnet II", Sonnet2(), 2, "2"); subOfP1.SetParagraphType("Sonnet"); //Now we add only a header var header = document.AddParagraph("Sonnet III", string.Empty, 1); //Now add a paragraph with only text var text = document.AddParagraph("The text for sonnet III", 1); //You can also change the text of the paragraph. text.Text = Sonnet3(); //Some basic text styles can also be performed. var styledParagraph = document.AddNamedParagraph("Commentary", CommentarySonnet3(), 1, "4"); styledParagraph.SetParagraphType("Commentary"); AddLinearTableToDocument(document, "Table 1"); AddTableWithDifferentNumberOfColumnsPerRowToDocument(document, "Table 2"); AddTableWithNoColumnDefinitionToDocument(document, "Table 3"); //Add a numbered list AddNumberedList(document, "Name"); //Add the same list but then as a bullet list AddBulletList(document, "Name"); //Add an image AddPictureFromStream(document, "Shakespeare"); //Add an image without a title var picture3 = document.AddPicture(_shakespeareFixtures.Shakespeare, string.Empty); }
public void AddParagraphAtTopLevel() { var paragraph = _document.AddParagraph("This is the paragraph", 0); Assert.NotNull(paragraph); Assert.True(_document.Paragraphs.Count == 1, "Paragraph not added to the document"); Assert.Same(paragraph, _document.Paragraphs[0]); }