Microsoft Word (OOXML/DOCX) documents formatting validation

不羁的心 提交于 2021-02-08 06:22:07

问题


Is anyone familiar with OOXML schemas? I need to build a schema to validate the style of a specific documents based on certain rules and I can't find a certain reference or even example to start with.


回答1:


The reference for OOXML is Standard ECMA-376 Office Open XML File Formats. Be forewarned that the specification is complex; expect to have to do a lot of reading/learning about both the OOXML specification and XML technologies and techniques prior to making any progress.

See also:

  • Where can I find the XSDs of DOCX XML files?
  • XML/XSD validation for a Word doc
  • Eric White's Open XML blog



回答2:


Word documents are usually just a flat sequence of paragraphs and tables (table cells contain paragraphs), though you can use/nest content controls to group paragraphs, and there are other more exotic objects such as altChunks.

Other things you might be interested in:

  • sectPr (controlling headers/footers, page size/orientation etc), since this is indicative of a new part/chapter

  • outline level?

The paragraph style is just a setting on a paragraph. Given this structure, schematron might not be quite so useful as it is against say docbook or TEI.

But transforming your main document part (word/document.xml) to something simpler via XSLT is potentially a good approach.

It all depends what your constraints look like.



来源:https://stackoverflow.com/questions/53581421/microsoft-word-ooxml-docx-documents-formatting-validation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!