void Example3() { string imagePath = @"Assets\ODFSample\Examples\example3.png"; 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(@"example3_simpleImageMap.odt"); }
/// <summary> /// Creates the draw area circle. /// </summary> /// <param name="drawAreaCircleNode">The draw area circle node.</param> /// <returns></returns> private DrawAreaCircle CreateDrawAreaCircle(XmlNode drawAreaCircleNode) { try { DrawAreaCircle dAreaCirc = new DrawAreaCircle(this._document, drawAreaCircleNode); ContentCollection iCol = new ContentCollection(); if (dAreaCirc.Node != null) foreach(XmlNode nodeChild in dAreaCirc.Node.ChildNodes) { IContent iContent = this.CreateContent(nodeChild); if (iContent != null) AddToCollection(iContent, iCol); //iCol.Add(iContent); } dAreaCirc.Node.InnerXml = ""; foreach(IContent iContent in iCol) AddToCollection(iContent, dAreaCirc.Content); //dAreaCirc.Content.Add(iContent); return dAreaCirc; } catch(Exception ex) { throw new AODLException("Exception while trying to create a DrawAreaCircle.", ex); } }
public void ImageMapTest() { 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", _imagefile); //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(AARunMeFirstAndOnce.outPutFolder+"simpleImageMap.odt"); }
/// <summary> /// Creates the draw area circle. /// </summary> /// <param name="drawAreaCircleNode">The draw area circle node.</param> /// <returns></returns> private DrawAreaCircle CreateDrawAreaCircle(XmlNode drawAreaCircleNode) { try { DrawAreaCircle dAreaCirc = new DrawAreaCircle(this._document, drawAreaCircleNode); IContentCollection iCol = new IContentCollection(); if(dAreaCirc.Node != null) foreach(XmlNode nodeChild in dAreaCirc.Node.ChildNodes) { IContent iContent = this.CreateContent(nodeChild); if(iContent != null) iCol.Add(iContent); } dAreaCirc.Node.InnerXml = ""; foreach(IContent iContent in iCol) dAreaCirc.Content.Add(iContent); return dAreaCirc; } catch(Exception ex) { AODLException exception = new AODLException("Exception while trying to create a DrawAreaCircle."); exception.InMethod = AODLException.GetExceptionSourceInfo(new StackFrame(1, true)); exception.Node = drawAreaCircleNode; exception.OriginalException = ex; throw exception; } }