Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Word 2007 xml文档的基本部分_Xml_Ms Word_Word 2007_Wordml - Fatal编程技术网

Word 2007 xml文档的基本部分

Word 2007 xml文档的基本部分,xml,ms-word,word-2007,wordml,Xml,Ms Word,Word 2007,Wordml,我有一个xml文件,需要用MicrosoftWord2007打开。我自己写的。但当我试图打开它时,它会告诉我“某些部件丢失或无效”。我认为这种情况会发生,因为我的文档没有定义所有必需的属性。因此,我需要知道使用Word 2007打开xml文档必须具备哪些条件。我定义了以下属性 cp:coreProperties w:settings w:body (正文有一个简单的文本行。) 还需要包括什么?提前感谢。以平面OPC XML表示,它可以简单到: <?xml version="1.0" en

我有一个xml文件,需要用MicrosoftWord2007打开。我自己写的。但当我试图打开它时,它会告诉我“某些部件丢失或无效”。我认为这种情况会发生,因为我的文档没有定义所有必需的属性。因此,我需要知道使用Word 2007打开xml文档必须具备哪些条件。我定义了以下属性

cp:coreProperties
w:settings
w:body
(正文有一个简单的文本行。)
还需要包括什么?提前感谢。

以平面OPC XML表示,它可以简单到:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<?mso-application progid="Word.Document"?>
<pkg:package xmlns:pkg="http://schemas.microsoft.com/office/2006/xmlPackage">
  <pkg:part pkg:name="/_rels/.rels" pkg:contentType="application/vnd.openxmlformats-package.relationships+xml" pkg:padding="512">
    <pkg:xmlData>
      <Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
        <Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="word/document.xml"/>
      </Relationships>
    </pkg:xmlData>
  </pkg:part>
  <pkg:part pkg:name="/word/document.xml" pkg:contentType="application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml">
    <pkg:xmlData>
      <w:document mc:Ignorable="w14 wp14" xmlns:wpc="http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:wp14="http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml" xmlns:wpg="http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" xmlns:wpi="http://schemas.microsoft.com/office/word/2010/wordprocessingInk" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml" xmlns:wps="http://schemas.microsoft.com/office/word/2010/wordprocessingShape">
        <w:body>
          <w:p >
            <w:r>
              <w:t>Hello world</w:t>
            </w:r>
          </w:p>
        </w:body>
      </w:document>
    </pkg:xmlData>
  </pkg:part>
</pkg:package>

你好,世界

你是否包括了一段关系,但缺少了它的目标部分?或者在某个地方放一份重温品,但却完全错过了这段感情?

谢谢,这里有什么要点?更准确地说,我想要的是将从文档中获得的zip文件的内容添加到单个xml文档中,以便我可以从Word 2007再次打开它。(需要将_rels、customXml、docProps和word文件夹中的xml文件放在一个xml文件中,并用word 2007打开)。我知道生成的文档会很大,但我需要这样做。换句话说,另存为XML。这将为您提供平面OPC XML。然后你可以移除所有你不想要的东西。只要确保如果您删除了一个零件,您就删除了指向它的任何关系。如果它有自己的rels部分,则删除该部分和所有依赖部分。手动操作有点繁琐,但相当简单。非常感谢。我会检查一下,让你知道它是否有效。非常感谢您的支持。如果以您现在的方式创建文件太难了,那么更好的选择可能是使用Microsoft的OpenXML SDK。创建有效文档非常简单,只需查看SDK在线帮助中提供的示例。