OOXML Specification - WordprocessingML

website·Indexed 31 days ago

https://appraisys-docs.github.io

Technical documentation for the Office Open XML (OOXML) specification, focusing on WordprocessingML. It provides detailed references for XML elements and attributes related to document structure, text formatting, tables, fonts, and headers/footers, including mappings to ODF and HTML/CSS properties.

Tokens
140K
Snippets
648
Records
872
Agent score
74%

What's inside OOXML Specification

  1. Overview of AppraiSys Document Generation System

    The AppraiSys system utilizes Office Open XML (OOXML) for DOCX document generation and the Syncfusion Document Format (SFDT), a JSON-based representation, for document manipulation. Developers and QA must understand the mapping between OOXML structures and SFDT to avoid document corruption and optimize performance.
  2. Overview of DrawingML in OOXML

    DrawingML is the XML language used to define graphical objects—including pictures, shapes, charts, and diagrams—and package-wide appearance characteristics (themes) within OOXML documents. It is not a standalone language but is embedded within wordprocessingML, spreadsheetML, and presentationML. While VML (Vector Markup Language) is still used for legacy components like certain text boxes in Microsoft Word, DrawingML is the modern standard intended to replace it. It is distinct from SVG, which is primarily used for web and desktop publishing.
  3. Understand XML Namespaces in OOXML

    XML namespaces prevent naming conflicts when combining XML from different specifications by acting as 'last names' for elements. In Office Open XML (OOXML), namespaces are essential because the format combines multiple specifications such as WordprocessingML, DrawingML, and Relationships.
  4. Understand Pivot Table component relationships in SpreadsheetML

    A Pivot Table in SpreadsheetML is composed of three primary interconnected parts. The worksheet containing the pivot table references the pivotTable part. The pivotTable part references the pivotCacheDefinition part, which in turn references the pivotCacheRecords part. Additionally, the pivotCacheDefinition specifies the original source data (e.g., a worksheet range).
    <!-- Worksheet -> pivotTable -->
    <Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotTable" Target="../pivotTables/pivotTable1.xml"/>
    
    <!-- pivotTable -> pivotCacheDefinition -->
    <Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotCacheDefinition" Target="../pivotCache/pivotCacheDefinition1.xml"/>
    
    <!-- pivotCacheDefinition -> pivotCacheRecords -->
    <Relationship Id="rId1" Type="http://schemas.openxmlformats.org/spreadsheetml/2006/relationships/pivotCacheRecord" Target="pivotCacheRecords1.xml"/>
  5. Understand the SpreadsheetML cell styling architecture

    Cell formatting is stored separately from the worksheet content in a styles part. It uses a system of collections and indices to minimize repetition:

    1. Base Collections: <numFmts>, <fonts>, <fills>, and <borders> define all possible individual characteristics.
    2. Cell XFs (<cellXfs>): A collection of formatting groups. Each <xf> element contains indices (e.g., fontId, fillId) pointing to the base collections. This represents direct formatting.
    3. Cell Styles (<cellStyleXfs>): Named styles. An <xf> in the <cellXfs> collection can reference a style via the xfId attribute, which is an index into the <cellStyleXfs> collection.
    4. Worksheet Reference: A cell in the worksheet references its formatting via the s attribute (e.g., <c r="A10" s="12">), which is a zero-based index into the <cellXfs> collection.
    <!-- Styles Part Structure -->
    <stylesheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">
      <numFmts/>
      <fonts/>
      <fills/>
      <borders/>
      <cellStyleXfs/>
      <cellXfs/>
      <cellStyles/>
      <dxfs/>
      <tableStyles/>
    </stylesheet>
  6. Compare OOXML and SFDT format characteristics

    OOXML (Office Open XML) and SFDT (Syncfusion Document Format) differ fundamentally in their structure and storage:

    OOXML:

    • Format: ZIP archive containing XML files.
    • Structure: Hierarchical XML elements using multiple namespaces (e.g., w:, r:, a:).
    • Relationships: Managed in separate .rels files.
    • Images: Stored as binary files in /word/media/.

    SFDT:

    • Format: Single JSON object.
    • Structure: Nested JSON objects and arrays with no namespaces.
    • Relationships: Embedded directly within the JSON.
    • Images: Base64 encoded strings or inline URLs.
  7. Implement Connector shapes in OOXML DrawingML

    Connectors are specialized shapes used to link two other shapes (<xdr:sp> or <p:sp>). Unlike standard shapes, connectors do not have a fixed position; their path is determined by the shapes they connect and the generating application. Connectors cannot contain text, so they omit the <txBody> element.

    Depending on the document type, different elements and namespaces are used:

    • Spreadsheets: Use <xdr:cxnSp> within the namespace xmlns:xdr="http://schemas.openxmlformats.org/drawingml/2006/speadsheetDrawing". Shapes are placed in a separate drawing part.
    • Presentations: Use <p:cxnSp> within the namespace xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main". Shapes are placed inline within a <p:spTree> or <p:grpSp> element.
  8. Understand the WordprocessingML (OOXML) document hierarchy

    Every Word document follows a strict structural hierarchy. Text cannot exist independently; it must be wrapped in a text element, which is inside a run, which is inside a paragraph, which is inside the body, which is inside the root document element.

    Hierarchy: w:document → w:body → w:p (Paragraph) → w:r (Run) → w:t (Text)

    <w:document>
      <w:body>
        <w:p>
          <w:r>
            <w:t>Hello</w:t>
          </w:r>
        </w:p>
      </w:body>
    </w:document>
  9. Define a picture using the DrawingML <pic> element

    In OOXML, a picture is defined using the <pic> element. A complete picture definition requires two parts: information about the image itself and information regarding its placement/positioning within the document. The namespace for the <pic> element varies by document type:

    • Word Processing: xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture"
    • Spreadsheets: xmlns:xdr="http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing"
    • Presentations: xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main"

    Most visual properties (like fills and effects) use the main DrawingML namespace: xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main".

    <pic:pic xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture">
      <pic:nvPicPr>
        <pic:cNvPr id="0" name="Blue hills.jpg"/>
        <pic:cNvPicPr/>
      </pic:nvPicPr>
      <pic:blipFill>
        <a:blip r:embed="rId4" cstate="print"/>
        <a:stretch>
          <a:fillRect/>
        </a:stretch>
      </pic:blipFill>
      <pic:spPr>
        <a:xfrm>
          <a:off x="0" y="0"/>
          <a:ext cx="2438400" cy="1828800"/>
        </a:xfrm>
        <a:prstGeom rst="rect">
          <a:avLst/>
        </a:prstGeom>
      </pic:spPr>
    </pic:pic>
  10. Understand the anatomy of a WordprocessingML (.docx) file

    A WordprocessingML (.docx) file is a zip package following the Open Packaging Conventions. It contains various 'parts'—primarily UTF-8 or UTF-16 encoded XML files, but it can also include media files like images and video. To inspect the internal structure of a .docx file, rename the extension to .zip and unzip the archive.
  11. Understand OOXML element hierarchy categories

    OOXML elements are categorized into three levels of hierarchy. Placing an element in the wrong category's container will cause document corruption.

    1. Block-Level Elements: Can appear directly in w:body, table cells (w:tc), SDT content, or headers/footers. Examples include w:p (Paragraph), w:tbl (Table), and block-variant w:sdt (Content Control).
    2. Inline Elements: Must appear inside paragraphs or inline containers. Examples include w:r (Run), w:hyperlink, and inline-variant w:sdt.
    3. Content Elements: Must appear inside runs (w:r). Examples include w:t (Text), w:br (Line break), w:tab, w:drawing (Image), and w:sym (Symbol).
  12. Understand SpreadsheetML package structure

    A SpreadsheetML document is a package of XML files. The core content is primarily stored in worksheet parts (one per sheet) and a sharedStrings part. In Microsoft Excel files, these are located within the xl folder, with worksheets in a worksheet sub-folder. The workbook part does not contain data but stores spreadsheet properties and references to the individual worksheet parts.
    <workbook . . .>
      <workbookPr . . ./>
      <sheets>
        <sheet name="sheet1" r:id="rId1">
        <sheet name="sheet2" r:id="rId2">
        <sheet name="sheet3" r:id="rId3">
      </sheets>
    </workbook>