private ODW.Inline CreateInlineDrawing_v2() { // DW.Inline.EditId : ??? (<wp:inline wp14:editId="">) //if (_name == null) // throw new PBException("missing image name"); //if (width != null && height == null) // throw new PBException("missing height (width has a value)"); //if (width == null && height != null) // throw new PBException("missing width (height has a value)"); // <wp:inline> ODW.Inline inline = new ODW.Inline() { DistanceFromTop = 0, // distT DistanceFromBottom = 0, // distB DistanceFromLeft = 0, // distL DistanceFromRight = 0 // distR //EditId = "50D07946" // wp14:editId }; // <wp:extent> inline.AppendChild(new ODW.Extent() { Cx = _emuWidth, Cy = _emuHeight }); // <wp:effectExtent> inline.AppendChild(new ODW.EffectExtent() { LeftEdge = 0L, TopEdge = 0L, RightEdge = 0L, BottomEdge = 0L }); // <wp:docPr> // Id = (UInt32Value)1U, Name = "Picture 1" inline.AppendChild(new ODW.DocProperties() { Id = _id, Name = _name, Description = _pictureElement.Description }); // <wp:cNvGraphicFramePr>, <a:graphicFrameLocks> { NoChangeAspect = true } inline.AppendChild(new ODW.NonVisualGraphicFrameDrawingProperties(new OA.GraphicFrameLocks())); // <a:graphic> OA.Graphic graphic = new OA.Graphic(); // <a:graphicData> OA.GraphicData graphicData = new OA.GraphicData() { Uri = "http://schemas.openxmlformats.org/drawingml/2006/picture" }; // <pic:pic> ODP.Picture picture = new ODP.Picture(); // <pic:nvPicPr> ODP.NonVisualPictureProperties pictureProperties = new ODP.NonVisualPictureProperties(); // <pic:cNvPr> pictureProperties.AppendChild(new ODP.NonVisualDrawingProperties() { Id = (UInt32Value)0U, Name = "Image" }); // <pic:cNvPicPr> pictureProperties.AppendChild(new ODP.NonVisualPictureDrawingProperties()); picture.AppendChild(pictureProperties); // <pic:blipFill> ODP.BlipFill blipFill = new ODP.BlipFill(); // <a:blip> // CompressionState = A.BlipCompressionValues.Print OA.Blip blip = new OA.Blip() { Embed = _embeddedReference, CompressionState = _pictureElement.CompressionState }; // $$pb todo comment // <a:extLst> OA.BlipExtensionList blipExtensions = new OA.BlipExtensionList(); // <a:ext> blipExtensions.AppendChild(new OA.BlipExtension() { Uri = "{28A0092B-C50C-407E-A947-70E740481C1C}" }); blip.AppendChild(blipExtensions); // $$pb todo comment end blipFill.AppendChild(blip); // <a:stretch> OA.Stretch stretch = new OA.Stretch(); // <a:fillRect> stretch.AppendChild(new OA.FillRectangle()); blipFill.AppendChild(stretch); picture.AppendChild(blipFill); // <pic:spPr> ODP.ShapeProperties shapeProperties = new ODP.ShapeProperties(); // <a:xfrm> OA.Transform2D transform2D = new OA.Transform2D(); // new A.Offset // <a:off> transform2D.AppendChild(new OA.Offset() { X = 0L, Y = 0L }); // <a:ext> transform2D.AppendChild(new OA.Extents() { Cx = _emuWidth, Cy = _emuHeight }); shapeProperties.AppendChild(transform2D); // <a:prstGeom> // Preset = A.ShapeTypeValues.Rectangle OA.PresetGeometry presetGeometry = new OA.PresetGeometry() { Preset = _pictureElement.PresetShape }; // <a:avLst> presetGeometry.AppendChild(new OA.AdjustValueList()); shapeProperties.AppendChild(presetGeometry); picture.AppendChild(shapeProperties); graphicData.AppendChild(picture); graphic.AppendChild(graphicData); inline.AppendChild(graphic); return inline; }
private ODW.Inline CreateInlineDrawing_v2() { int width; int height; zimg.CalculateImageWidthHeight(_pictureElement.File, _pictureElement.Width, _pictureElement.Height, out width, out height); long emuWidth = OXmlTools.PixelToEmus(width); long emuHeight = OXmlTools.PixelToEmus(height); // DW.Inline.EditId : ??? (<wp:inline wp14:editId="">) //if (_name == null) // throw new PBException("missing image name"); //if (width != null && height == null) // throw new PBException("missing height (width has a value)"); //if (width == null && height != null) // throw new PBException("missing width (height has a value)"); // <wp:inline> ODW.Inline inline = new ODW.Inline() { DistanceFromTop = 0, // distT DistanceFromBottom = 0, // distB DistanceFromLeft = 0, // distL DistanceFromRight = 0 // distR //EditId = "50D07946" // wp14:editId }; // <wp:extent> inline.AppendChild(new ODW.Extent() { Cx = emuWidth, Cy = emuHeight }); // <wp:effectExtent> inline.AppendChild(new ODW.EffectExtent() { LeftEdge = 0L, TopEdge = 0L, RightEdge = 0L, BottomEdge = 0L }); // <wp:docPr> // Id = (UInt32Value)1U, Name = "Picture 1" inline.AppendChild(new ODW.DocProperties() { Id = _id, Name = _name, Description = _pictureElement.Description }); // <wp:cNvGraphicFramePr>, <a:graphicFrameLocks> { NoChangeAspect = true } inline.AppendChild(new ODW.NonVisualGraphicFrameDrawingProperties(new OA.GraphicFrameLocks())); // <a:graphic> OA.Graphic graphic = new OA.Graphic(); // <a:graphicData> OA.GraphicData graphicData = new OA.GraphicData() { Uri = "http://schemas.openxmlformats.org/drawingml/2006/picture" }; // <pic:pic> ODP.Picture picture = new ODP.Picture(); // <pic:nvPicPr> ODP.NonVisualPictureProperties pictureProperties = new ODP.NonVisualPictureProperties(); // <pic:cNvPr> pictureProperties.AppendChild(new ODP.NonVisualDrawingProperties() { Id = (UInt32Value)0U, Name = "Image" }); // <pic:cNvPicPr> pictureProperties.AppendChild(new ODP.NonVisualPictureDrawingProperties()); picture.AppendChild(pictureProperties); // <pic:blipFill> ODP.BlipFill blipFill = new ODP.BlipFill(); // <a:blip> // CompressionState = A.BlipCompressionValues.Print OA.Blip blip = new OA.Blip() { Embed = _embeddedReference, CompressionState = _pictureElement.CompressionState }; // $$pb todo comment // <a:extLst> OA.BlipExtensionList blipExtensions = new OA.BlipExtensionList(); // <a:ext> blipExtensions.AppendChild(new OA.BlipExtension() { Uri = "{28A0092B-C50C-407E-A947-70E740481C1C}" }); blip.AppendChild(blipExtensions); // $$pb todo comment end blipFill.AppendChild(blip); // <a:stretch> OA.Stretch stretch = new OA.Stretch(); // <a:fillRect> stretch.AppendChild(new OA.FillRectangle()); blipFill.AppendChild(stretch); picture.AppendChild(blipFill); // <pic:spPr> ODP.ShapeProperties shapeProperties = new ODP.ShapeProperties(); // <a:xfrm> OA.Transform2D transform2D = new OA.Transform2D(); // new A.Offset // <a:off> transform2D.AppendChild(new OA.Offset() { X = 0L, Y = 0L }); // <a:ext> transform2D.AppendChild(new OA.Extents() { Cx = emuWidth, Cy = emuHeight }); shapeProperties.AppendChild(transform2D); // <a:prstGeom> // Preset = A.ShapeTypeValues.Rectangle OA.PresetGeometry presetGeometry = new OA.PresetGeometry() { Preset = _pictureElement.PresetShape }; // <a:avLst> presetGeometry.AppendChild(new OA.AdjustValueList()); shapeProperties.AppendChild(presetGeometry); picture.AppendChild(shapeProperties); graphicData.AppendChild(picture); graphic.AppendChild(graphicData); inline.AppendChild(graphic); return(inline); }