DOCX2TXT

DOCX2TXT

TRIAL / ADVANCED / PREMIUM

Extracts the text contents from a Word document.

Description
public DOCX2TXT (string $source, string $target[, array $options]])

This method allows to extract the text from a DOCX document with a few styling options:

  • Indent lists
  • Tables as tabbed text
  • Footnotes and endnotes

Parameters

source

The path to the DOCX from which you want to extract the text.

target

The path to the txt destination file.

options

The possible keys and values are:

Key Type Description
table bool True (default) if you want to parse tables as tabbed paragraps.
list bool True (default) if you want to parse lists as txt lists.
paragraph bool True (default) if you want to preserve the paragraph structure.
footnote bool True (default) if you want to include the footnotes.
endnote bool True (default) if you want to include the endnotes.
chart int Possible values are:
  • '0': charts are ignored.
  • '1': charts are parsed as txt lists.
  • '2': charts are parsed as tables (tabbed paragraphs).
Code samples

Example #1

The resulting Word document looks like:

Release notes
  • phpdocx 15.0:
    • in-memory DOCX documents.