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.
| ||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
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 ... 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
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:
Examples:
This parameter applies to PDF documents only. (optional, default value = .F.) | ||||||||||||||||||||||||||||||||||||||||||
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
Plain text specific parameters
Please find more information about plain text parameter in Converting reports to plain text chapter on page 41.
XLS specific parameters
| ||||||||||||||||||||||||||||||||||||||||||
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] |
Methods for registering page bound XFF scripts
RegisterScript() | Syntax: RegisterScript(toScriptObject, tcScriptMethod, tnZOrder, tcPageScope, tnNumberingType) 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: UnregisterAllScripts() 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: setPaperSize(nUDPaperWidth, nUDPaperHeight) 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: setPasswords(tcOwnerPassword, tcUserPassword) 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: 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 DoNotOpenViewer property is set to .F.). |
---|---|
setPermissions() |
Sets the user permissions in the PDF document. Syntax: setPermissions(tlPrintDocument, tlModifyDocument, tlCopyTextAndGraphics, tlAddOrModifyAnnotations) |
Methods to set document properties
setAuthor() | Sets the document author property. Syntax: setAuthor(tcvalue)
Parameters: tcValue (char) is a value that will be used in the document properties.
This value will be used for PDF, Word and Excel documents. |
---|---|
setCategory() | Sets the document “Category” property. Syntax: setCategory(tcvalue) Parameters: tcValue (char) is a value that will be used in the document properties.
This value will be used for Word and Excel documents only. |
setComments() | Sets the document “Comments” property. Syntax: setComments(tcvalue) Parameters: tcValue (char) is a value that will be used in the document properties.
This value will be used for Word and Excel documents only. |
setCompany() | Sets the document “Company” property. Syntax: setCompany(tcValue) 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: setCreator( tcValue )
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: setKeywords(tcValue)
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: setManager(tcValue)
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: setProducer(tcValue)
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: setSubject(tcValue)
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: setTitle(tcValue)
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:
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: zipDocument(ArchiveName, AddToArchive, DeleteSourceDocument) 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.
You can send these three parameters to XFRX either via this method or as the last three parameters of the SetParams method. This method is available for your convenience of you prefer to fill in XFRXListener properties and call SetParams without parameters. |
---|
XFRXSession class
The common methods are described at Properties and methods common in XFRXListener and XFRXSession classes (above).
ProcessReport() |
Processes the report. Syntax: ProcessReport(<tcReportName>, <tcForClause>, <tlSummary>, <tcScopeClause>, <tcWhileClause>, <tlPlain>) 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: XFRXDraw::AddPage([tcPageSize]) Or XFRXDraw::AddPage(tnPageWidth, tnPageHeight)
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: XFRXDraw::CreateDocument([tcFileName])
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: XFRXDraw::DrawLine(tnXPos, tnYPos, tnXToPos, tnYToPos [, tnLineWidth[, tnPenPattern]]) 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: XFRXDraw::DrawPicture(tnXPos, tnYPos, tnWidth, tnHeight, tcFilename[, tnAdjType]) 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: XFRXDraw::DrawRectangle(tnXPos, tnYPos, tnWidth, tnHeight [, tnLineWidth[, tnFill[, tnPenPattern, tnRoundFactor]]]) 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.
The border and fill color needs to be defined via SetColor() method before calling DrawRectangle() method. |
DrawText |
Draws a text, using a font defined by SetFont method. Syntax: XFRXDraw::DrawText(tnLeft, tnTop, tcText[, tnRotate[, tcLinkName[, tcLinkRef[, tcBookmark[, tcTooltip]]]]]) Or XFRXDraw::DrawText(tcText[, tnRotate[, tcLinkName[, tcLinkRef[, tcBookmark[, tcTooltip]]]]]) 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: XFRXDraw::DrawTextBox(tnLeft, tnTop, tnWidth, tnHeight, tcText[, tnAlign[, tnVAlign[, tnRotate[,tnRotationPoint[, tcLinkName[, tcLinkRef[, tcBookmark[, tcTooltip]]]]]]]]) 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: XFRXDraw::GetBoundingRectangle() 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: XFRXDraw::GetXPos() |
GetYPos
|
Returns the vertical coordinate of the current position. Syntax: XFRXDraw::GetYPos() |
OpenDocument()
|
Opens an existing XFF file. Syntax: XFRXDraw::OpenDocument(tcFileName) 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: XFRXDraw::PrintDocument(tcPrinterName, tcJobname, tnFrom [, tnTo[, tcDEVMODE]]) 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.
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, [, tnCopies ] ] ] ] ] ] ] ])
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 tnCopies The number of copies.
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: XFRXDraw::SetColor(tfr, tfg, tfb[, tbr, tbg, tbb]) 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: XFRXDraw::SetFont(tcFontName, tnSize[, tlBold, tlItalic, tlUnderline]) 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: XFRXDraw::SetPos(tnXPos, tnYPos) 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: XFRXDraw::SetUnit(tcUnit) Parameters: tcUnit The unit code. The allowed values are: “in” – inches, “cm” – centimeters, “pt” – points and “px” – pixels.
The default unit is point. |
XFCont class
XFRX Preview container class. This section describes properties that you can modify in your custom implementation of the previewer.
|
|
---|---|
|
|
|
|
|
Syntax: XFCont::DisplayMessage(tcMessage) Parameters: tcMessage The message to display |
eqZIP class
eqZIP class. This section describes methods for creates ZIP archive.
OpenArchive | Open ZIP archive file. Syntax: eqZIP::OpenArchive(m.tcZipName, m.tnAppend) Parameters: m.tcZipName The ZIP archive file.m.tnAppend A append flag.Return values .T. - Archive create/open successfully..F. - Archive do not create/open successfully. |
---|---|
CloseArchive | Close ZIP archive file. Syntax: eqZIP::CloseArchive(m.tcComment) Parameters: m.tcComment ZIP archive comment.
|
OpenNewFile | Open file handle. Syntax: eqZIP::OpenNewFile(m.tcFileName, m.ttCreated, m.llIWontUTF8, m.lcPassword, m.liCRC32) Parameters: m.tcFileName File name in ZIP archive.m.ttCreated Datetime created.m.llIWontUTF8 A wish uses UTF-8 for encoding file name. For UTF-8 encoding or password is needy zlib.dll version 1.25 or higher. m.lcPassword File password.m.liCRC32 File CRC32 checksum. it is mandatory for m.lcPassword. Checksum is for all data.
Return values 0 - File append to ZIP archive. -102 - ZIP_PARAMERROR |
AppendFile | Add some file to ZIP archive. Syntax: eqZIP::AppendFile(m.tcFilename, m.tcNameInArchive, m.llIWontUTF8, m.lcPassword) Parameters: m.tcFileName The source file name.m.tcNameInArchive File name in ZIP archive.m.llIWontUTF8 A wish uses UTF-8 for encoding file name. For UTF-8 encoding or password is needy zlib.dll version 1.25 or higher. m.lcPassword File password.Return values -1 - The source file doesn't exists |
WriteData | Write data to opened file handle. Syntax: eqZIP::WriteData(m.tcData) Parameters: m.tcData Data which will be write to file handle. Return values -102 - ZIP_PARAMERROR -103 - ZIP_BADZIPFILE |
CloseFile | Close file handle. Syntax: eqZIP::CloseFile() |
SYS2007 | Calculate CRC32 checksum for data. Syntax: eqZIP::SYS2007(m.lcData) Parameters: m.lcData Data which calculate CRC32 checksum.
|