AODL example 15

From Apache OpenOffice Wiki
Jump to: navigation, search

Create a standard Paragraph with formated text

//Create a new text document
TextDocument document = new TextDocument();
document.New();
//Create a standard paragraph using the ParagraphBuilder
Paragraph paragraph = ParagraphBuilder.CreateStandardTextParagraph(document);
//Add some formatted text
FormatedText formText = new FormatedText(document, "T1", "Some formatted text!");
formText.TextStyle.TextProperties.Bold = "bold";
paragraph.TextContent.Add(formText);
//Add the paragraph to the document
document.Content.Add(paragraph);
//Save 
document.SaveTo("formatted.odt");

Back to the AODL examples overview.

Personal tools