Difference between revisions of "AODL example 3"

From Apache OpenOffice Wiki
Jump to: navigation, search
m
 
(One intermediate revision by the same user not shown)
Line 4: Line 4:
 
define DrawAreaRectangles and DrawAreaCircle regions incl. hyperlinks.</p>
 
define DrawAreaRectangles and DrawAreaCircle regions incl. hyperlinks.</p>
  
<pre>
+
<syntaxhighlight lang="c">
 
string imagePath = @"Z:\Files\new_Class.jpg";
 
string imagePath = @"Z:\Files\new_Class.jpg";
 
TextDocument document = new TextDocument();
 
TextDocument document = new TextDocument();
Line 31: Line 31:
 
//Save the document
 
//Save the document
 
document.SaveTo(@"F:\tests\simpleImageMap.odt");
 
document.SaveTo(@"F:\tests\simpleImageMap.odt");
</pre>
+
</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:35, 22 May 2022

Add Image Maps to your document

This snippet give you an example how to graphics as Image Maps to your document and how to define DrawAreaRectangles and DrawAreaCircle regions incl. hyperlinks.

string imagePath = @"Z:\Files\new_Class.jpg";
TextDocument document = new TextDocument();
document.New();
//Create standard paragraph
Paragraph paragraphOuter = ParagraphBuilder.CreateStandardTextParagraph(document);
//Create the frame with graphic
Frame frame = new Frame(document, "frame1", "graphic1", imagePath);
//Create a Draw Area Rectangle
DrawAreaRectangle drawAreaRec = new DrawAreaRectangle(
    document, "0cm", "0cm", "1.5cm", "2.5cm", null);
drawAreaRec.Href = "http://OpenDocument4all.com";
//Create a Draw Area Circle
DrawAreaCircle drawAreaCircle = new DrawAreaCircle(
    document, "4cm", "4cm", "1.5cm", null);
drawAreaCircle.Href = "http://AODL.OpenDocument4all.com";
DrawArea[] drawArea = new DrawArea[2] { drawAreaRec, drawAreaCircle };
//Create a Image Map
ImageMap imageMap = new ImageMap(document, drawArea);
//Add Image Map to the frame
frame.Content.Add(imageMap);
//Add frame to paragraph
paragraphOuter.Content.Add(frame);
//Add paragraph to document
document.Content.Add(paragraphOuter);
//Save the document
document.SaveTo(@"F:\tests\simpleImageMap.odt");

Back to the AODL examples overview.

Personal tools