AODL example 14
From Apache OpenOffice Wiki
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
Create a List with List Item objects
//Create a new text document
TextDocument document = new TextDocument();
document.New();
//Create a numbered list
List li = new List(document, "L1", ListStyles.Bullet, "L1P1");
//Create a new list item
ListItem lit = new ListItem(li);
//Create a paragraph
Paragraph paragraph = ParagraphBuilder.CreateStandardTextParagraph(document);
//Add some text
paragraph.TextContent.Add(new SimpleText(document, "First item"));
//Add paragraph to the list item
lit.Content.Add(paragraph);
//Add the list item
li.Content.Add(lit);
//Add the list
document.Content.Add(li);
//Save document
document.SaveTo("list.odt");
Back to the AODL examples overview.