Skip to content

Commit

Permalink
Add new example
Browse files Browse the repository at this point in the history
  • Loading branch information
PrzemyslawKlys committed Feb 5, 2024
1 parent e0e03f1 commit ab4a27f
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
1 change: 1 addition & 0 deletions OfficeIMO.Examples/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ static void Main(string[] args) {
Lists.Example_BasicLists4(folderPath, false);
Lists.Example_BasicLists2Load(folderPath, false);
Lists.Example_BasicLists7(folderPath, false);
Lists.Example_BasicLists8(folderPath, false);
Tables.Example_BasicTables1(folderPath, false);
Tables.Example_BasicTablesLoad1(folderPath, false);
Tables.Example_BasicTablesLoad2(templatesPath, folderPath, false);
Expand Down
43 changes: 43 additions & 0 deletions OfficeIMO.Examples/Word/Lists/Lists.Create8.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
using System;
using OfficeIMO.Word;

namespace OfficeIMO.Examples.Word {
internal static partial class Lists {
internal static void Example_BasicLists8(string folderPath, bool openWord) {
Console.WriteLine("[*] Creating standard document with lists - Document 8");
string filePath = System.IO.Path.Combine(folderPath, "Document with Lists11.docx");
using (WordDocument document = WordDocument.Create(filePath)) {

// add list and nest a list
WordList wordList1 = document.AddList(WordListStyle.Headings111, false);
wordList1.AddItem("Text 1");
wordList1.AddItem("Text 1.1");
wordList1.AddItem("Text 1.2");
wordList1.AddItem("Text 1.3");

document.AddParagraph("Second List");
document.AddParagraph();

WordList wordList2 = document.AddList(WordListStyle.Headings111, false);
wordList2.AddItem("Text 2");
wordList2.AddItem("Text 2.1");
wordList2.AddItem("Text 2.2");
wordList2.AddItem("Text 2.3");
wordList2.AddItem("Text 2.4");

document.AddParagraph("Third List");
document.AddParagraph();

WordList wordList3 = document.AddList(WordListStyle.Headings111, false);
wordList3.AddItem("Text 3");
wordList3.AddItem("Text 3.1");
wordList3.AddItem("Text 3.2");
wordList3.AddItem("Text 3.3");
wordList3.AddItem("Text 3.4");


document.Save(openWord);
}
}
}
}

0 comments on commit ab4a27f

Please sign in to comment.