ConvertDocument

KCM Core instructs Microsoft Word to open the Src document and save this document to the file Dest in the specified format. The format of the Src document should be in the DOC or DOCX file extensions that KCM Core recognizes.

You can specify the format for the Dest document, depending on the formats supported by Microsoft Word.

Before KCM Core can use Microsoft Word, it must be configured appropriately.

Syntax

ConvertDocument
   Src(<text>)
   Dest(<text>)
   TimeOut(<number>)
   WFWFormat(<number>);

Parameters

  • Src: Required. The word processor document that KCM Core has to convert. Currently only Microsoft Word DOC and DOCX formats are supported.
  • Dest: Required. The name of the resulting document. Any existing file is overwritten.
  • TimeOut: Optional. The timeout for this command in seconds. If the word processor exceeds this timeout, the process is terminated and KCM Core reports a run-time error. If this parameter is omitted, the appropriate default timeout value for either batch or interactive jobs is used. A timeout value of 0 disables the timeout.
  • WFWFormat: The format of the result document. If this parameter is not specified, KCM Core uses the value of the constant WFWFormat. If this constant is not set, KCM Core reports a run-time error.

Save formats

Microsoft Word

Specifies the number for the converter to use. The following list specifies the documented converters that are always available. If additional converters are installed, these converters can be enumerated using a macro.

The following formats are documented for Microsoft Word:

  • 0 (wdFormatDocument): Microsoft Office Word 97-2003 binary file format
  • 1 (wdFormatTemplate): Word template format
  • 2 (wdFormatText): Microsoft Windows text format
  • 3 (wdFormatTextLineBreaks): Windows text format with line breaks preserved
  • 4 (wdFormatDOSText): Microsoft DOS text format
  • 5 (wdFormatDOSTextLineBreaks): Microsoft DOS text with line breaks preserved
  • 6 (wdFormatRTF): Rich Text format (RTF)
  • 7 (wdFormatEncodedText): Encode text format
  • 7 (wdFormatUnicodeText): Unicode text format
  • 8 (wdFormatHTML): Standard HTML format
  • 9 (wdFormatWebArchive): Web archive format
  • 10 (wdFormatFilteredHTML): Filtered HTML format
  • 11 (wdFormatXML): Extensible Markup Language (XML format)

The following formats are documented for Microsoft Word 2007 and later versions:

  • 12 (wdFormatXMLDocument): XML document format
  • 13 (wdFormatXMLDocumentMacroEnabled): XML document format with macros enabled
  • 14 (wdFormatXMLTemplate): XML template format
  • 15 (wdFormatXMLTemplateMacroEnabled): XML template format with macros enabled
  • 16 (wdFormatDocumentDefault): Word default file format
  • 17 (wdFormatPDF): PDF format
  • 18 (wdFormatXPS): XPS format

The following formats are documented for Microsoft Word 2010 and later versions:

  • 19 (wdFormatFlatXML): Open XML file format saved as single XML file
  • 20 (wdFormatFlatXML): Open XML file format with macros enabled saved as a single XML file
  • 21 (wdFormatFlatXMLTemplate): Open XML template format saved as a XML single file
  • 22 (wdFormatFlagXMLTemplateMacroEnabled): Open XML template format with macros enabled saved as a single XML file
  • 23 (wdFormatOpenDocumentText): OpenDocument Text format

The following format is documented for Microsoft Word 2013 and later versions:

  • 24 (wdFormatStrictOpenXMLDocument): Strict Open XML document

Example WFWFormat(6) saves a document in Rich Text format (RTF).

For more details on these formats, see the Microsoft Office documentation.