AODL example 3

From Apache OpenOffice Wiki
Jump to: navigation, search

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();
//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 = "";
//Create a Draw Area Circle
DrawAreaCircle drawAreaCircle = new DrawAreaCircle(
    document, "4cm", "4cm", "1.5cm", null);
drawAreaCircle.Href = "";
DrawArea[] drawArea = new DrawArea[2] { drawAreaRec, drawAreaCircle };
//Create a Image Map
ImageMap imageMap = new ImageMap(document, drawArea);
//Add Image Map to the frame
//Add frame to paragraph
//Add paragraph to document
//Save the document

Back to the AODL examples overview.

Personal tools