Document
MMO\core\documents\docx · 1 symbol · generated 30 Nov 2026
Document
Document.php:15Word document reader (.docx): what its text says, as Markdown (toMarkdown) -- headings (the Title and Heading 1..6 styles, or a paragraph's outline level), bold, italic and struck-through text, bulleted and numbered lists at their level, tables, links, images (named, not extracted) and footnotes. Reads the archive itself (Zip: no ext-zip needed); headers, footers, comments and tracked deletions are left out.
- Namespace
MMO\core\documents\docx
Index
| NS_A | ||
| NS_PKG_REL | ||
| NS_R | ||
| NS_W | ||
| NS_WP | ||
| counters | ||
| files | ||
| footnotes | ||
| main | The main part's name, found through _rels/.rels. | |
| notes | ||
| numbering | ||
| rels | ||
| styles | ||
| blocks($parent) | ||
| child($parent, $name) | The first w: child named $name. | |
| Elements($xpath, $query, $context) static | ||
| EscapeLineStart($text) static | A paragraph's text that would start a heading, a list or a quote, escaped. | |
| File($filename) static | Read a .docx file from disk. | |
| getFiles() | ||
| image($drawing) | An image as . | |
| inline($parent) | The text of a paragraph (or of a link...) with its emphasis, links, images and note references. | |
| IsListItem($block) static | ||
| load($filename) | Read a .docx file from disk. | |
| loadData($data) | Read a .docx file's raw bytes. | |
| loadFiles($files) | Read a .docx from its parts, already out of their archive (an unzipped folder, a test). | |
| note($id) | A footnote's reference, its text kept for the end of the document. | |
| notesMarkdown() | ||
| on($rPr, $name) | ||
| paragraph($p) | A paragraph as Markdown: a heading, a list item, or a line of text ('' when it has no text). | |
| readNumbering($part) | Each list's format by level (numbering.xml): numId => ilvl => numFmt. | |
| readRels($part) | ||
| readStyles($part) | The styles' headings, emphasis and lists (styles.xml). | |
| run($r) | A run: its text (escaped), its emphasis, and the markup it holds (an image, a note reference). | |
| style($id) | ||
| table($tbl) | A table as Markdown: its first row the header, a cell's paragraphs on one line (<br> between), a cell spread over several columns repeated in each, one merged down left empty below its first. | |
| toMarkdown($title) | The document as Markdown (GitHub's flavour). | |
| val($el) | An element's w:val. | |
| Wrap($text, $bold, $italic, $strike) static | Text wrapped in its emphasis, the spaces around it left outside ( a is no bold for Markdown). | |
| xpath($name) |
Constants5
NS_A
NS_PKG_REL
NS_R
NS_W
NS_WP
Properties8
counters
- Type
- array
files
- Type
- array
footnotes
- Type
- array
main
The main part's name, found through _rels/.rels.
- Type
- string
notes
- Type
- array
numbering
- Type
- array
rels
- Type
- array
styles
- Type
- array
Methods26
blocks($parent)
Document.php:133| $parent | DOMElement | |
| returns | array | the Markdown of each paragraph and table of $parent (the body, a cell, a content control). |
child($parent, $name)
Document.php:445The first w: child named $name.
| $parent | null | DOMElement | |
| $name | string | |
| returns | null | DOMElement |
Elements($xpath, $query, $context)
staticDocument.php:472EscapeLineStart($text)
staticDocument.php:487A paragraph's text that would start a heading, a list or a quote, escaped.
File($filename)
staticDocument.php:43Read a .docx file from disk.
getFiles()
Document.php:99| returns | array | the names of the archive's parts. |
image($drawing)
Document.php:308An image as .
| $drawing | DOMElement | |
| returns | string |
inline($parent)
Document.php:203The text of a paragraph (or of a link...) with its emphasis, links, images and note references.
| $parent | DOMElement | |
| returns | string |
IsListItem($block)
staticDocument.php:492load($filename)
Document.php:50Read a .docx file from disk.
loadData($data)
Document.php:59Read a .docx file's raw bytes.
loadFiles($files)
Document.php:74Read a .docx from its parts, already out of their archive (an unzipped folder, a test).
note($id)
Document.php:299A footnote's reference, its text kept for the end of the document.
notesMarkdown()
Document.php:465| returns | string | the footnotes referenced, [^id]: text each, '' when none was. |
on($rPr, $name)
Document.php:459| $rPr | null | DOMElement | |
| $name | string | |
| returns | null | bool | a toggle of a run's properties (<w:b/>, <w:b w:val="0"/>), null when it isn't set. |
paragraph($p)
Document.php:161A paragraph as Markdown: a heading, a list item, or a line of text ('' when it has no text).
| $p | DOMElement | |
| returns | string |
readNumbering($part)
Document.php:410Each list's format by level (numbering.xml): numId => ilvl => numFmt.
readRels($part)
Document.php:370readStyles($part)
Document.php:384The styles' headings, emphasis and lists (styles.xml).
run($r)
Document.php:256A run: its text (escaped), its emphasis, and the markup it holds (an image, a note reference).
| $r | DOMElement | |
| returns | array | array{bool, bool, bool}, string} |
style($id)
Document.php:427table($tbl)
Document.php:325A table as Markdown: its first row the header, a cell's paragraphs on one line (<br> between), a cell spread over several columns repeated in each, one merged down left empty below its first.
| $tbl | DOMElement | |
| returns | string |
toMarkdown($title)
Document.php:111The document as Markdown (GitHub's flavour).
val($el)
Document.php:454An element's w:val.
| $el | null | DOMElement | |
| returns | null | string |
Wrap($text, $bold, $italic, $strike)
staticDocument.php:478Text wrapped in its emphasis, the spaces around it left outside ( a is no bold for Markdown).