Difference between revisions of "AODL example 4"

From Apache OpenOffice Wiki
Jump to: navigation, search
 
Line 25: Line 25:
 
</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:24, 25 June 2007

Add a graphic as a illustration to your text document

TextDocument textdocument = new TextDocument();
textdocument.New();
Paragraph pOuter = ParagraphBuilder.CreateStandardTextParagraph(textdocument);
DrawTextBox drawTextBox = new DrawTextBox(textdocument);
Frame frameTextBox = new Frame(textdocument, "fr_txt_box");
frameTextBox.DrawName = "fr_txt_box";
frameTextBox.ZIndex = "0";
Paragraph p = ParagraphBuilder.CreateStandardTextParagraph(textdocument);
p.StyleName = "Illustration";
Frame frame = new Frame(textdocument, "frame1", "graphic1", _imagefile);
frame.ZIndex = "1";
p.Content.Add(frame);
p.TextContent.Add(new SimpleText(textdocument, "Illustration"));
drawTextBox.Content.Add(p);
frameTextBox.SvgWidth = frame.SvgWidth;
drawTextBox.MinWidth  = frame.SvgWidth;
drawTextBox.MinHeight = frame.SvgHeight;
frameTextBox.Content.Add(drawTextBox);
pOuter.Content.Add(frameTextBox);
textdocument.Content.Add(pOuter);
textdocument.SaveTo("drawTextbox.odt");

Back to the AODL examples overview.

Personal tools