addExternalFile

addExternalFile

BASIC / ADVANCED / PREMIUM

Inserts an external document (DOCX, HTML, RTF or MHT) into the current Word document.

Description
public void addExternalFile(OptionsExternalFile options) throws Exception

This method allows the insertion of an external DOCX, HTML, RTF or MHT document within the current Word document.

When inserting a DOCX document, it is recommended that the page layout of the inserted DOCX coincides with the one of the Word document you are generating with Javadocx, if not you may expect certain formatting problems.

This method is only compatible with MS Word.

Parameters

options

An array with the available options.

The possible keys and values are (required options are shown with red background):

Option Type Description
src String The path to the document that you want to insert within our current Word document.
matchSource Boolean If true (default value), it tries to preserve as much as possible the styles of the DOCX to be included.
Code samples

Example #1

The resulting Word document looks like: