Properties and methods common in XFRXListener and XFRXSession classes
Properties
PictureDPI | DPI (dots-per-inch) resolution to which all pictures are recomputed. You can use this property to reduce the output document size. This property must be sent before calling the SetParams method. |
---|---|
DefaultPictureFormat | Picture format of activeX components converted to pictures. Allowed values: “bmp”, “jpg”, "png", "tif", "gif" Default value: “jpg” |
JPEGQuality | JPEG Quality for converting to JPEG format. Default value: 80 |
Main methods
...
ErrorMessage()
...
Syntax:
lnRetVal = loXFRXobj.ErrorMessage(lnErrorNo)
This method returns a error message corresponding to the value returned from SetParams() method.
...
Call this method to set the document generation parameters.
Syntax:
Code Block | ||
---|---|---|
| ||
lnRetVal = loXFRXobj.SetParams(<tcOutputName>, <tcTempDirectory>, <tlNotOpenViewer>, <tcCodePage>, <tlSilent>, <tlNewSession>,
<tcTarget>, <tcArchive>, <tlAdditive>, <tlDeleteFileAfter>, <tuAppend>) |
Return values:
0 ... everything was ok, you can start processing reports
-1 ... cannot load Word or Excel application
-2 ... the Word or Excel application version must be 2000 or higher
-3 ... cannot create or open the output file
-4 ... unknown 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 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
Info |
---|
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 the current directory [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 |
| .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. |
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. |
This parameter applies to PDF documents only.
...
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 |
---|---|---|
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:
|
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 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.
|
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.
|
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.
...
This method create log file with name "_XFRX.log".
Syntax
Code Block |
---|
= loXFRXobj.initLog(<tlSilent>) |
Parameters:
tlSilent
do not write header to log file [optional]
...
This method create log file with name <tcLogFile>.
Syntax
Code Block |
---|
= loXFRXobj.setLogFile(<tcLogFile>, <tlSilent>) |
Parameters:
tcLogFile
the name of the log file to create.
tlSilent
do not write header to log file [optional]
Methods for registering page bound XFF scripts
RegisterScript() | Syntax:
Parameters: toScriptObject The PDFLScripts object reference tcMethodName The name of the method containing the script tnZIndex 0 ... print below (before) the report page 1 ... print above (after) the report page tcScope Defines which pages to invoke the scripts on. Can contain "ALL", "ODD", "EVEN" and numbers delimited with commas. Hyphens can be used to define the from-to scope. Examples: "ODD", "1,5-19", "ODD,4,8" tnPageNumberingType Defines how XFRX determines the page number: | ||
---|---|---|---|
Unregister AllScripts () | Syntax:
If multiple reports are merged together and you would like to apply scripts on a certain report but not on subsequent ones, call this method to remove all scripts registrations. This method does not need to be called at the end of the reports processing. |
Page size adjustment methods
setPaperSize() | Use this method to define a user-define page size. Syntax:
Please see User-defined page size paragraph on page 18 (nad) for more information. | ||
---|---|---|---|
ShrinkHeight() |
Use this method to shorten the page size. Please see HTML page size adjustment na stránce 34 for more information.
|
Methods to define document encryption
setPasswords() | Sets passwords for PDF and Word document protection. PDF syntax:
Parameters: The user password (tcUserPassword) can be empty. If the owner password (tcOwnerPassword) is empty, a random string will be generated as the password. Word syntax:
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 DoNotOpenViewer property is set to .F.). | ||||
---|---|---|---|---|---|
setPermissions() |
Sets the user permissions in the PDF document. Syntax:
|
Methods to set document properties
setAuthor() | Sets the document author property. Syntax:
Parameters: tcValue (char) is a value that will be used in the document properties.
| ||||
---|---|---|---|---|---|
setCategory() | Sets the document “Category” property. Syntax:
Parameters: tcValue (char) is a value that will be used in the document properties.
| ||||
setComments() | Sets the document “Comments” property. Syntax:
Parameters: tcValue (char) is a value that will be used in the document properties.
| ||||
setCompany() | Sets the document “Company” property. Syntax:
Parameters: tcValue (char) is a value that will be used in the document properties.
Remarks: This value will be used for Word and Excel documents only. | ||||
setCreator() | Sets the document “creator” property. Syntax:
Parameters: (char) is a value that will be used in the document properties.
Remarks: This value will be used for PDF documents only. | ||||
setKeywords() | Sets the document “keywords” property. Syntax:
Parameters: tcValue (char) is a value that will be used in the document properties.
Remarks: This value will be used for PDF, Word and Excel documents. | ||||
setManager() | Sets the document “Manager” property. Syntax:
Parameters: tcValue (char) is a value that will be used in the document properties.
Remarks: This value will be used for Word and Excel documents only. | ||||
setProducer() | Sets the document “producer” property. Syntax:
Parameters: tcValue (char) is a value that will be used in the document properties.
Remarks: This value will be used for PDF documents only. | ||||
setSubject() | Sets the document “Subject” property Syntax:
Parameters: tcValue (char) is a value that will be used in the document properties.
Remarks: This value will be used for PDF, Word and Excel documents. | ||||
setTitle() | Sets the document title property. Syntax:
Parameters: tcValue (char) is a value that will be used in the document properties.
Remarks: This value will be used for PDF, Word and Excel documents. |
XFRXListener class
Properties:
AppendToFile | 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:
Examples:
This property applies to PDF documents only. | |||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
CodePage |
The code page of the output document.
| |||||||||||||||||||||||||||||||||||
DoNotOpenViewer |
If set to .T., documents won't be opened after the generation. Default value = .F.
| |||||||||||||||||||||||||||||||||||
NewViewerSession |
By default, Word and HTML documents will be open in the current instance of the application, if exists. If this parameter is set to .T., the document will always be open in a new Word / Web browser instance. Default value = .F.
| |||||||||||||||||||||||||||||||||||
QuietMode |
This is a property of the ReportListener class. If set to .T., no message will be printed during the report generation process.
| |||||||||||||||||||||||||||||||||||
targetFileName |
The name of the file to be generated.
| |||||||||||||||||||||||||||||||||||
targetType |
The output type to be generated. One of the values listed at XFRX Output Target Types (above).
|
Methods:
Info |
---|
The common methods are described at Properties and methods common in XFRXListener and XFRXSession classes (above). |
zipDocument() |
Specifies that the generated document should be added to a zip archive. Syntax:
Return values: none Parameters: ArchiveName (char) is the file name of the zip archive AddToArchive (logical) specifies, if the file should be added to existing archive (.T.) or if a new archive should be created (.F.) DeleteSourceDocument (logical) if set to .T., the source document will be deleted after adding to the archive.
|
---|
XFRXSession class
Info |
---|
The common methods are described at Properties and methods common in XFRXListener and XFRXSession classes (above). |
ProcessReport() |
Processes the report. Syntax:
Parameters: tcReportName the name of the report file tcForClause the FOR clause [optional] tlSummary The summary clause switch. If set to .T., the report is processed as if SUMMARY clause was used in the REPORT FORM command [optional] tcScopeClause The string corresponding to the report's scope clause (such as NEXT 4, REST, ALL, RECORD nRecno). Default value is "ALL" [optional] tcWhileClause The while clause [optional] tlPlain Plain format switch. Send .T. as this parameter to switch the HTML output to PLAIN format. The plain format doesn't generate any page breaks to the document - one long page will be generated. The default value is .F.
|
---|
XFRX#DRAW class
Properties:
PageCount | The total number of pages in the XFF document (numeric) |
---|
Methods:
AddPage() |
Adds a new page at the end of the document.
Syntax:
Or
Parameters: tcPageSize The page size of the new page. Available values: “A4”, “letter” tnPageWidth, tnPageHeight The width and height of the new page. The unit can be defined by SetUnit() method. The default unit it point (1/72 in).
If no page size is specified, the current page size is used.
| ||||
---|---|---|---|---|---|
CreateDocument()
|
Creates a new XFF file. Syntax:
Return values .T. … the file was successfully created .F. … file couldn’t have been created ()
An existing file is overwritten.
Parameters: tcFileName The file name if the document to be created. If this parameter is empty, the XFF file is created in memory. | ||||
DrawLine() |
Draws a line on the current page. Syntax:
Parameters: tnXPos, tnYPos The X,Y coordinates of the start point of the line. tnXToPos, tnYToPos The X,Y coordinates of the end point of the line. tnLineWidth The line width in points. 0 represents hairline. Optional, default value = 1. tnPenPattern The border line pattern: 0 ... no border 1 ... dotted 2 ... dashed 3 ... dash-dot 4 ... dash-dot-dot 8 … solid line Optional, default value = 8. | ||||
DrawPicture() |
Draws a picture on the current page into a given bounding rectangle. Syntax:
Parameters: tnXPos, tnYPos The X,Y coordinates of the upper left hand corner of the bounding rectangle. tnWidth The width of the rectangle tnHeight The height of the rectangle tcFileName The picture file name tnAdjType 0 … clip picture 1 … stretch picture, retain shape 2 … stretch picture, fill frame | ||||
DrawRectangle()
|
Draws a rectangle on the current page. Syntax:
Parameters: tnXPos, tnYPos The X,Y coordinates of the upper left hand corner. tnWidth The width of the rectangle tnHeight The height of the rectangle tnLineWidth The line width in points. 0 represents hairline. Optional, default value = 1. tnFill 0 ... not filled, 1 ... filled. Optional, default value = 0 tnPenPattern The border line pattern: 0 ... no border 1 ... dotted 2 ... dashed 3 ... dash-dot 4 ... dash-dot-dot 8 … solid line Optional, default value = 8. tnRoundFactor The radius of the rectangle edges curvature. 0 makes the rectangle right-angled (no rounding), 99 creates an ellipse. Optional, default value = 0.
| ||||
DrawText |
Draws a text, using a font defined by SetFont method. Syntax:
Or
Parameters: tnLeft, tnTop The coordinates where the text will be drawn. If the second syntax is used (without the coordinates), the text will be drawn at the current position: which is either a position defined by SetPos() method or a the end of an output if the previous DrawText() method call. tcText The text to be drawn tnRotate The text rotation angle in degrees. The label will be rotated counterclockwise. Optional, default value = 0. tcLinkName If this parameter is filled, the text will be a named target of a hyperlink. (see tcLinkRef parameter). tcLinkRef If this parameter is filled, the text will be a hyperlink. It will navigate to a target in the local document with tcLinkRef name. To navigate to a http URL, include “http://” at the beginning of the parameter. tcBookmark I not empty, the parameter contains a name of a bookmark that will be created and will navigate to this text. tcTooltip The tooltip displayed when hovering mouse over this text. | ||||
DrawTextBox() |
Word wraps the give text and print it into a given bounding rectangle. If the height of the rectangle is zero, then the rectangle stretches to accommodate to full text and the height of the rectangle is returned. Syntax:
Return value: The height of the bounding rectangle is returned. Parameters: tnLeft, tnTop The X and Y coordinates of the upper left hand corner of the bounding rectangle. tnWidth, tnHeight The width and the height of the bounding rectangle. If tnHeight is 0, the rectangle stretches to accommodate to full text and the height of the rectangle is returned. tnAlign The horizontal alignment of the text inside of the rectangle. The allowed values are: 0 … “left” 1 …“center” 2 … “right”. Optional, the default value is 0 (left). tnVAlign The vertical alignment of the text inside of the rectangle. The allowed values are: 0 … “top” 1 …“center” 2 … “bottom”. Optional, the default value is 0 (top). tnRotate The text rotation angle in degrees. The label will be rotated counterclockwise. Optional, default value = 0. tnRotationPoint
The point within the rectangle around which the text is rotated. The allowed values are 0..8, optional, default value = 0 (left, top). Please see the picture on the right for the point positions. tcLinkName If this parameter is filled, the text will be a named target of a hyperlink. (see tcLinkRef parameter). tcLinkRef If this parameter is filled, the text will be a hyperlink. It will navigate to a target with tcLinkRef name. tcBookmark I not empty, the parameter contains a name of a bookmark that will be created and will navigate to this text. tcTooltip The tooltip displayed when hovering mouse over this text.
| ||||
GetBounding |
Returns the bounding rectangle coordinates in the rectangle-bound script. Syntax:
Return value: NULL - the bounding rectangle is not available Object – an object with the following properties: nLeft, nTop – the coordinates of the upper left hand corner of the rectangle nWidth, nHeight – the width and height of the rectangle
The unit of the coordinates can be set by SetUnit() method. The default unit is Point (1/72 in).
| ||||
GetPageWidth()
|
| ||||
GetPageHeight()
|
| ||||
GetXPos()
|
Returns the horizontal coordinate of the current position. Syntax:
| ||||
GetYPos
|
Returns the vertical coordinate of the current position. Syntax:
| ||||
OpenDocument()
|
Opens an existing XFF file. Syntax:
Return values .T. … the file was successfully opened .F. … file couldn’t have been opened (file doesn’t exist or is locked)
| ||||
PrintDocument() |
Prints the XFF file to the specified printer. Syntax:
Return values -100 … cannot initialize printer device -101 … cannot initialize printer driver -102 … cannot initialize DEVMODE structure 0 … no errors
Parameters: tcPrinterName Then name of the printer to which the document will be sent tcJobName The printer job name tnFrom If numeric, the first page to be printed. tnTo The last page to be printed. tnPagesPerSheet The number of pages per sheet . tnAllEvenOdd Include all pages, odd or even only. The allowed values are: 1 ... all pages (default value) 2 ... odd pages 3 ... even pages tnCopies The number of copies.
Alternatively, tnFrom can contain a string value, containing the pages numbers separated by commas and ranges separated by dashes, e.g.: “1,2,5-6,8,20-30”
| ||||
SavePicture() |
SavePicture method saves the report page(s) as a picture. Syntax: XFRXDraw::SavePicture(tcFilename, tcType, tnFrom [, tnTo [, tnBpp [, tnJPEGQuality [, tnThumbnailWidth [, tnThumbnailHeight [, tnPagesPerSheet, [ tnAllEvenOdd ] ] ] ] ] ] ])
Return values 0 ... no errors was encountered -1 ... unknown image format -2 ... page out of range
Parameters: tcFilename The name of the file to be generated. tcType The format of the picture to be saved. Currently supported options are: BMP, GIF, JPEG, PNG, TIFF. tnFrom The page number to be saved. If TIFF format is being saved, the parameter specifies the first page to be saved. tnTo If TIFF format is being saved, the parameter specifies the last page to be saved. Ignored otherwise. tnBpp Bits per pixel. Currently supported values are 2, 16 or 24. tnJPEGQuality Specifies the JPEG compression quality. The range is from 1 - the lowest quality to 100 - the best quality. The default value is 0 - default quality. Ignored for other output types. tnThumbnailWidth The width of the output picture in pixels. tnThumbnailHeight The height of the output picture in pixels. tnPagesPerSheet The number of pages per sheet . tnAllEvenOdd Include all pages, odd or even only. The allowed values are: 1 ... all pages (default value) 2 ... odd pages 3 ... even pages
If both tnThumbnailWidth and tnThumbnailHeight are omitted, the original page size is used. If only one of the values is sent, the other one is calculated accordingly.
| ||||
SetColor() |
Sets the foreground and background drawing colors. Syntax:
Parameters: tfr, tfg, tfb Red, green and blue components of the foreground color tbr, tbg, tbb Red, green and blue components of the background color (optional)
| ||||
SetFont()
|
Sets font name and attributes for subsequent DrawText() or DrawTextBox() calls. Syntax:
Parameters: tcFontName The font name tnSize The font size in points tlBold, tlItalics, tlUnderline The font attributes. These parameters are optional, the default value is .F.
| ||||
SetPos()
|
Sets the position where the text will be drawn by the subsequent DrawText() method call. Syntax:
Parameters: tnXPos, tnYPos The X and Y (horizontal and vertical) coordinates of the position. The unit of the coordinates is defined by SetUnit() method, the default unit is Point (pt).
| ||||
SetUnit() |
Sets the drawing units. Syntax:
Parameters: tcUnit The unit code. The allowed values are: “in” – inches, “cm” – centimeters, “pt” – points and “px” – pixels.
|
XFCont class
XFRX Preview container class. This section describes properties that you can modify in your custom implementation of the previewer.
...
- -1 = Disable bookmarks
- 0 = Enable bookmarks but hide them (users need to click on the bookmark button to see them)
- 1 = Enable bookmarks, always showing them
- 2 = Enable bookmarks, but show or hide them automatically based on whether or not there are bookmarks defined in the report to preview (default)
...
Syntax:
Code Block |
---|
XFCont::DisplayMessage(tcMessage) |
Parameters:
tcMessage
The message to display
eqZIP class
eqZIP class. This section describes methods for creates ZIP archive.
...
Open ZIP archive file.
Syntax:
Code Block |
---|
eqZIP::OpenArchive(m.tcZipName, m.tnAppend) |
Parameters:
m.tcZipName
...
m.tnAppend
...
Return values
...
.F. - Archive do not create/open successfully.
...
Close ZIP archive file.
Syntax:
Code Block |
---|
eqZIP::CloseArchive(m.tcComment) |
Parameters:
m.tcComment
...
...
Open file handle.
Syntax:
Code Block |
---|
eqZIP::OpenNewFile(m.tcFileName, m.ttCreated, m.llIWontUTF8, m.lcPassword, m.liCRC32) |
Parameters:
m.tcFileName
...
m.ttCreated
...
m.llIWontUTF8
A wish uses UTF-8 for encoding file name.
Info |
---|
For UTF-8 encoding or password is needy zlib.dll version 1.25 or higher. |
m.lcPassword
...
m.liCRC32
...
Return values
0 - File append to ZIP archive.
-102 - ZIP_PARAMERROR
-103 - ZIP_BADZIPFILE
-104 - ZIP_INTERNALERROR
...
Add some file to ZIP archive.
Syntax:
Code Block |
---|
eqZIP::AppendFile(m.tcFilename, m.tcNameInArchive, m.llIWontUTF8, m.lcPassword) |
Parameters:
m.tcFileName
...
m.tcNameInArchive
...
m.llIWontUTF8
A wish uses UTF-8 for encoding file name.
Info |
---|
For UTF-8 encoding or password is needy zlib.dll version 1.25 or higher. |
m.lcPassword
...
Return values
-1 - The source file doesn't exists
-2 - The source file cannot open
0 - File append to ZIP archive
-102 - ZIP_PARAMERROR
-103 - ZIP_BADZIPFILE
-104 - ZIP_INTERNALERROR
...
Write data to opened file handle.
Syntax:
Code Block |
---|
eqZIP::WriteData(m.tcData) |
Parameters:
m.tcData
Data which will be write to file handle.
Return values
-102 - ZIP_PARAMERROR
-103 - ZIP_BADZIPFILE
-104 - ZIP_INTERNALERROR
...
Close file handle.
Syntax:
Code Block |
---|
eqZIP::CloseFile() |
...
Calculate CRC32 checksum for data.
Syntax:
Code Block |
---|
eqZIP::SYS2007(m.lcData) |
Parameters:
m.lcData
...
...
Child pages (Children Display) |
---|