BCL easyConverter SDK
easyConverter SDK Usermanual
PDF-to-Word Programming API  |  Download Free Trial  |  Contact Us to Purchase

OutputDocumentFormat Property

Determines the output document file format: RTF, DOC, or DOCX.

Sub OutputDocumentFormat(newVal As Long)


Parameters

newVal

One of optOutputDocumentFormat values:

OPT_OUTPUT_RTF = 1 - Native RTF output (Default),
OPT_OUTPUT_DOC_VIA_OFFICE = 2 - DOC output through RTF via Microsoft Office,
OPT_OUTPUT_DOCX_VIA_OFFICE = 3 - DOC output through RTF via Microsoft Office,
OPT_OUTPUT_DOC = 10 - Native DOC output. No Microsoft Office involved,
OPT_OUTPUT_DOCX = 11 - Native DOCX output. No Microsoft Office involved.

Remarks

By default, easyConverter tries to use the output file extension to automatically deduce the output document format.

Let's suppose that the OutputDocumentFormat property is not set. If the output file's extension is .rtf, an RTF file is automatically produced. If the extension is .doc, a DOC file is generated. If the extension is .docx, a DOCX file is generated. It is not possible to override this behavior, because the file extension overrules the OutputDocumentFormat setting.

If the output file extension is not .rtf, .doc or .docx, then setting the OutputDocumentFormat property is essential. For example, if your extension is .tmp, .temp, .bin, .dat, OutputDocumentFormat defaults to an RTF document type. If you want a DOC output, you must explicitly set OutputDocumentFormat to OPT_OUTPUT_DOC.

Please do not use an obviously incorrect file extension, such as .txt or .docx for an RTF or DOC file. If a DOCX file has an extension of .rtf or .doc, Word can't open it.

The functions ConvertToWord2 and ConvertToWord3 do not provide an output file name, therefore the OutputDocumentFormat setting should be explicitly set, otherwise the default output format will be RTF.

The OPT_OUTPUT_RTF, OPT_OUTPUT_DOC and OPT_OUTPUT_DOCX values produce a native document output, which means easyConverter directly generates an RTF, DOC or DOCX output, respectively.

The OPT_OUTPUT_DOC_VIA_OFFICE and OPT_OUTPUT_DOCX_VIA_OFFICE values are based on Microsoft Office automation. That means the conversion executes in two stages. In stage 1, easyConverter produces a temporary RTF document. In stage 2, Microsoft Office is used to convert the RTF file into DOC or DOCX format. Finally, the temporary RTF file gets deleted. This requires Microsoft Office to be installed on the computer.

Native conversion is preferred to Microsoft Office automation.

Note that if you are running easyConverter on the server side, and OutputDocumentFormat is explicitly set to OPT_OUTPUT_DOC_VIA_OFFICE or OPT_OUTPUT_DOCX_VIA_OFFICE, you must execute easyConverter via Loader.

Here is the feature matrix summary:

Output file extension
.rtf .doc .docx other
OPT_OUTPUT_RTF native RTF native DOC native DOCX native RTF
OPT_OUTPUT_DOC native RTF native DOC native DOCX native DOC
OPT_OUTPUT_DOCX native RTF native DOC native DOCX native DOCX
OPT_OUTPUT_DOC_VIA_OFFICE native RTF DOC via Office DOCX via Office DOC via Office
OPT_OUTPUT_DOCX_VIA_OFFICE native RTF DOC via Office DOCX via Office DOCX via Office

Note: The horizontal axis is the file extension (red). The vertical axis is the OutputDocumentFormat setting (blue). If not specified, OutputDocumentFormat behaves like OPT_OUTPUT_RTF.

Exception Handling

Please refer to the list of return exceptions.

Example Usage

oConverter = CreateObject("EasyConverter.PDF2Word.5")

' Set the option to save as native .DOC file
oConverter.OutputDocumentFormat = OPT_OUTPUT_DOC
Call oConverter.ConvertToWord(inFileName, outFileName)

Compatibility Note

Previous versions of easyConverter had properties SaveAsDoc and SaveAsDocx. They had been replaced by the OutputDocumentFormat property.