Difference between revisions of "AODL example 14"
From Apache OpenOffice Wiki
m |
|||
| Line 1: | Line 1: | ||
<b>Create a List with List Item objects</b> | <b>Create a List with List Item objects</b> | ||
| − | < | + | <syntaxhighlight lang="c"> |
//Create a new text document | //Create a new text document | ||
TextDocument document = new TextDocument(); | TextDocument document = new TextDocument(); | ||
| Line 21: | Line 21: | ||
//Save document | //Save document | ||
document.SaveTo("list.odt"); | document.SaveTo("list.odt"); | ||
| − | </ | + | </syntaxhighlight> |
Back to the [[AODL_examples|AODL examples]] overview. | Back to the [[AODL_examples|AODL examples]] overview. | ||
[[category:Summer of Code 2007]][[category:AODL]] | [[category:Summer of Code 2007]][[category:AODL]] | ||
Latest revision as of 12:44, 22 May 2022
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.