AODL example 13

From Apache OpenOffice Wiki
Jump to: navigation, search
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.

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 whitespaces";
//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