Difference between revisions of "AODL example 13"

From Apache OpenOffice Wiki
Jump to: navigation, search
 
Line 19: Line 19:
 
</pre>
 
</pre>
 
Back to the [[AODL_examples|AODL examples]] overview.
 
Back to the [[AODL_examples|AODL examples]] overview.
 +
[[category:Summer of Code 2007]][[category:AODL]]

Revision as of 22:16, 25 June 2007

Using the Header object and fill the heading text using the TextBuilder class

string headingText = "Some    Heading with\n styles\t,line breaks, tab stops and extra whitspaces";
//Create a new text document
TextDocument document = new TextDocument();
document.New();
//Create a new Heading
Header header = new Header(document, Headings.Heading);
//Create a TextCollection from headingText using the TextBuilder
//You can conert every string incl. control character \n, \t, .. into
//a ItextCollection using the TextBuilder
ITextCollection textCol = TextBuilder.BuildTextCollection(document, headingText);
//Add text collection
header.TextContent = textCol;
//Add header
document.Content.Add(header);
document.SaveTo("HeadingWithControlCharacter.odt");

Back to the AODL examples overview.

Personal tools