Difference between revisions of "AODL example 7"
From Apache OpenOffice Wiki
m |
|||
| Line 1: | Line 1: | ||
<b>Create a simple text table by using the TableBuilder class</b> | <b>Create a simple text table by using the TableBuilder class</b> | ||
| − | < | + | <syntaxhighlight lang="c"> |
//Create a new text document | //Create a new text document | ||
TextDocument document = new TextDocument(); | TextDocument document = new TextDocument(); | ||
| Line 25: | Line 25: | ||
//Save the document | //Save the document | ||
document.SaveTo("simpleTable.odt"); | document.SaveTo("simpleTable.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:38, 22 May 2022
Create a simple text table by using the TableBuilder class
//Create a new text document
TextDocument document = new TextDocument();
document.New();
//Create a table for a text document using the TableBuilder
Table table = TableBuilder.CreateTextDocumentTable(
document,
"table1",
"table1",
3,
3,
16.99,
false,
false);
//Create a standard paragraph
Paragraph paragraph = ParagraphBuilder.CreateStandardTextParagraph(document);
//Add some simple text
paragraph.TextContent.Add(new SimpleText(document, "Some cell text"));
//Insert paragraph into the first cell
table.RowCollection[0].CellCollection[0].Content.Add(paragraph);
//Add table to the document
document.Content.Add(table);
//Save the document
document.SaveTo("simpleTable.odt");
Back to the AODL examples overview.