我正在創建帶有嵌入式矢量圖形的Word DOCX文件。顯然,DrawingML現在是插入矢量圖形的首選方式。我無法解決如何在繪圖畫布中剪切圖表的問題。它似乎不斷縮放我的形狀在組形狀。在DrawingML中剪切
在DrawingML中裁剪是否可能,如果是的話,是否有人有一小段代碼或XML指向正確的方向?
我正在創建帶有嵌入式矢量圖形的Word DOCX文件。顯然,DrawingML現在是插入矢量圖形的首選方式。我無法解決如何在繪圖畫布中剪切圖表的問題。它似乎不斷縮放我的形狀在組形狀。在DrawingML中剪切
在DrawingML中裁剪是否可能,如果是的話,是否有人有一小段代碼或XML指向正確的方向?
DrawingML中的裁剪來自<scrRect/>
標記。如果它只是空的,就意味着它被裁剪了。此標記用於所有視覺圖形,如圖像,形狀,圖表等
採取插入在Word中.EMF的這兩個例子:
<w:drawing>
<wp:inline distT="0" distB="0" distL="0" distR="0">
<wp:extent cx="5934456" cy="7269480"/>
<wp:effectExtent l="0" t="0" r="9525" b="7620"/>
<wp:docPr id="1" name="Picture 1" descr="C:\Users\Todd\Pictures\Dotted_Lines.emf"/>
<wp:cNvGraphicFramePr>
<a:graphicFrameLocks xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" noChangeAspect="1"/>
</wp:cNvGraphicFramePr>
<a:graphic xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main">
<a:graphicData uri="http://schemas.openxmlformats.org/drawingml/2006/picture">
<pic:pic xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture">
<pic:nvPicPr>
<pic:cNvPr id="0" name="Picture 1" descr="C:\Users\Todd\Pictures\Dotted_Lines.emf"/>
<pic:cNvPicPr>
<a:picLocks noChangeAspect="1" noChangeArrowheads="1"/>
</pic:cNvPicPr>
</pic:nvPicPr>
<pic:blipFill>
<a:blip r:embed="rId5">
<a:extLst>
<a:ext uri="{28A0092B-C50C-407E-A947-70E740481C1C}">
<a14:useLocalDpi xmlns:a14="http://schemas.microsoft.com/office/drawing/2010/main" val="0"/>
</a:ext>
</a:extLst>
</a:blip>
<a:srcRect/>
<a:stretch>
<a:fillRect/>
</a:stretch>
</pic:blipFill>
<pic:spPr bwMode="auto">
<a:xfrm>
<a:off x="0" y="0"/>
<a:ext cx="5934456" cy="7269480"/>
</a:xfrm>
<a:prstGeom prst="rect">
<a:avLst/>
</a:prstGeom>
<a:noFill/>
<a:ln>
<a:noFill/>
</a:ln>
</pic:spPr>
</pic:pic>
</a:graphicData>
</a:graphic>
</wp:inline>
</w:drawing>
和
<w:drawing>
<wp:inline distT="0" distB="0" distL="0" distR="0" wp14:anchorId="779C87CB" wp14:editId="4B126F88">
<wp:extent cx="3390181" cy="4882551"/>
<wp:effectExtent l="0" t="0" r="1270" b="0"/>
<wp:docPr id="2" name="Picture 2" descr="C:\Users\Todd\Pictures\Dotted_Lines.emf"/>
<wp:cNvGraphicFramePr>
<a:graphicFrameLocks xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" noChangeAspect="1"/>
</wp:cNvGraphicFramePr>
<a:graphic xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main">
<a:graphicData uri="http://schemas.openxmlformats.org/drawingml/2006/picture">
<pic:pic xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture">
<pic:nvPicPr>
<pic:cNvPr id="0" name="Picture 1" descr="C:\Users\Todd\Pictures\Dotted_Lines.emf"/>
<pic:cNvPicPr>
<a:picLocks noChangeAspect="1" noChangeArrowheads="1"/>
</pic:cNvPicPr>
</pic:nvPicPr>
<pic:blipFill rotWithShape="1">
<a:blip r:embed="rId5">
<a:extLst>
<a:ext uri="{28A0092B-C50C-407E-A947-70E740481C1C}">
<a14:useLocalDpi xmlns:a14="http://schemas.microsoft.com/office/drawing/2010/main" val="0"/>
</a:ext>
</a:extLst>
</a:blip>
<a:srcRect l="23111" r="19768" b="32841"/>
<a:stretch/>
</pic:blipFill>
<pic:spPr bwMode="auto">
<a:xfrm>
<a:off x="0" y="0"/>
<a:ext cx="3389885" cy="4882125"/>
</a:xfrm>
<a:prstGeom prst="rect">
<a:avLst/>
</a:prstGeom>
<a:noFill/>
<a:ln>
<a:noFill/>
</a:ln>
<a:extLst>
<a:ext uri="{53640926-AAD7-44D8-BBD7-CCE9431645EC}">
<a14:shadowObscured xmlns:a14="http://schemas.microsoft.com/office/drawing/2010/main"/>
</a:ext>
</a:extLst>
</pic:spPr>
</pic:pic>
</a:graphicData>
</a:graphic>
</wp:inline>
</w:drawing>
請注意,它們是相同的,除了第二個行<a:srcRect l="23111" r="19768" b="32841"/>
。這意味着源矩形(即圖像的尺寸)被裁減/裁剪/裁剪左邊23.111%,右邊19.768%和底部32.841%。頂部尚未裁剪。
如果內容不是emf,你能否確認這是否仍然適用?當然,在Word中,有一個帶有DrawingML的內聯畫布,沒有UI選項可以裁剪它;而如果內容是位圖。這隻有在直接編輯docx時纔可用?另外,我將EMF轉換成了一個形狀,裁剪後的部分被包含在畫布中,縮小了整個圖形的範圍! – axeman 2011-06-12 11:53:18
'scrRect'只適用於blips(即任何類型的位圖圖像) - 它不適用於自定義幾何體('custGeom')或VML。在Word 2007中,當向量blip被解構爲一組幾何圖形時,它將變成VML。在Word 2010中,它首先成爲具有'wpc'命名空間(WordProcessingCanvas)的'custGeom'集合,然後具有VML的後備,因此可以在Word 2007中顯示。無論哪種情況,都不允許整個畫布在用戶界面或代碼中只剪輯單個部分。 – 2011-06-12 17:28:05
你可以發佈你想剪輯的例子XML嗎?例如你的w:繪圖元素? – JasonPlutext 2011-06-07 13:28:50