Exemplo n.º 1
0
        public void CreateNumberedList()
        {
            var numberedList = _document.AddNumberedList();

            numberedList.AddItem(0, "Numbered Item 1");
            numberedList.AddItem(0, "Numbered Item 2");
            numberedList.AddItem(1, "Numbered Item 2a");
            numberedList.AddItem(2, "Numbered Item 2aa");
            numberedList.AddItem(0, "Numbered Item 3");

            var list  = _document.Paragraphs[0] as NumberedList;
            var item1 = list.Items[0];
            var item2 = list.Items[1];
            var item3 = list.Items[2];
            var item4 = list.Items[3];
            var item5 = list.Items[4];

            Assert.True(_document.Paragraphs.Count == 1, "List not added to document");
            Assert.True(list.Items.Count == 5, "Not the correct number of items in the list");
            Assert.True(item1.Text == "Numbered Item 1", "Text of item 1 in the list is not correct");
            Assert.True(item1.Level == 0, "Level of item 1 in the list is not correct");
            Assert.True(item2.Text == "Numbered Item 2", "Text of item 2 in the list is not correct");
            Assert.True(item2.Level == 0, "Level of item 2 in the list is not correct");
            Assert.True(item3.Text == "Numbered Item 2a", "Text of item 3 in the list is not correct");
            Assert.True(item3.Level == 1, "Level of item 3 in the list is not correct");
            Assert.True(item4.Text == "Numbered Item 2aa", "Text of item 4 in the list is not correct");
            Assert.True(item4.Level == 2, "Level of item 4 in the list is not correct");
            Assert.True(item5.Text == "Numbered Item 3", "Text of item 5 in the list is not correct");
            Assert.True(item5.Level == 0, "Level of item 5 in the list is not correct");
        }
Exemplo n.º 2
0
        private NumberedList AddNumberedListFromLevel1(TextDocument document, string name)
        {
            //Add a numbered list
            var numberedList = document.AddNumberedList();

            numberedList.AddItem(1, "Characters");
            numberedList.AddItem(2, "Fair Youth");
            numberedList.AddItem(3, "For a closer look at the negative aspects of the poet's relationship with the young man and his mistress, please see Sonnet 75 and Sonnet 147.");
            numberedList.AddItem(3, "For a celebration of the love between the young man and the poet, see Sonnet 18 and Sonnet 29.");
            numberedList.AddItem(3, "For the poet's views on the mortality of the young man, see Sonnet 73.");
            numberedList.AddItem(2, "The Dark Lady");
            numberedList.AddItem(3, "For a closer look at the negative aspects of the poet's relationship with the young man and his mistress, please see Sonnet 75 and Sonnet 147.");
            numberedList.AddItem(3, "For the poet’s description of his mistress, see Sonnet 130.");
            numberedList.AddItem(2, "The Rival Poet");
            numberedList.AddItem(3, "For a celebration of the love between the young man and the poet, see Sonnet 18 and Sonnet 29.");

            return(numberedList);
        }