Setparams Method

Call this method to set the document generation parameters.

Object.Setparams(tcOutputName, tcTempDirectory,
                 tlNotOpenViewer, tcCodePage, 
                 tlSilent, tlNewSession, tcTarget
                 [, tcArchive [, tlAdditive
                 [, tlDeleteFileAfter [,  tuAppend]]]])

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

 It's 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:


Value

Meaning

Logical

.F.

An existing document will be overwritten


.T.

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

Numeric

0

An existing document will be overwritten


<page No.>

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

String

“R<page No.>”

The page will be replaced with the generated report.


“R<from>:<to>”

The page range will be replaced with the generated report.


OutputXFRX versionValues
PDF10.1.F., .T., 0, <page No.>, “R<page No.>”, “R<from>:<to>”
RTF16.1.F., .T., 0, <page No.>, “R<page No.>”, “R<from>:<to>”
FRTF16.1.F., .T., 0, <page No.>, “R<page No.>”, “R<from>:<to>”
PLAIN16.1.F., .T., 0, <page No.> - only for value 1.
NATIVE_FXLSX
NATIVE_PFXLSX
18.2.F., .T., 0, <page No.>, “R<page No.>”, “R<from>:<to>”
TIFF21.0.F., .T., 0, <page No.>, “R<page No.>”, “R<from>:<to>”

Remarks

Applies To: XFRX#INIT, XFRX#LISTENER

Return value

Number.

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


Error code -14 is obsolete from XFRX 18.1.

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

Examples

LOCAL m.lnErr
m.loXFRX=EVALUATE([xfrx("XFRX#INIT")])

* The generated report will be appended to the end of the existing document.
m.lnErr=m.loXFRX.SetParams(,,,,.T.,,"XFF",,,, .T.)

* The generated report will be inserted at the beginning of the existing document.
m.lnErr=m.loXFRX.SetParams(,,,,.T.,,"XFF",,,, 1)

* The generated report will be inserted to the existing document, between pages 4 and 5.
m.lnErr=m.loXFRX.SetParams(,,,,.T.,,"XFF",,,, 5)

* The generated report will be inserted between pages 4 and 6, replacing page 5.
m.lnErr=m.loXFRX.SetParams(,,,,.T.,,"XFF",,,, "R5")

* The generated report will be inserting between pages 3 and 9, replacing pages 4,5,6,7 and 8.
m.lnErr=m.loXFRX.SetParams(,,,,.T.,,"XFF",,,, "R4:8")

* The existing document will be overwritten.
m.lnErr=m.loXFRX.SetParams(,,,,.T.,,"XFF",,,, .F.) 

IF m.lnErr<>0
   ?m.loXFRX.ErrorMessage(m.lnErr)
ENDIF