Conversion plugin phpdocx

Other conversion methods

Other conversion methods

Besides the conversion plugin, phpdocx has many other methods to transform documents between formats.

This method allows to convert a DOCX to TXT:

You can transform the whole content or exclude parts like tables, footnotes or endnotes.

This method exports the body of the document only, without headers or footers. The available parameters are:

  • $from: Sets the original file
  • $to: Sets the destination file
  • $options: It's an array of options to export all content or just some specifics parts of it

For example, to export the file test.docx with paragraphs, lists, tables, footnotes and endnotes, and omit the graphic charts, type this code:

The second available method is txt2docx. This is the opposite of docx2txt. It creates a DOCX file from a TXT. It's very easy to use: just call the method stating the txt to transform:

Then generate the new document:

Next - Common problems and possible errors