문제

I want to know the elements which store information regarding an image in a Word 2007 xml file. (such as height, width, visibility, etc.). In Word 2003 xml I could find it is shown as follows within v : shape tag.

<v:shape id="Picture 0" o:spid="_x0000_i1025" type="#_x0000_t75" alt="31.jpg" style="width:2in;height:95.85pt;visibility:visible;mso-wrap-style:square">
<v:imagedata src="wordml://02000001.jpg" o:title="31"/>
</v:shape>

I couldn't find something similar in Word 2007 xml. Can someone tell me where I can find that?

도움이 되었습니까?

해결책

The image size is stored where the graphic is being used (as you can use the same graphic multiple times at different sizes), in the a:graphic tag in line to where the image is being used. Instead of the data being here, like earlier, this now points to a relationship ID.

The list of relationships are in the top of the file, one of them you find will have a type of 'image'. The attributes of the Relationship will be the name of the target (such as media/image1.jpeg). This is a link to the binary of your image, and will be located later on in a pkg:part/pkg:binaryData element.

It looks a bit like this:

<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
  <Relationship Id="rId8" Target="media/image1.jpeg" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/image" />
  .. other relationships
</Relationships>
.. lots more document

<pkg:part pkg:name="/word/media/image1.jpeg" pkg:contentType="image/jpeg"  pkg:compression="store">
    <pkg:binaryData>/9j/7QAsUGhvdG9zaG9wIDMuMAA....blah
</pkg:part>
.. lots more document

<w:drawing>
 <wp:inline distT="0" distB="0" distL="0" distR="0">
   <wp:extent cx="2266950" cy="1543050"/>
    <wp:effectExtent l="19050" t="0" r="0" b="0"/>
    <wp:cNvGraphicFramePr>
    <a:graphicData uri="http://schemas.openxmlformats.org/drawingml/2006/picture">
     <pic:pic xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture">
       <a:blip r:embed="rId8" cstate="print"/>
       <a:ext cx="2266950" cy="1543050"/>
       .. lots more document
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top