AODL example 4
From Apache OpenOffice Wiki
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.
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.