Office Open XML文件规范学习

Office Open XML文件规范学习

=Start=

缘由:

近期在做一些文档追踪方案的学习和测试,除了纯文本的txt/csv文本格式之外,用的最多的就是Office文档了,在新的Office套件里面早就默认使用了 docx/xlsx/pptx 后缀,而非之前的 doc/xls/ppt 后缀,新后缀对应的文件用的就是Office Open XML文件格式。为了更好的理解文档追踪方案的优势和局限,所以学习了解一下相关文件格式规范。并这里简单记录一下在学习了解Office Open XML文件格式过程中的内容,方便后面有需要的时候再参考和回顾。

正文:

参考解答:

Office Open XML 是什么?

Office Open XML(缩写:Open XML、OpenXML或OOXML),为由Microsoft开发的一种以XML为基础并以ZIP格式压缩的电子文件规范,支持文件、表格、幻灯片等文件格式。

OOXML在2006年12月成为了ECMA规范的一部分,编号为ECMA-376;并于2008年4月通过国际标准化组织的表决,在两个月后公布为ISO/IEC 29500国际标准。微软推出这个格式,很多人认为是出于商业考量。许多专家指出,该标准并不是个完整的标准,采用了许多微软的独有规格,使用上困难重重。

从Microsoft Office 2007开始,Office Open XML文件格式已经成为Microsoft Office默认的文件格式。Microsoft Office 2010支持对ECMA-376标准文档的读操作,ISO/IEC 29500 Transitional的读/写,ISO/IEC 29500 Strict的读取。Microsoft Office 2013同时支持ISO/IEC 29500 Strict的读写操作。

Starting with the 2007 Microsoft Office system, Microsoft Office uses the XML-based file formats, such as .docx, .xlsx, and .pptx. These formats and file name extensions apply to Microsoft Word, Microsoft Excel, and Microsoft PowerPoint.

docx/xlsx/pptx 文件的结构

[Content_Types].xml #这个文件包含所有内容类型的列表。每个部件及其类型必须列在[Content_Types].xml中

_rels #用于配置定义各part间的关系,在part内部也会有各_rels子目录及关系文件

.rels

docProps #存放属性相关内容

app.xml #扩展属性

core.xml #核心属性

custom.xml #自定义属性(默认可能没有这个文件,需要添加自定义属性之后才会有该文件)

word #docx特有目录

_rels

document.xml.rels

document.xml

theme/

...

xl #xlsx特有目录

_rels

workbook.xml.rels

workbook.xml

worksheets/

theme/

...

ppt #pptx特有目录

_rels

presentation.xml.rels

presentation.xml

slides/

theme/

...

docx文件内部结构

xlsx文件内部结构

pptx文件内部结构

以 docx 文件为例介绍内部文件的功能和作用

Content Types

根目录下的 [Content_Types].xml 文件

Every package must have a [Content_Types].xml, found at the root of the package. This file contains a list of all of the content types of the parts in the package. Every part and its type must be listed in [Content_Types].xml.

It’s important to keep this in mind when adding new parts to the package.

Relationships

根目录下的 _rels 目录(及各part内部目录中的 _rels 子目录)

Every package contains a relationships part that defines the relationships between the other parts and to resources outside of the package. This separates the relationships from content and makes it easy to change relationships without changing the sources that reference targets.

In addition to the relationships part for the package, each part that is the source of one or more relationships will have its own relationships part. Each such relationship part is found within a _rels sub-folder of the part and is named by appending ‘.rels’ to the name of the part. Typically the main content part (document.xml) has its own relationships part(document.xml.rels). It will contain relationships to the other parts of the content, such as styles.xml, themes,xml, and footer.xml, as well as the URIs for external links.

Parts Shared by Other OOXML Documents

根目录下的 docProps 目录(还有一些其他parts)

PartDescriptionEmbedded packageContains a complete package, either internal or external to the referencing package. For example, a WordprocessingML document might contain a spreadsheet or presentation document.根目录下的docProps/目录文档的扩展/核心/自定义属性。Font字体Image图片。Documents often contain images. An image can be stored in a package as a zip item. The item must be identified by an image part relationship and the appropriate content type.

Parts Specific to WordprocessingML Documents

根目录下的 word 目录(xlsx是 xl 目录,pptx是 ppt 目录)

参考链接:

Office Open XMLhttps://zh.wikipedia.org/wiki/Office_Open_XML

什么是OOXML?http://officeopenxml.com/

Open XML Formats and file name extensionshttps://support.microsoft.com/en-us/office/open-xml-formats-and-file-name-extensions-5200d93c-3449-4380-8e11-31ef14555b18

Anatomy of a WordProcessingML Filehttp://officeopenxml.com/anatomyofOOXML.php

http://officeopenxml.com/anatomyofOOXML-xlsx.php

http://officeopenxml.com/anatomyofOOXML-pptx.php

ECMA-376 -> Office Open XML file formats (5th edition, December 2021)https://www.ecma-international.org/publications-and-standards/standards/ecma-376/

微软在Office Open XML夹了多少私货?https://www.zhihu.com/question/39196478

Office-OpenXML格式笔记http://39.108.88.209/?id=12

=END=

相关推荐

为什么苹果的芯片这么强
百特365平台可靠吗

为什么苹果的芯片这么强

📅 07-19 👀 4495
ps文字渐变,ps文字渐变效果怎么做 – ps合集包
百特365平台可靠吗

ps文字渐变,ps文字渐变效果怎么做 – ps合集包

📅 07-31 👀 5409
《穿越火线》空白符号复制大全2025最新
百特365平台可靠吗

《穿越火线》空白符号复制大全2025最新

📅 06-30 👀 3270
老飞飞资料
www365bet娱乐场

老飞飞资料

📅 08-07 👀 1744