Main methods

ErrorMessage()  



 Syntax:

 lnRetVal = loXFRXobj.ErrorMessage(lnErrorNo)


This method returns a error message corresponding to the value returned from SetParams() method. 

Setparams()


Call this method to set the document generation parameters.

Syntax:

 lnRetVal = loXFRXobj.SetParams(<tcOutputName>, <tcTempDirectory>,
                                <tlNotOpenViewer>, <tcCodePage>, 
                                <tlSilent>, <tlNewSession>, <tcTarget>,
                                <tcArchive>, <tlAdditive>, 
                                <tlDeleteFileAfter>, <tuAppend>)


Return values: 

   0 ... OK (everything was ok, you can start processing reports)
  -1 ... Cannot load Word application.
  -2 ... The Word application version must be 2000 or higher.
  -3 ... Cannot create or open the output FILE (%1).
  -4 ... Unknown output target
  -5 ... Hndlib.dll cannot be loaded (it is missing or an old version is used).
  -6 ...Xfrxlib.fll cannot be loaded (it is missing or invalid). 
          Please see Frequently asked questions if you are getting this error.  
  -7 ... Zlib.dll cannot be loaded.
  -8 … An old version of xfrxlib.fll is used.
  -9 ... Sorry, Word 2007 or higher is required for docx format!
-10 … The existing document is either corrupted or in an unsupported format.
-11 ... Signature file not found.
-12 ... Cannot use the signature file.
-13 ... The output folder (%1) does not exist or you do not have write access.
-14 ... The existing document use xref stream - it's no possibly append data.  (since XFRX 16.1)

Error code -14 is obsolete from XFRX 18.1.


-15 ... Cannot load Excel application.  (since XFRX 17.0)
-16 ...
The Excel application version must be 2000 or higher.  (since XFRX 17.0)
-17 ...
PDFpassword not is valid. (since XFRX 17.1)
-18 ...
Not is possible append new data with password to pdf without password. (since XFRX 17.1)
-19 ...
File name (%1) not is valid. (since XFRX 17.2.1)


You can retrieve the English message for the code returned with ErrorMessage() method.


Parameters:

tcOutputName
  the name of the document to create.

tcTempDirectory
  directory where temporary files will be created. If blank, the temporary files will be created in Visual FoxPro Temporary Path [optional]

tlNotOpenViewer
  if set to .T., documents won't be opened after the generation [optional]

tcCodePage
  is a codepage of the generated document [optional]. If you don't specify this parameter, cpcurrent() is used.

tlSilent
  if set to .T., no messages will be printed [optional]. This option is useful if your application is not in English and/or you would like to handle the Processing... message and error messages in your code.

tlNewSession
  by default, word document will be open in the current Word session, if exists. If this paramenter is set to .T., the document will always be open in a new Word session. This option is not used for PDF targets. [optional]

tcTarget
  The output type to be generated. One of the values listed at XFRX Output Target Types (above).

tcArchive
  The name of the zip archive to be created. If not empty, the generated file will be added to the archive after generation (optional)

tlAdditive
  If set to .T. and the archive already exists, the file will be added. (optional)

Please note: you can add several files to the archive, but existing files with the same name will not be overwritten - the new files will always be added.

tlDeleteFileAfter
  If set to .T., the generated file is be deleted after it is copied to the archive. (optional)

tuAppend
  Specifies whether the generated document will be appended to an existing file. This parameter can be either logical, numeric or a string, with the following meaning:

Type

Value

Meaning

Logical

.F.

An existing document will be overwritten

OutputXFRX version
PDF10.1
RTF16.1
FRTF16.1
PLAIN16.1
NATIVE_FXLSX
NATIVE_PFXLSX
18.2
TIFF21.0


.T.

The generated report will be appended at the end of the existing document

OutputXFRX version
PDF10.1
RTF16.1
FRTF16.1
PLAIN16.1

NATIVE_FXLSX
NATIVE_PFXLSX

18.2
TIFF21.0

Numeric

0

An existing document will be overwritten

OutputXFRX version
PDF10.1
RTF16.1
FRTF16.1
PLAIN16.1

NATIVE_FXLSX
NATIVE_PFXLSX 

18.2
TIFF21.0


<page No.>

The generated report will be inserted to the existing document at the given page number.

OutputXFRX version
PDF10.1
RTF16.1
FRTF16.1
PLAIN17.0 Only for value 1.

NATIVE_FXLSX
NATIVE_PFXLSX 

18.2
TIFF21.0

String

“R<page No.>”

The page will be replaced with the generated report.

OutputXFRX version
PDF10.1
RTF16.1
FRTF16.1

NATIVE_FXLSX
NATIVE_PFXLSX

18.2
TIFF21.0


“R<from>:<to>”

The page range will be replaced with the generated report.

OutputXFRX version
PDF10.1
RTF16.1
FRTF16.1

NATIVE_FXLSX
NATIVE_PFXLSX

18.2
TIFF21.0


Examples:

Parameter

Meaning

.T.

The generated report will be appended to the end of the existing document.

1

The generated report will be inserted at the beginning of the existing document.

5

The generated report will be inserted to the existing document, between pages 4 and 5.

“R5”

The generated report will be inserted between pages 4 and 6, replacing page 5.

“R4:8”

The generated report will be inserting between pages 3 and 9, replacing pages 4,5,6,7 and 8.

.F. or 0

The existing document will be overwritten.



SetOtherParams(…)



This method is used to add various output type specific parameters. The first parameter is a string value representing the parameter to be set, the second parameter is the values to be set.

Example:

To set the next sheet name in the XLS document to “Customer 1”, call:

.SetOtherParams("NEXT_SHEET_NAME", "Customer 1")

 

HTML specific parameters

Name

Type

Note

XFRX version 

PRINT_BOOKMARKS

Logical, Numeric

You can send two parameters with this option. The first parameter is logical and controls if the bookmark should be displayed (.T.) or not (.F. = default value).


The second parameter specifies what kind of bookmarks should be displayed:

  • Sending 0 will show both page number bookmarks and the ones defined in the report (default)
  • Sending 1 will show only the bookmarks defined in the report
  • Sending 2 will show only the page number bookmarks



CONVERTEMF_TIFFTOPNG Logical 

Default value is .F.
If this parameter is set to .T.,  then EMF/TIFF images will be convert to PNG. 

15.5
INLINEIMAGES Logical  Default value is .F.
If this parameter is set to .T., then images will be inside output file. 
16.0

 

Plain text specific parameters

Name

Type

Note

PLAIN_CPI_HORIZONTAL

Numeric

Horizontal characters per inch value

PLAIN_CPI_VERTICAL

Numeric

Vertical characters per inch value

PLAIN_SHOW_LINES

Logical

Default value = .T.

This parameter allows for suppressing horizontal lines from the generated file

 

Please find more information about plain text parameter in Converting reports to plain text chapter on page 41.

 

XLS, XLSPLAIN, NATIVE_FXLS, NATIVE_PFXLSX, ODS,FODS, PFODS specific parameters

Name

Type

Note

DISPLAY_GRID_LINES

Logical

Default value = .T.

If this parameter is set to .F., the grid lines in the XLS output will not be visible.

LEAVE_FULL_FIELD_CONTENT

Logical

Default value = .F.

By default, the content of non-stretchable fields is cut according to the size of the field. This option enables to leave the full content of the field in the Excel cell.

NEXT_SHEET_NAME

String

The name of the next sheet to be inserted by next report run.

NEXT_SHEET_NAME_EXPR

String

This expression, if defined, is evaluated at the bottom of each sheet and the result is used as the sheet name.

This parameter takes precedence over the  NEXT_SHEET_NAME parameter.

ADDPAGENUMBERTOSHEETDISPLAYNAMELogical

Default value = .T.

If this parameter set to .F. then XFRX suppresses sheet number in sheet name.
(Since XFRX 15.6)

SHEET_PER_PAGE

Logical

Default value = .F.

By default, the XLS document is generated in “Plain” mode – one long sheet is generated, with the page header at the top and the footer at the bottom.

If this parameter is set to .T., then each report page is generated as a new sheet.

SHEET_PER_NP_GROUP

Logical

Default value = .F.

This option combines the plain mode and the sheet-per-page mode.

If this parameter is set to .T. (and SHEET_PER_PAGE is .F.), then a new sheet is generated for each report group with “Start each group on a new page” flag set to .T.

SHEETPAGEBREAKLogical

Default value = .F.

This option add page breaks in sheet by report pages.

 (Since XFRX 15.7) 

HORIZONTAL_ADJUSTMENT

VERTICAL_ADJUSTMENT

Numeric

The maximal coordinates difference considered as zero.

Please see XLS cells adjustment chapter on page 37 for more information.

Finalize()


This method finishes the document generation and displays the generated document (unless the document preview was explicitly suppressed).

The Finalize() method does not have to be called in VFP 9.0, if the last REPORT FORM command doesn’t contain the NOPAGEEJECT clause. 

initLog()


This method create log file with name "_XFRX.log".

Syntax 

= loXFRXobj.initLog(<tlSilent>)

Parameters:

 tlSilent
  do not write header to log file [optional]


setLogFile()


This method create log file with name <tcLogFile>.  

Syntax  

= loXFRXobj.setLogFile(<tcLogFile>, <tlSilent>)

Parameters:

 tcLogFile
  the name of the log file to create.

 tlSilent
  do not write header to log file [optional]