Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


Note
titleXFRX 16.1

Member  oDocument of XFRX Session object is deprecated. You can use member oDocumentWriter.

Password protection

Info

This paragraph applies both to VFP 9 and VFP 8. The setPasswords method is implemented both in XFRXListener and XFRXSession classes.


Table of Contents

 

To add passwords to Word documents, call SetPasswords() method before calling ProcessReport():

Code Block
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

Info

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():

Code Block
m.loSession.SplitDocument(tnPages)

tnPagesp is the number of pages each of the resulting documents would have.

 

Word document format

Info

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:   

Code Block
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. 

Info

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 codeStandard layoutFlow layoutOutput formatWord version needed to generateWord version needed to view
DOCyesnoDOC2000+2000+
FDOCnoyesDOC2000+2000+
NATIVE_DOCXyesnoDOCXnone2003+
NATIVE_FDOCXnoyesDOCXnone2003+

Usage 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

Info

MD5.fll is unnecessary since XFRX 16.1.0.




Code Block
languagevb
titlePre-VFP 9.0 mode
linenumberstrue
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


Code Block
languagevb
titleVFP 9.0 mode
linenumberstrue
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:   

Code Block
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.