Difference between revisions of "AODL example 13"
From Apache OpenOffice Wiki
m |
|||
(One intermediate revision by one other user not shown) | |||
Line 1: | Line 1: | ||
<b>Using the Header object and fill the heading text using the TextBuilder class</b> | <b>Using the Header object and fill the heading text using the TextBuilder class</b> | ||
− | < | + | <syntaxhighlight lang="c"> |
− | string headingText = "Some Heading with\n styles\t,line breaks, tab stops and extra | + | string headingText = "Some Heading with\n styles\t,line breaks, tab stops and extra whitespaces"; |
//Create a new text document | //Create a new text document | ||
TextDocument document = new TextDocument(); | TextDocument document = new TextDocument(); | ||
Line 17: | Line 17: | ||
document.Content.Add(header); | document.Content.Add(header); | ||
document.SaveTo("HeadingWithControlCharacter.odt"); | document.SaveTo("HeadingWithControlCharacter.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]] |
Latest revision as of 12:43, 22 May 2022
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.