AODL example 14

From Apache OpenOffice Wiki
Revision as of 12:44, 22 May 2022 by DiGro (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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.

Personal tools