ooxml altChunk不可见

时间:2018-10-24 21:35:31

标签: openxml libreoffice-writer

我正在尝试使用.docx标签以编程方式创建OOXML altChunk文件,以从文件according to this article插入纯文本。我设法创建了一个docx文件(这只是一个内部结构固定的zip文件),但是当我在LibreOffice中打开该文件时,.txt文件的内容不包括在内。

r0b025d0e-c9a2-4fc7-80cd-42358fe280b5.txt文件的内容只是一些纯文本。我的长期目标是嵌入一些html文件的内容,但首先,我想使其仅与某些纯文本一起使用。

我的[Content_Types].xml文件的内容:

<?xml version="1.0" encoding="UTF-8"?>
<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"> 
  <Override PartName="/r0b025d0e-c9a2-4fc7-80cd-42358fe280b5.txt" ContentType="text/plain"/>
  <Override PartName="/_rels/.rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/>
  <Override PartName="/docProps/app.xml" ContentType="application/vnd.openxmlformats-officedocument.extended-properties+xml"/>
  <Override PartName="/docProps/core.xml" ContentType="application/vnd.openxmlformats-package.core-properties+xml"/>
  <Override PartName="/word/_rels/document.xml.rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/>
  <Override PartName="/word/settings.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml"/>
  <Override PartName="/word/fontTable.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.fontTable+xml"/>
  <Override PartName="/word/document.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml"/>
  <Override PartName="/word/styles.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml"/>
</Types>

document.xml文件:

<?xml version="1.0" encoding="UTF-8"?>
<a:document xmlns:xml9930="http://schemas.microsoft.com/office/word/2010/wordml" xmlns:xml9931="http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing" xmlns:a="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:b="http://schemas.openxmlformats.org/markup-compatibility/2006" b:Ignorable="xml9930 xml9931">
  <a:body>
   <a:altChunk xmlns:c="http://schemas.openxmlformats.org/package/2006/relationships" c:id="r0b025d0e-c9a2-4fc7-80cd-42358fe280b5"/>
   <a:sectPr><a:type a:val="nextPage"/>
   <a:pgSz a:w="11906" a:h="16838"/>
   <a:pgMar a:left="1134" a:right="1134" a:header="0" a:top="1134" a:footer="0" a:bottom="1134" a:gutter="0"/>
   <a:pgNumType a:fmt="decimal"/>
   <a:formProt a:val="false"/>
   <a:textDirection a:val="lrTb"/>
  </a:sectPr>
 </a:body>
</a:document>

_rels/.rels文件:

<?xml version="1.0" encoding="UTF-8"?>
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
  <Relationship Id="r0b025d0e-c9a2-4fc7-80cd-42358fe280b5" Target="r0b025d0e-c9a2-4fc7-80cd-42358fe280b5.txt" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/aFChunk" TargetMode="Internal"/>
  <Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officedocument/2006/relationships/metadata/core-properties" Target="docProps/core.xml"/>
  <Relationship Id="rId2" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties" Target="docProps/app.xml"/>
  <Relationship Id="rId3" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="word/document.xml"/>
</Relationships>

docx文件成功加载,当我在p标记之前或之后放置文本(在altChunk标记中)时,它们会正确显示。但是,不会导入txt文件的内容代替altChunk标签。

因此,我认为语法和整体语义是正确的,但是仍然缺少某些内容。我的问题:LibreOffice是否支持altChunk?这是什么错误?如何使txt文件的内容也出现在docx文件中?非常感谢。

0 个答案:

没有答案