2017-01-10 21 views
0

イメージをxmlドキュメントに埋め込み、ドキュメントを1つのドキュメントとして保存し、テキストとイメージの両方が1つのdocxファイルに保存されるmicrosoft wordのようにファイルを配布できるようにしようとしています。 。Microsoft Wordで画像を扱う方法

どのようにMicrosoftの単語で行われます。彼らはbase64エンコーディングを使用していますか?

+0

docxは実際にはzipファイルです.zipという名前に変更して見てください。また、XMLコンテンツも含まれています。 –

答えて

0

手でそれを行うには非常に困難であり、そのようなものになります。あなたはそのようにしたくない

<?xml version="1.0" encoding="UTF-8" standalone="yes"?> 
<w:document xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" 
      xmlns:v="urn:schemas-microsoft-com:vml" 
      xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" 
      xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"> 
    <w:body> 
    <w:p> 
     <w:r> 
     <w:drawing> 
      <wp:inline distT="0" distB="0" distL="0" distR="0"> 
      <wp:extent cx="5943600" cy="3717290"/> 
      <wp:docPr id="1" name="Picture 0" descr="vlcsnap-325726.png"/> 
      <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="myImage.png"/> 
        <pic:cNvPicPr/> 
        </pic:nvPicPr> 
        <pic:blipFill> 
        <a:blip r:embed="rId4"/> 
        <a:stretch> 
         <a:fillRect/> 
        </a:stretch> 
        </pic:blipFill> 
        <pic:spPr> 
        <a:xfrm> 
         <a:off x="0" y="0"/> 
         <a:ext cx="5943600" cy="3717290"/> 
        </a:xfrm> 
        <a:prstGeom prst="rect"> 
         <a:avLst/> 
        </a:prstGeom> 
        </pic:spPr> 
       </pic:pic> 
       </a:graphicData> 
      </a:graphic> 
      </wp:inline> 
     </w:drawing> 
     </w:r> 
    </w:p> 
    </w:body> 
</w:document> 

を。 OpenXML SDK 2.0(Microsoft)やOpenXML4J(特にJavaの場合)などの外部ライブラリを使用することをお勧めします。彼らはあなたの人生をより簡単にします

関連する問題