Synopsis of XML files stored in the archives supported by OpenTBS

Version 2020-05-10

Extensions: odt, odg, ods, odf, odp, docx, xlsx and pptx

This file is incomplete, feel free to send your own comments to:

Table of Contents

LibreOffice & OpenOffice documents

That is extensions ODT, ODS, ODG, ODF, ODP, ODM.

All simple quotes "'" in texts are coded with "'" but they are automatically replaced by the OpenTBS plugin.

The main information is stored in the file 'content.xml'.

The pictures are stored in the directory 'Pictures' and should be registered into the file 'META-INF/manifest.xml'. (OpenTBS does it automatically for you when you use parameter "addpic").

Since OpenOffice 3.2, if a picture is not registered in the Manifest file, then it can produce a message error when opening the document.

Video and sound cannot be stored in OpenOffice documents.


Main file (content.xml)


<text:p text:style-name="Standard">
   Normal new lines are made with a new paragraphs <text:p>...</text:p>
   Simple new lines are made with <text:line-break/>
   Tabs are made with <text:tab/>
   Page-breaks are made with a new paragraph having a style which has the attribute fo:break-before="page" or fo:break-after="page".
   Note that the page-break does not work if the attribute is in the paragraph element. A "break-before" at the first page, or a "break-after" on the last page has no effect.
   Local styles (bold, color,...) are made with <text:span text:style-name="T1">...</text:span>
<text:h>...</text:h> A paragraph typed as Header
   <text:list>...</text:list> A list of items
   <table:table>...</table:table> A table



<text:p> ... </text:p>
<text:section text:style-name="Sect1" text:name="Section1">
<text:p> ... </text:p>
<text:p> ... </text:p>
<text:p> ... </text:p>

Slides in a presentation

<draw:page ....>


Tables in a document

  <table:table-column ... />
  <table:table-column ... />
  <table:table-column ... />
    <table:table-cell> ... </table:table-cell>
    <table:table-cell table:number-columns-spanned="2"> ... </table:table-cell>
    <table:covered-table-cell/> // virtual column that is covered by the span
    <table:table-cell> ... </table:table-cell>

Cells merged vertically

<table:table-cell table:number-rows-spanned="2" office:value-type="string">
    <text:span> CONTENT OF THE CELL </text:span>

Cell that are not displayed because of vertical merging or horizontal mergin, are replaced with <table:covered-table-cell/>. But such entities seems to be optionnal: LibreOffice display correclty the table if they are ommited.

Attributes table:number-rows-spanned="1" seems to be supported and has no effect.

Cells merged horizontally

<table:table-cell table:number-columns-spanned="2" office:value-type="string">
    <text:span> CONTENT OF THE CELL </text:span>




Comments in ODS workbooks (OpenOffice Calc)

<table:table-row table:style-name="ro2">

  <table:table-cell ...> ... </table:table-cell>

  <table:table-cell office:value-type="float" office:value="3.6">
    <office:annotation draw:style-name="gr1" draw:text-style-name="P1" svg:width="2.899cm" svg:height="0.991cm" svg:x="9.632cm" svg:y="2.786cm" draw:caption-point-x="-0.61cm" draw:caption-point-y="1.511cm">
      <text:p text:style-name="P1">Here is my comment.</text:p>

  <table:table-cell ...> ... </table:table-cell>


Comments in ODT documents (OpenOffice Write)

<text:p text:style-name="Standard">
   Here is the start of the text and now 
     <text:p text:style-name="P1">
       <text:span text:style-name="T1">Here is my comment.</text:span>
   comment is just inserted there.


Headers and footers in a document


Header and footer contents are saved in the "sytles.xml" file: You can choose for each page to hide or display the header and footer. Nevertheless, the contents is always the same for each page.

<office:document-styles ...>
    <style:master-page ...>
        <text:p text:style-name="Header">here is the header</text:p>
        <text:p text:style-name="Footer">here is the footer</text:p>


Header and footer contents are saved in "content.xml" file. They are defined as available styles and can be use for any slide and for the whole document in the "handout" view which is a set of several slide.


  <presentation:header-decl presentation:name="hdr1">Here is my header</presentation:header-decl>
  <presentation:footer-decl presentation:name="ftr1">Here is my footer for slide 1</presentation:footer-decl>
  <presentation:footer-decl presentation:name="ftr2">Here is my footer</presentation:footer-decl>

  <draw:page ... presentation:use-footer-name="ftr1">



The location of the chart is defined in the main subfile "contents.xml".

<text:p text:style-name="Standard">
  <draw:frame draw:name="My name" text:anchor-type="paragraph" svg:x="2.401cm" svg:y="1.379cm" svg:width="14.102cm" svg:height="7.622cm" draw:z-index="0">
    <draw:object xlink:href="./Object 1" xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad" />
    <draw:image xlink:href="./ObjectReplacements/Object 1" xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad" />
    <svg:title>My title</svg:title>
    <svg:desc>My description</svg:desc>

An image preview is saved in the file "ObjectReplacements/Object 1", and this image will be displayed automatically instead of the real Chart view until the chart is manually changed in the document.

In order to avoid this preview, the followings must be deteled :

Data and properties of the chart are saved into the corresponding subdirectory "Object 1".

Data are saved in "Object 1/contents.xml" in a local table that groups data of all series of the chart.

If the document is an ODS workbook then the local table is still in the chart, but it is used as a cache for data. And series has a reference to cells in the workbook instead of cells in the local table.

With ODS, if the cached data are modified then, it is useless since the software will update the cached data with the cells in the workbook.

With ODS, if references of a series are replaced with references of the local table, then the document will be opened with no error but the software will assume that all series are linked to the local table.

<table:table table:name="local-table">

    <table:table-column />
    <table:table-column table:number-columns-repeated="3" />

      <table:table-cell><text:p /></table:table-cell>
      <table:table-cell office:value-type="string"><text:p>column 1</text:p></table:table-cell>
      <table:table-cell office:value-type="string"><text:p>column 2</text:p></table:table-cell>
      <table:table-cell office:value-type="string"><text:p>column 3</text:p></table:table-cell>


      <table:table-cell office:value-type="string"><text:p>line 1</text:p></table:table-cell>
      <table:table-cell office:value-type="float" office:value="9.1"><text:p>9.1</text:p></table:table-cell>
      <table:table-cell office:value-type="float" office:value="3.2"><text:p>3.2</text:p></table:table-cell>
      <table:table-cell office:value-type="float" office:value="4.54"><text:p>4.54</text:p></table:table-cell>

      <table:table-cell office:value-type="string"><text:p>line 2</text:p></table:table-cell>
      <table:table-cell office:value-type="float" office:value="2.4"><text:p>2.4</text:p></table:table-cell>
      <table:table-cell office:value-type="float" office:value="8.8"><text:p>8.8</text:p></table:table-cell>
      <table:table-cell office:value-type="float" office:value="9.65"><text:p>9.65</text:p></table:table-cell>

      <table:table-cell office:value-type="string"><text:p>line 3</text:p></table:table-cell>
      <table:table-cell office:value-type="float" office:value="3.1"><text:p>3.1</text:p></table:table-cell>
      <table:table-cell office:value-type="float" office:value="1.5"><text:p>1.5</text:p></table:table-cell>
      <table:table-cell office:value-type="float" office:value="3.7"><text:p>3.7</text:p></table:table-cell>

      <table:table-cell office:value-type="string"><text:p>line 4</text:p></table:table-cell>
      <table:table-cell office:value-type="float" office:value="4.3"><text:p>4.3</text:p></table:table-cell>
      <table:table-cell office:value-type="float" office:value="9.02"><text:p>9.02</text:p></table:table-cell>
      <table:table-cell office:value-type="float" office:value="6.2"><text:p>6.2</text:p></table:table-cell>





<text:p text:style-name="Standard">
  <draw:frame draw:style-name="fr1" draw:name="Frame1" text:anchor-type="paragraph" svg:width="4.535cm" draw:z-index="0">
    <draw:text-box fo:min-height="2.461cm">
      <text:p text:style-name="Frame_20_contents">Message in a textbox</text:p>
  Usual text


Special to ODF (OpenOffice Math Formula)

Any comment in the formula must be entered between text delimiters which are the double quotes ("). Newlines are made with the keyword 'newline' outside the text delimiter.



Binary contents is saved as a file in "Pictures/".

Short synopsis of the control in the document:

<text:p ...>
  <draw:frame draw:style-name="fr1" draw:name="images1" text:anchor-type="paragraph" svg:width="0.847cm" svg:height="0.847cm" draw:z-index="0">
    <draw:image xlink:href="Pictures/100000000000002000000020A0D29467.jpg" xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad"/>



Here is an example with a conditional field.

  Here is a field:
<text:conditional-text text:condition="0=1" text:string-value-if-true="Test is true" text:string-value-if-false="Test is false" text:current-value="false">
Test is false

Microsoft Office documents

That is documents with extension DOCX, XLSX, PPTX.


Microsoft Word document (.DOCX)

The main file is usually "word/document.xml", but its actual location is defined in the file "[Content_Types].xml", in the element: <Override PartName="/word/document.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml"/>

Note: I've test to change the "word/document.xml" name in both the "[Content_Types].xml" file and the archive, but this makes Word 2010 to be unable to open the document, saying it is corrupted.


The main file "word/document.xml" (DOCX)


    <w:p> // New paragraph

      <w:pPr> // Parameters of the paragraph
        <w:rPr> ... </w:rPr> // Set of parameters for a Run
        <w:sectPr> // Start a new section. Sections are a set of page layout (margin, columns, ...) available until the next section.
          <w:type w:val="continuous"/> // May be present whe the section is defined manually.
        <w:pageBreakBefore/> // Page break before the paragraph (way #1)

     <w:r> // New run item. A run item is a set of content having common layout properties.
       <w:rPr> // Set of parameters for a Run. Examples: <w:i/> is italic, <w:b/> is bold. </w:rPr>
         <w:t>Your text is here</w:t>
          // Simple new lines are made with <w:br/>
          // Page breaks can also be made with <w:br w:type="page"/> (way #2)

     <w:tab/> // Tabs are placed between <w:r> elements.

       <w:t xml:space="preserve"> Next text </w:t>
     </w:r> // spaces between entities are dealt using attribute xml:space="preserve"



What are attributes "w:rsidR" and "w:rsidRPr" for?

Attribute "w:rsidR" is a Revision ID. Each new user on a doc has a new id, and each of its modification is marked with its RsID.

More info:


Tables (DOCX)


<w:tbl> // a table takes the same place as a paragraph
    <w:gridCol ... /> // principally define colmun widths
    <w:gridCol ... />
    <w:tc> ... </w:tc>
    <w:tc> ... </w:tc>

Cells merged vertically
    <w:vMerge w:val="restart"/>  // marks the cell to start a new cell-merging
    <w:vMerge w:val="continue"/> // marks the cell to continue the cell-mergin (the cell is merged with a previous one having "restart" or "continue")
    <w:vMerge/> // same as above
    // no <w:vMerge> entity means the cell is not merged. 
Cells mertged horizontally
    <w:gridSpan w:val="2"/> // It works like "colspan" in HTML.


Headers and footers (DOCX)

They are 3 types of headers and footers in Microsoft Word : Default, Even (for even numbered pages only) and First (for the first page only). Event and First types are optional.

Each section of the document may have its own set of header/footer of the 3 types, but by default a new section has his headers/footers linked with the previous sections.

Each headers and footers are saved in separated XML file. If no header/footer is defined for the document, then they are no header nor footer XML files. Even and First headers are optional, they may not be defined for a section, and so have no corresponding XML files.

Example of header and footer files: "word/header1.xml" and "word/footer1.xml".

The actual type and locations of Headers and Footers are defined in the main document "word/document.xml"with the section's properties.

  <w:headerReference w:type="default" r:id="rId13"/>
  <w:footerReference w:type="default" r:id="rId14"/>
  <w:headerReference w:type="first" r:id="rId15"/>
  <w:footerReference w:type="first" r:id="rId16"/>
  <w:headerReference w:type="even" r:id="rId17"/>
  <w:footerReference w:type="even" r:id="rId18"/>
Relation files

The information related to r:id are stored in the file "word/_rels/document.xml.rels"

<Relationships xmlns="">
  <Relationship Id="rId8" Type="" Target="media/image1.png"/>
  <Relationship Id="rId13" Type="" Target="header1.xml"/>

Locations are also appering in the file "[Content_Types].xml", in the elements like:

<Override PartName="/word/header1.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml"/>
   // and
<Override PartName="/word/footer1.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml"/>

Some referenced header/footers may have no actual files because of no data.

Example of header source:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

<w:hdr ...>
    <w:pPr><w:pStyle w:val="my_header"/></w:pPr>
      <w:t>here is the text of the header</w:t>


Comments, footnotes and endnotes (DOCX)

Like headers and footers, they are aslo saved in separated XML files.



  <w:r><w:t xml:space="preserve">Here is a </w:t></w:r>
  <w:bookmarkStart w:id="0" w:name="mybookmark"/>
  <w:bookmarkEnd w:id="0"/>



    <mc:AlternateContent> // indicate a liste of different possible choices

      <mc:Choice Requires="wps"> // first choice and its condition
          <wp:anchor ...>

      <mc:Fallback> // last choice if no condition is true
          <v:shapetype ...>
          <v:shape ...>
            <v:textbox ...>
                <w:p> <w:r> <w:t>Here s a text box.</w:t>  </w:r> </w:p>



Charts (DOCX)

The first chart is saved under "word/charts/chart1.xml", and so on for the next ones.

There is two way of storing the chart's data : directly in the chart (data is qualified as literal) or in an internal Excel spreadsheet (data is qualified as referenced).

By default, the software stores data in an internal Excel Spreadsheet embedded in the DOCX document
For example: "word/embeddings/Worksheet_Microsoft_Excel1.xlsx".). And the path of the Excel file is saved into "word/charts/_rels/chart1.xml.rels".
The chart file contains both the references to cells in the spreadsheet and the cached values.

If the cached values are modified, then the software will update them according to the internal Excel Spreadsheet when the document is opened.

If the internal Excel Spreadsheet and its link to the chart are deleted, then the software will open the docuement with no error, and will use the caced values as if it was literal values.

It possible to manually change the definition of a series to have it litral inseat of referenced.

Title of the chart, the axes and the series are saved in "chart1.xml". Other custom text boxes are saved in a shape file. For example : "word/drawings/drawing1.xml".

Example of a series saved in the XML (the tags are different for an XY series):


  <c:idx val="0"/>
  <c:order val="0"/>

      <c:strCache><c:ptCount val="1"/><c:pt idx="0"><c:v>Here is the name of the Series</c:v></c:pt></c:strCache>

    <a:solidFill><a:srgbClr val="9999FF"/></a:solidFill>
    <a:ln w="12700"><a:solidFill><a:srgbClr val="000000"/></a:solidFill><a:prstDash val="solid"/></a:ln>
  <c:invertIfNegative val="0"/>

        <c:ptCount val="4"/>
        <c:pt idx="0"><c:v>Category A</c:v></c:pt>
        <c:pt idx="1"><c:v>Category B</c:v></c:pt>
        <c:pt idx="2"><c:v>Category C</c:v></c:pt>
        <c:pt idx="3"><c:v>Category D</c:v></c:pt>

        <c:ptCount val="4"/>
        <c:pt idx="0"><c:v>20.399999999999999</c:v></c:pt>
        <c:pt idx="1"><c:v>27.4</c:v></c:pt>
        <c:pt idx="2"><c:v>90</c:v></c:pt>
        <c:pt idx="3"><c:v>20.399999999999999</c:v></c:pt>



Pictures (DOCX)

Binary contents is saved as a file in "word/media/".

Image link saved into "word/_rels/document.xml.rels": <Relationship Id="rId6" Type="" Target="media/image1.png"/>

They are two ways to insert a picture.

1) DrawingML (the new way that includes 2D/3D effects)

(short synopsis)

The <w:drawing> element is always included into an dedicated <w:r> element, itself always contained into a <w:p> element.

This is true even if the picture is positioned as a character or over the text. And it doesn’t matter on what is anchored the picture.

  <wp:inline ...>
    <wp:extent cx="1130400" cy="1512000" /> // this element gives the size of the shape box that contains the picture
name="Image 1"
 descr="My description" // Alternative Text for the picture
 title="My title" // Title coming with the Alternative Text, no more available with Ms Office 2019
 /> <wp:docPr id="1" name="Image 0" descr="2884414-my_picture.jpg"> <a:hlinkClick xmlns:a="" r:id="rId4" tooltip="My tooltip"/> // this optional element gives the URL and tooltip of the link if any. In Word 2007 you cannot customize the title and desciption </wp:docPr> <a:graphic ...> <a:graphicData ...> <pic:pic ...>

 <pic:nvPicPr> // optional element found in version in 2022, the description is duplicated from above <pic:cNvPr id="1" name="Image 1" descr="My description"/> <pic:cNvPicPr/> </pic:nvPicPr>

 <pic:blipFill> <a:blip r:embed="rId4" /> // this element contains the link to the picture internal file </pic:blipFill> <pic:spPr ...> <a:xfrm> <a:off x="0" y="0" /> <a:ext cx="1130400" cy="1512000" /> // this element gives the size of the picture inside its shape box, it can be rescaled to fit in the shape box </a:xfrm> <a:prstGeom prst="rect"><a:avLst /></a:prstGeom> <a:noFill /> <a:ln><a:noFill /></a:ln> </pic:spPr> </pic:pic> </a:graphicData> </a:graphic> </wp:inline> </w:drawing>

Special contents for an SVG picture:

    <a:blip r:embed="rId4"> // link to an PNG picture that is a cached picture of the actual SVG picture

 <a:extLst> <a:ext uri="{28A0092B-C50C-407E-A947-70E740481C1C}"> <a14:useLocalDpi xmlns:a14="" val="0"/> </a:ext> <a:ext uri="{96DAC541-7B7A-43D3-8B79-37D633B846F1}"> <asvg:svgBlip xmlns:asvg="" r:embed="rId5"/> // link to the actual SVG </a:ext> </a:extLst>

 </a:blip> <a:stretch> <a:fillRect/> </a:stretch> </pic:blipFill>

Tech note: if value rId4 is replaced with rId5 then document is valid for both Ms Office and LibreOffice.

2) VML (old way)

(short synopsis)

  <v:shapetype ...>
  <v:shape style="width:89.25pt;height:119.25pt" ...> // this element contains the size of the picture
    <v:imagedata r:id="rId6" o:title=""/> // this element contains the link to the picture internal file


Fields (DOCX)

Simple fields

<w:fldSimple w:instr="AUTHOR">
<w:t>Marcel Proust</w:t>

Complex fields


<w:t>Some texte here </w:t>

<w:fldChar w:fldCharType="begin"/> // marks the start of a complex field

<w:instrText xml:space="preserve"> IF 0 = 1 "Test is true." "Test is false." \* MERGEFORMAT </w:instrText> // Example of a IF field.

<w:fldChar w:fldCharType="separate"/> // specifies that the character is a separator character which defines the end of the field codes or function and the start of the field result.

<w:t>Test is false.</w:t>

<w:fldChar w:fldCharType="end"/> // marks the end of a complex field
<w:t>Some other texte here </w:t>


Microsoft Excel spreadsheet (XLSX)


An Excel workbook can have one or several worksheets. The contents of cells are saved in worksheets. Worksheets files are named "xl/worksheets/sheet1.xml", and also sheet2.xml, sheet3.xml...

The file names are not the names defined in Excel by the user, they are internal names. But it seems that there is always at least a worksheet named "sheet1.xml".

All string values of cells are stored in the file "xl/sharedStrings.xml". The cells contains in fact the index of the string in the sharedStrings.xml file. This separation will probably make difficulties to merge an Excel sheet.

All sheets of the workbook are listed in the file "xl/workbook.xml".

Synopsis of a sheet file like "xl/worksheets/sheet1.xml" (XLSX)


     <row r="2" spans="2:2" ht="90">
       // A range of one row in wich several cells are defined
       <c r="B2" s="1" t="s">
         /* Definition of a cell:
          * Attribute r is the address if the cell in the sheet (format A1). This attribute is optional.
          * Attribute s is the style of the cell (the format). Styles are saved into the file 'xl/styles.xml' but I have not found the link yet.
          * Attribute t is the type of data, by default it is numerical
          * t="s" means that the displayed value is a string, the saved value is the index if the string taken in file "sharedStrings.xml".
          * b: boolean, d: date, e: error, n: number, s: shared string, inlineStr: inlinde string, str: string as the result of a formula
         <f>B13+B14</f> // The formula if any. If there is no formula, this tag is absent. The type of <c> is the type of the result.
         <v>0</v> // The inner value without formatting.
                  // If t="s"   then the value is in fact the index of the string in the "xl/sharedStrings.xml" file.
                  // If t="str" then the value is the string result of the formula.
       <c r="C2" s="1" t="inlineStr">
         /* The type "inlineStr" is a special value that allows the string to be stored in the cell instead of in the file "sharedStrings.xml".
          * It is used by OpenTBS to transert string with TBS fields from "sharedStrings.xml" into the XML of the sheet.
          <is><t>This is a string</t></is>


Synopsis of the Shared String file "xl/sharedStrings.xml": (XLSX)

    <t>value or text</t>
    <t>value or text</t>


Headers and footers (XLSX)

Like as DCX, they can be up to 6 headers/footers for each sheet.
Header and footers are saved in the sheet file.

<headerFooter differentOddEven="1" differentFirst="1">
  <oddHeader>My header for odd page in this sheet</oddHeader>
  <evenHeader>My header for even page in this sheet</evenHeader>
  <firstHeader>My header for first page in this sheet</firstHeader>


Charts (XLSX)

Same as Charts for DOCX, but there is no embedded spreadsheet, data are referenced to cells in any worksheet of the current workbook.

As for DOCX, data which is referenced to cells can be manually modified into literal data in a chart.


Pictures (XLSX)

Binary contents is saved as a file in "xl/media/".

The presence of pictures in the sheet is mentioned with a single <drawing> entity at the bottom of the <worksheet> entity. The <drawing> entity carries a reference id, which is defined the Rels file of the sheet. All properties of all the pictures in a sheet are finally saved in a third XML file.

File "xl\worksheets\sheet1.xml"
<worksheet ...>
   <drawing r:id="rId2"/> // (only one entity for all pictures in the sheet)
File "xl\worksheets\_rels\sheet1.xml.rels"
<Relationship Id="rId2" Type="" Target="../drawings/drawing1.xml"/>
// (only one entity for all pictures in the sheet)
File "xl\drawings\drawing1.xml"

(short synopsis, one entity per picture in the sheet)

<xdr:twoCellAnchor ...>
      <xdr:cNvPr id="2" name="Image 1" descr="xxx my description" title="xxx my title"/>
      <a:blip xmlns:r="" r:embed="rId1">


Microsoft PowerPoint presentation (PPTX)


Think to set all texts to "Tools » Language » No check" when you edit the PowerPoint presentation, otherwise some TBS fields can be split by XML tags about the language and spell checking.

Slides are listed in the file "ppt/_rels/presentation.xml.rels", where an internal id is affected to them.

The first slide is quite always corresponding to the file "ppt/slides/slide1.xml".

Synopsis of a slide file like "ppt/slides/slide1.xml": (PPTX)

            <a:pPr eaLnBrk="1" hangingPunct="1"/>
              <a:t>Some text here</a:t>


Headers and footers (PPTX)

They can be headers and footers for each slide, and aslo an header and footer for the "handout" view, wich is a set of several slides.

Header and footer of each slide is saved in the sub-file of the slide ("ppt/slides/slide1.xml" for example).

Header and footer of the handout is saved ins ubs-file "ppt/handoutMasters/handoutMaster1.xml".


Charts (PPTX)

Same as Charts for DOCX.


Pictures (PPTX)

Binary contents is saved as a file in "ppt/media/".

(short synopsis)

    <p:cNvPr id="4" name="Image 3" descr="My description" title="My title">  // this optional element gives the description and title of the image
      <a:hlinkClick r:id="rId2" action="ppaction://hlinkfile" tooltip="My toolip"/>
    <a:blip r:embed="rId2">
      <a:off x="2667000" y="4365104" />
      <a:ext cx="3810000" cy="1200150" />