Word specific features
To add passwords to Word documents, call SetPasswords() method before calling ProcessReport():
loSession.setPasswords(tcReadPassword, tcWritePassword, tlRequirePassword)
You can omit either tcReadPassword or tcWritePassword. tlRequirePassword is optional (default value is .F.). If set to .T., Word will ask for the password even when the document is being opened first time after the generation (if tlNotOpenViewer parameter of SetParams method is set to .F.).
Word document splitting
This paragraph applies to VFP 8 only.
When the generated documents are very long, Word application has problem with the conversion - it takes very long to convert it. To avoid this problem, XFRX can split the generated document into more smaller documents. To set this up, call SplitDocument() method before calling ProcessReport():
m.loSession.SplitDocument(tnPages)
tnPagesp is the number of pages each of the resulting documents would have.
Word document format
Exporting to DOC format using Word 2010 or 2013 will save the document as a DOCX document. Unfortunately this was the only way to solve the intermittent Word 2010 freezing, caused by changes in the HTML output support in these versions. You can change this behavior by calling SetOtherParams() method with "ALLWAYS_DOC".
Example:Â Â
m.loSession.setOtherParams("ALLWAYS_DOC",.T.)
DOCX and FDOCX outputs
The new output types run the standard (DOCX) or flow layout (FDOCX) conversion and generate word documents with the DOCX extension (the OpenXML format). This output type requires Word 2007 or newer to be installed on the computer.Â
Using setPassword() method cause save output to Word97-2003 format. It's MS Word's behavior.
Native output generation
Since version 14.7, XFRX can natively generate DOCX (OpenXML) documents. The Word application is not required and does not need to be installed to generate the documents both in the absolute and flow layout. The generated documents are equivalent to the standard word documents generated by XFRX and can be opened in Word versions 2003 (with a plugin), 2007 and newer. The output type codes are "NATIVE_DOCX" (standard) and "NATIVE_FDOCX" (flow layout).Â
Overview
Output type code | Standard layout | Flow layout | Output format | Word version needed to generate | Word version needed to view |
---|---|---|---|---|---|
DOC | yes | no | DOC | 2000+ | 2000+ |
FDOC | no | yes | DOC | 2000+ | 2000+ |
NATIVE_DOCX | yes | no | DOCX | none | 2003+ |
NATIVE_FDOCX | no | yes | DOCX | none | 2003+ |
UsageÂ
All you need to do is to specify NATIVE_DOCX or NATIVE_FDOCX. This is a pure VFP implementation so no other setup is needed, except MD5.FLL library MD5.FLL, which is a free library implementing the MD5 algorithm. MD5.FLL was written by Duke Lotherington, Visual Records Consulting, 3944 Murphy Canyon Rd, San Diego CA 92123, duke@visualrecords.com (http://www.leafe.com/dls/vfp)Â
MD5.fll is unnecessary since XFRX 16.1.0.
LOCAL m.loSession, m.lnRetVal m.loSession= xfrx("XFRX#INIT") m.lnRetVal = m.loSession.SetParams("output.docx",,,,,,"NATIVE_FDOCX") IF m.lnRetVal = 0 m.loSession.ProcessReport("report1") m.loSession.finalize() ENDIF
LOCAL m.loXFRX, m.lnRetVal m.loXFRX = XFRX("XFRX#LISTENER") m.lnRetval = m.loXFRX.SetParams("output.docx",,,,,,"NATIVE_FDOCX") IF m.lnRetval = 0 REPORT FORM report1 OBJECT m.loXFRX ENDIF
Developer Folder for NATIVE_DOCX/NATIVE_FDOCX/DOC/FDOC Â
Call SetOtherParams method with "DEVELOP" or "DEVELOPFOLDER" to define output folder for source files and folders of OpenXML.
Example:Â Â
m.loSession.setOtherParams("DEVELOP",.T.) m.loSession.setOtherParams("DEVELOPFOLDER","[FOLDER\]DEVELOPFOLDER")
Font Embedding
You can call method setEmbeddingType() to embed font into the word document.