Module CrystalReport.pkg

     1// ************************************************************************* //
     2// **                                                                     ** //
     3// ** File       : CrystalReport.pkg                                      ** //
     4// **                                                                     ** //
     5// ** Author     : Ulbe Stellema                                          ** //
     6// **            : Data Access Nederland                                  ** //
     7// **            : 17 october 1997                                        ** //
     8// **                                                                     ** //
     9// ** Purpose    : This package contains the support for WinQL 4.5        ** //
    10// **                                                                     ** //
    11// ** 17-10-1997 : Header created                                         ** //
    12// **                                                                     ** //
    13// ** 11-11-1997 : HandlePossibleError now uses the ErrorCode function    ** //
    14// **              to determine if there is an error, instead of          ** //
    15// **              ErrorText.                                             ** //
    16// **                                                                     ** //
    17// ** 26-02-1998 : Added support for ReportOutput... objects.             ** //
    18// **                                                                     ** //
    19// ** 27-02-1998 : Added ExportWindowToDisk and ExportWindowToMail        ** //
    20// **              procedures.                                            ** //
    21// **                                                                     ** //
    22// ** 27-02-1998 : Added error trapping support.                          ** //
    23// **                                                                     ** //
    24// ** 03-07-1998 : The WinQLSelectFont and WinQLSelectPrinter objects     ** //
    25// **              are now child objects of the WinQLReport class.        ** //
    26// **              Furthermore the WinQLSelectPrinter object is set to    ** //
    27// **              modal by default.                                      ** //
    28// **                                                                     ** //
    29// ** 04-08-1998 : Defect 11534, "Cancel" after SelectAndSetPrinter ->    ** //
    30// **              report still prints.                                   ** //
    31// **                                                                     ** //
    32// ** Added a function SelectAndSetPrinter to return the users selection. ** //
    33// ** Added a function SelectAndSetFont to return the users selection.    ** //
    34// **                                                                     ** //
    35// ** 19-04-1999 : All short functions now return (low(...)), this fixes  ** //
    36// **              problems with Crystal 7.                               ** //
    37// **                                                                     ** //
    38// ** 28-04-1999 : Package and class changed to respect Crystal Reports   ** //
    39// **              not WinQL.                                             ** //
    40// **                                                                     ** //
    41// **  VDF8 changes                                                       ** //
    42// ** 10/23/2001 JJT/SWB - Added Application object support, removed      ** //
    43// **                      ghoWorkspace support. removed Local keyword    ** //
    44// **                                                                     ** //
    45// ** 08/04/2004 DP - Added Adobe Portable Document Format (PDF) support  ** //
    46// ************************************************************************* //
    47Use LanguageText.pkg
    48Use WINDOWS.PKG
    49Use DLL.PKG
    50
    51Use GLOBMEM.PKG  // Global memory object functions
    52Use PRNT_DLG.PKG // Print common dialog
    53Use FONT_DLG.PKG // Font common dialog
    54Use PTRMODES.PKG // Printer modes
    55Use GlobalFunctionsProcedures.pkg
    56
    57Register_function ReadString string sSubKey string sName string sDefault returns string
    58
    59Enumeration_List
    60  Define WQL_PRINT_TO_WINDOW
    61  Define WQL_PRINT_TO_PRINTER
    62  Define WQL_PRINT_TO_FILE
    63  Define WQL_PRINT_TO_UNDEFINED
    64  Define WQL_PRINT_TO_MAPI
    65End_Enumeration_List
    66
    67Define CRW_PRINT_TO_WINDOW    for WQL_PRINT_TO_WINDOW
    68Define CRW_PRINT_TO_PRINTER   for WQL_PRINT_TO_PRINTER
    69Define CRW_PRINT_TO_FILE      for WQL_PRINT_TO_FILE
    70Define CRW_PRINT_TO_UNDEFINED for WQL_PRINT_TO_UNDEFINED
    71Define CRW_PRINT_TO_MAPI      for WQL_PRINT_TO_MAPI
    72
    73Register_Function CurrentDataPath Returns String
    74Register_Function CanCloseEngine Returns Integer
    75
    76// This integer holds the number of WinQLReport objects initialized
    77Integer WinQL_Report_Initialized
    78Move 0 To WinQL_Report_Initialized
    79
    80Register_Procedure Set WinQLReport_Id Integer iObject
    81Register_Function WinQLReport_Id Returns Integer
    82Register_Procedure ShowReport
    83
    84Register_Function phoWorkspace Returns Handle
    85Register_Function psWorkspaceName Returns String
    86Register_Function psDataPath Returns String
    87
    88
    89
    90
    91Object WinQLSelectFont Is A FontDialog
    92End_Object // WinQLSelectFont
    93
    94Object WinQLSelectPrinter Is A PrintDialog
    95End_Object // WinQLSelectPrinter
    96
    97// ************************************************************************** //
    98// **                                                                      ** //
    99// ** Constant definitions                                                 ** //
   100// **                                                                      ** //
   101// ************************************************************************** //
   102
   103// 'Old' CW_DEFAULT constant
   104#REPLACE CW_DEFAULT16 |CI$8000
   105
   106// PEGetVersion constants
   107#REPLACE PE_GV_DLL    100 // Returns the version of the DLL.
   108#REPLACE PE_GV_ENGINE 200 // Returns the version of the print engine.
   109
   110// PEGetJobStatus constants
   111#REPLACE PE_JOBNOTSTARTED 1
   112#REPLACE PE_JOBINPROGRESS 2
   113#REPLACE PE_JOBCOMPLETED  3
   114#REPLACE PE_JOBFAILED     4
   115#REPLACE PE_JOBCANCELLED  5
   116
   117// PEGetNthSortField constants
   118#REPLACE PE_SF_DESCENDING 0
   119#REPLACE PE_SF_ASCENDING  1
   120
   121// PEGetGroupCondition constants
   122#REPLACE PE_GC_ANYCHANGE    0
   123#REPLACE PE_GC_DAILY        0
   124#REPLACE PE_GC_WEEKLY       1
   125#REPLACE PE_GC_BIWEEKLY     2
   126#REPLACE PE_GC_SEMIMONTHLY  3
   127#REPLACE PE_GC_MONTHLY      4
   128#REPLACE PE_GC_QUARTERLY    5
   129#REPLACE PE_GC_SEMIANNUALLY 6
   130#REPLACE PE_GC_ANNUALLY     7
   131#REPLACE PE_GC_TOYES        1
   132#REPLACE PE_GC_TONO         2
   133#REPLACE PE_GC_EVERYYES     3
   134#REPLACE PE_GC_EVERYNO      4
   135#REPLACE PE_GC_NEXTISYES    5
   136#REPLACE PE_GC_NEXTISNO     6
   137
   138// PEZoomPreviewWindow constants
   139#REPLACE PE_ZOOM_FULL_SIZE           0 // Full Page
   140#REPLACE PE_ZOOM_SIZE_FIT_ONE_SIDE   1 // Fit One Side
   141#REPLACE PE_ZOOM_SIZE_FIT_BOTH_SIDES 2 // Fit Both Sides
   142
   143// PEOutputToFile contants
   144#REPLACE PE_FT_RECORD        0
   145#REPLACE PE_FT_TABSEPARATED  1
   146#REPLACE PE_FT_TEXT          2
   147#REPLACE PE_FT_DIF           3
   148#REPLACE PE_FT_CSV           4
   149#REPLACE PE_FT_CHARSEPARATED 5
   150#REPLACE PE_FT_TABFORMATTED  6
   151
   152// PEPrintOptions constants
   153#REPLACE PE_UNCOLLATED       0 // Prints multiple copies of a multiple page report uncollated (Page order = 1,1,1, 2,2,2, 3,3,3, etc.)
   154#REPLACE PE_COLLATED         1 // Prints multiple copies of a multiple page report collated (Page order = 1,2,3 ,... 1,2,3 ,... etc.)
   155#REPLACE PE_DEFAULTCOLLATION 2 // Prints multiple copies of a multiple page report using the collation settings as specified in the report.
   156
   157// PESetSectionFormat constants
   158#REPLACE PE_ALLSECTIONS           0 // Sets the value of all sections to the value specified
   159#REPLACE PE_TITLESECTION       1000 // Sets the value of the Title section to the value specified
   160#REPLACE PE_HEADERSECTION      2000 // Sets the value of the Page Header section to the value specified.
   161#REPLACE PE_GROUPHEADER        3000 // * Sets the value of the Group Header section to the value specified.
   162#REPLACE PE_DETAILSSECTION     4000 // Sets the value of the Details section to the value specified.
   163#REPLACE PE_GROUPFOOTER        5000 // * Sets the value of the Group Footer section to the value specified.
   164#REPLACE PE_GRANDTOTALSECTION  6000 // Sets the value of the Grand Total section to the value specified.
   165#REPLACE PE_FOOTERSECTION      7000 // Sets the value of the Page Footer section to the value specified.
   166#REPLACE PE_SUMMARYSECTION     8000 // Sets the value of the Summary section to the value specified.
   167
   168// PESetMargins constants
   169#REPLACE PE_SM_DEFAULT |CI$8000
   170
   171// PESetLineHeight constants
   172#REPLACE PE_ALLLINES  -1
   173
   174// PETabelType constants
   175#REPLACE PE_DT_STANDARD 1
   176#REPLACE PE_DT_SQL      2
   177
   178// PEGetGraphType constants
   179#REPLACE PE_SIDE_BY_SIDE_BAR_GRAPH             0    // Side By Side bar graph
   180#REPLACE PE_STACKED_BAR_GRAPH                  2    // Stacked bar graph
   181#REPLACE PE_PERCENT_BAR_GRAPH                  3    // Percent bar graph
   182#REPLACE PE_FAKED_3D_SIDE_BY_SIDE_BAR_GRAPH    4    // 3D Side By Side bar graph
   183#REPLACE PE_FAKED_3D_STACKED_BAR_GRAPH         5    // 3D Stacked bar graph
   184#REPLACE PE_FAKED_3D_PERCENT_BAR_GRAPH         6    // 3D Percent bar graph
   185#REPLACE PE_PIE_GRAPH                          40   // Pie graph
   186#REPLACE PE_MULTIPLE_PIE_GRAPH                 42   // Multiple Pie graph
   187#REPLACE PE_PROPORTIONAL_MULTI_PIE_GRAPH       43   // Weighted Pie graph
   188#REPLACE PE_LINE_GRAPH                         80   // Line graph
   189#REPLACE PE_AREA_GRAPH                         120  // Area graph
   190#REPLACE PE_THREED_BAR_GRAPH                   160  // 3D bar graph
   191#REPLACE PE_USER_DEFINED_GRAPH                 500  // User Defined graph type
   192#REPLACE PE_UNKNOWN_TYPE_GRAPH                 1000 // Unknown graph type
   193
   194// PEGraphDataInfo constants
   195#REPLACE PE_GRAPH_ROWS_ONLY           0  // Use only row values in graph.
   196#REPLACE PE_GRAPH_COLS_ONLY           1  // Use only column values in graph.
   197#REPLACE PE_GRAPH_MIXED_ROW_COL       2  // Graph by row values, then by column values.
   198#REPLACE PE_GRAPH_MIXED_COL_ROW       3  // Graph by column values, then by row values.
   199#REPLACE PE_GRAPH_UNKNOWN_DIRECTION   20 // The direction of the graph is unknown.
   200#REPLACE PE_GRAPH_DATA_NULL_SELECTION -1
   201
   202// PESetFont constants
   203#REPLACE PE_FIELDS |CI$0001 // Sets the default font for all field values in the report section specified.
   204#REPLACE PE_TEXT   |CI$0002 // Sets the default font for all text in the report section specified.
   205
   206// PESetFont constants
   207#REPLACE PE_UNCHANGED -1
   208
   209// PEExportTo constants
   210#REPLACE UXFCrystalReportType  0 // WinQL
   211#REPLACE UXFDIFType            0 // Data Interchange Format
   212#REPLACE UXFRecordType         0 // Record style (column of values)
   213#REPLACE UXFRichTextFormatType 0 // Rich Text
   214#REPLACE UXFCommaSeparatedType 0 // Comma separated
   215#REPLACE UXFTabSeparatedType   1 // Tab separated
   216#REPLACE UXFCharSeparatedType  2 // Character separated
   217#REPLACE UXFTextType           0 // Text (ASCII)
   218#REPLACE UXFTabbedTextType     1 // Tab separated text
   219#REPLACE UXFLotusWksType       0 // Lotus 1-2-3 (WKS)
   220#REPLACE UXFLotusWk1Type       1 // Lotus 1-2-3 (WK1)
   221#REPLACE UXFLotusWk3Type       2 // Lotus 1-2-3 (WK3)
   222#REPLACE UXFWordWinType        0 // Word for Windows
   223#REPLACE UXFXls2Type           0 // Excel 2.1
   224#REPLACE UXFXls3Type           1 // Excel 3.0
   225#REPLACE UXFXls4Type           2 // Excel 4.0
   226#REPLACE UXFXls5Type           3 // Excel 5.0
   227#REPLACE UXDDiskType           0 // Disk File
   228#REPLACE UXDMAPIType           0 // E-Mail (MAPI)
   229// HTML support...
   230#REPLACE UXFHTML3Type          0 // Draft HTML 3.0 tags
   231#REPLACE UXFExplorer2Type      1 // Include MS Explorer 2.0 tags
   232#REPLACE UXFNetscape2Type      2 // Include Netscape 2.0 tags
   233#REPLACE UXFHTML32ExtType      1 // HTML 3.2 tags + bg color extensions
   234#REPLACE UXFHTML32StdType      2 // HTML 3.2 tags
   235
   236// FormatType constants
   237#REPLACE WQL_CrystalReportType  1
   238#REPLACE WQL_DIFType            2
   239#REPLACE WQL_WordWinType        3
   240#REPLACE WQL_RecordType         7
   241#REPLACE WQL_RichTextFormatType 8
   242#REPLACE WQL_CommaSeparatedType 9
   243#REPLACE WQL_TabSeparatedType   10
   244#REPLACE WQL_CharSeparatedType  11
   245#REPLACE WQL_TextType           12
   246#REPLACE WQL_TabbedTextType     13
   247#REPLACE WQL_LotusWksType       14
   248#REPLACE WQL_LotusWk1Type       15
   249#REPLACE WQL_LotusWk3Type       16
   250#REPLACE WQL_Xls2Type           17
   251#REPLACE WQL_Xls3Type           18
   252#REPLACE WQL_Xls4Type           19
   253#REPLACE WQL_Xls5Type           20
   254// HTML support...
   255#REPLACE WQL_HTML3Type          21
   256#REPLACE WQL_Explorer2Type      22
   257#REPLACE WQL_Netscape2Type      23
   258// Adobe Portable Document Format (PDF) support...
   259#REPLACE CRW_AcrobatType       100
   260
   261Define CRW_CrystalReportType  for WQL_CrystalReportType
   262Define CRW_DIFType            for WQL_DIFType
   263Define CRW_WordWinType        for WQL_WordWinType
   264Define CRW_RecordType         for WQL_RecordType
   265Define CRW_RichTextFormatType for WQL_RichTextFormatType
   266Define CRW_CommaSeparatedType for WQL_CommaSeparatedType
   267Define CRW_TabSeparatedType   for WQL_TabSeparatedType
   268Define CRW_CharSeparatedType  for WQL_CharSeparatedType
   269Define CRW_TextType           for WQL_TextType
   270Define CRW_TabbedTextType     for WQL_TabbedTextType
   271Define CRW_LotusWksType       for WQL_LotusWksType
   272Define CRW_LotusWk1Type       for WQL_LotusWk1Type
   273Define CRW_LotusWk3Type       for WQL_LotusWk3Type
   274Define CRW_Xls2Type           for WQL_Xls2Type
   275Define CRW_Xls3Type           for WQL_Xls3Type
   276Define CRW_Xls4Type           for WQL_Xls4Type
   277Define CRW_Xls5Type           for WQL_Xls5Type
   278Define CRW_HTML3Type          for WQL_HTML3Type
   279Define CRW_Explorer2Type      for WQL_Explorer2Type
   280Define CRW_Netscape2Type      for WQL_Netscape2Type
   281
   282// ************************************************************************** //
   283// **                                                                      ** //
   284// ** Structure definitions                                                ** //
   285// **                                                                      ** //
   286// ************************************************************************** //
   287
   288Type _DRIVER_INFO_2
   289  Field _DRIVER_INFO_2.cVersion As dWord       // 0
   290  Field _DRIVER_INFO_2.pName As Pointer        // 4
   291  Field _DRIVER_INFO_2.pEnvironment As Pointer // 8
   292  Field _DRIVER_INFO_2.pDriverPath As Pointer  // 12
   293  Field _DRIVER_INFO_2.pDataFile As Pointer    // 16
   294  Field _DRIVER_INFO_2.pConfigFile As Pointer  // 20
   295  Field _DRIVER_INFO_2.pFiller As Char 1024  // 20
   296End_Type // _DRIVER_INFO_2
   297
   298Type PEInteger
   299  Field PEInteger.integer As Word
   300End_type // PEInteger
   301
   302Type PETextStructure
   303  Field PETextStructure.textHandle As dWord
   304  Field PETextStructure.textLength As Integer
   305End_Type // PETextStructure
   306
   307// Used by PEOutputToFile
   308Type PECharSepFileOptions
   309  Field PECharSepFileOptions.StructSize As Word
   310  Field PECharSepFileOptions.UseReportNumberFmt As Word // bool
   311  Field PECharSepFileOptions.UseReportDateFormat As Word // bool
   312  Field PECharSepFileOptions.StringDelimiter As Char 1
   313  Field PECharSepFileOptions.FieldDelimiter As Char 17
   314End_Type // PECharSepFileOptions
   315
   316// Used by PEGetExportOptions and PEExportTo
   317Type PEExportOptions
   318  Field PEExportOptions.StructSize As Word
   319  Field PEExportOptions.formatDLLName As Char 64
   320  Field PEExportOptions.formatType As dWord
   321  Field PEExportOptions.formatOptions As Pointer
   322  Field PEExportOptions.destinationDLLName As Char 64
   323  Field PEExportOptions.destinationType As dWord
   324  Field PEExportOptions.destinationOptions As Pointer
   325  Field PEExportOptions.nFormatOptionsBytes As Word
   326  Field PEExportOptions.nDestinationOptionsBytes As Word
   327End_Type // PEExportOptions
   328
   329// Used by PEGetJobStatus
   330// Some more weird stuff:
   331// If you set the StructSize member of this structure to the actuall size of the
   332// structure, only the first four members are returned by CRPE. Adding 4 bytes to
   333// the StructSize member will correct this problem.
   334Type PEJobInfo
   335  Field PEJobInfo.StructSize As Word
   336  Field PEJobInfo.NumRecordsRead As dWord
   337  Field PEJobInfo.NumRecordsSelected As dWord
   338  Field PEJobInfo.NumRecordsPrinted As dWord
   339  Field PEJobInfo.DisplayPageN As Word
   340  Field PEJobInfo.LatestPageN As Word
   341  Field PEJobInfo.StartPageN As Word
   342  Field PEJobInfo.printEnded As Word
   343End_Type // PEJobInfo
   344
   345// Used by PEGetNthTableLogOnInfo, PESetNthTableLogOnInfo, PELogOnServer, and PELogOffServer
   346Type PELogOnInfo
   347  Field PELogOnInfo.StructSize As Word
   348  Field PELogOnInfo.ServerName As Char 128
   349  Field PELogOnInfo.DataBaseName As Char 128
   350  Field PELogOnInfo.UserID As Char 128
   351  Field PELogOnInfo.Password As Char 128
   352End_Type // PELogOnInfo
   353
   354// Used by PEOuputToFile
   355Type PEPrintFileOptions
   356  Field PEPrintFileOptions.StructSize As Word
   357  Field PEPrintFileOptions.UseReportNumberFmt As Word // bool
   358  Field PEPrintFileOptions.UseReportDateFormat As Word // bool
   359End_Type // PEPrintFileOptions
   360
   361// Used by PESetPrintOptions structure
   362Type PEPrintOptions
   363  Field PEPrintOptions.StructSize As Word
   364  Field PEPrintOptions.startPageN As Word // unsigned short
   365  Field PEPrintOptions.stopPageN As Word // unsigned short
   366  Field PEPrintOptions.nReportCopies As Word // unsigned short
   367  Field PEPrintOptions.collation As Word // unsigned short
   368End_Type // PEPrintOptions
   369
   370// Used by PESetSectionFormat
   371Type PESectionOptions
   372  Field PESectionOptions.StructSize As Word
   373  Field PESectionOptions.visible As Word // short
   374  Field PESectionOptions.NewPageBefore As Word // short
   375  Field PESectionOptions.NewPageAfter As Word // short
   376  Field PESectionOptions.KeepTogether As Word // short
   377  Field PESectionOptions.SuppressBlankLines As Word // short
   378  Field PESectionOptions.ResetPageNAfter As Word // short
   379  Field PESectionOptions.printAtBottomOfPage As Word // short
   380End_Type // PESectionOptions
   381
   382// Used by PEGetNthTableSessionInfo and PESetNthTableSessionInfo
   383Type PESessionInfo
   384  Field PESessionInfo.StructSize As Word
   385  Field PESessionInfo.UserID As Char 128
   386  Field PESessionInfo.Password As Char 128
   387  Field PESessionInfo.SessionHandle As dWord
   388End_Type // PESessionInfo
   389
   390// Used by PEGetNthTableLocation and PESetNthTableLocation
   391Type PETableLocation
   392  Field PETableLocation.StructSize As Word
   393  Field PETableLocation.Location As Char 256
   394End_Type // PETableLocation
   395
   396// Used by PEGetNthTableType
   397Type PETableType
   398  Field PETableType.StructSize As Word
   399  Field PETableType.DLLName As Char 64
   400  Field PETableType.DescriptiveName As Char 256
   401  Field PETableType.DBType As Word
   402End_Type // PETableType
   403
   404// Used by PEExportOptions structure
   405Type UXDDiskOptions
   406  Field UXDDiskOptions.StructSize As Word
   407  Field UXDDiskOptions.fileName As Char 256
   408End_Type // UXDDiskOptions
   409
   410// Used by PEExportOptions structure
   411Type UXDMAPIOptions
   412  Field UXDMAPIOptions.StructSize As Word
   413  Field UXDMAPIOptions.toList As Pointer
   414  Field UXDMAPIOptions.ccList As Pointer
   415  Field UXDMAPIOptions.subject As Pointer
   416  Field UXDMAPIOptions.message As Pointer
   417  Field UXDMAPIOptions.nRecipients As Word
   418  Field UXDMAPIOptions.recipients As Pointer
   419End_Type // UXDMAPIOptions
   420
   421// Used by PEExportOptions structure
   422Type UXDVIMOptions
   423  Field UXDVIMOptions.StructSize As Word
   424  Field UXDVIMOptions.toList As Pointer
   425  Field UXDVIMOptions.ccList As Pointer
   426  Field UXDVIMOptions.bccList As Pointer
   427  Field UXDVIMOptions.subject As Pointer
   428  Field UXDVIMOptions.message As Pointer
   429End_Type // UXDVIMOptions
   430
   431// HTML support...
   432Type UXFHTML3Options
   433  Field UXFHTML3Options.StructSize As Word
   434  Field UXFHTML3Options.fileName As Pointer
   435End_Type // UXFHTML3Options
   436
   437// Used by PEExportOptions structure
   438Type UXFCharSeparatedOptions
   439  Field UXFCharSeparatedOptions.StructSize As Word
   440  Field UXFCharSeparatedOptions.useReportNumberFormat As Word // bool
   441  Field UXFCharSeparatedOptions.useReportDateFormat As Word // bool
   442  Field UXFCharSeparatedOptions.stringDelimiter As Char 1
   443  Field UXFCharSeparatedOptions.fieldDelimiter As Char 17
   444End_Type // UXFCharSeparatedOptions
   445
   446// Used by PEExportOptions structure
   447Type UXFCommaTabSeparatedOptions
   448  Field UXFCommaTabSeparatedOptions.StructSize As Word
   449  Field UXFCommaTabSeparatedOptions.useReportNumberFormat As Word // bool
   450  Field UXFCommaTabSeparatedOptions.useReportDateFormat As Word // bool
   451End_Type // UXFCommaTabSeparatedOptions
   452
   453// Used by PEExportOptions structure
   454Type UXFDIFOptions
   455  Field UXFDIFOptions.StructSize As Word
   456  Field UXFDIFOptions.useReportNumberFormat As Word // bool
   457  Field UXFDIFOptions.useReportDateFormat As Word // bool
   458End_Type // UXFDIFOptions
   459
   460// Used by PEExportOptions structure
   461Type UXFRecordStyleOptions
   462  Field UXFRecordStyleOptions.StructSize As Word
   463  Field UXFRecordStyleOptions.useReportNumberFormat As Word // bool
   464  Field UXFRecordStyleOptions.useReportDateFormat As Word // bool
   465End_Type // UXFRecordStyleOptions
   466
   467// Used by PEGetGraphData and PESetGraphData
   468Type PEGraphDataInfo
   469  Field PEGraphDataInfo.StructSize As Word
   470  Field PEGraphDataInfo.rowGroupN As Word // short
   471  Field PEGraphDataInfo.colGroupN As Word // short
   472  Field PEGraphDataInfo.summarizedFieldN As Word // short
   473  Field PEGraphDataInfo.graphDirection As Word // short
   474End_Type // PEGraphDataInfo
   475
   476// Used by PEGetGraphOptions and PESetGraphOptions
   477Type PEGraphOptions
   478  Field PEGraphOptions.StructSize As Word
   479  Field PEGraphOptions.graphMaxValue As Char 8 // double
   480  Field PEGraphOptions.graphMinValue As Char 8 // double
   481  Field PEGraphOptions.showDataValue As dWord // bool
   482  Field PEGraphOptions.showGridLine As dWord // bool
   483  Field PEGraphOptions.verticalBars As dWord // bool
   484  Field PEGraphOptions.showLegend As dWord // bool
   485  Field PEGraphOptions.fontFaceName As Char 128
   486End_Type // PEGraphOptions
   487
   488// Used by PEGetGraphText and PESetGraphText
   489Type PEGraphTextInfo
   490  Field PEGraphTextInfo.StructSize As Word
   491  Field PEGraphTextInfo.graphTitle As Char 128 // PE_GRAPH_TEXT_LEN
   492  Field PEGraphTextInfo.graphSubTitle As Char 128 // PE_GRAPH_TEXT_LEN
   493  Field PEGraphTextInfo.graphFootNote As Char 128 // PE_GRAPH_TEXT_LEN
   494  Field PEGraphTextInfo.graphGroupsTitle As Char 128 // PE_GRAPH_TEXT_LEN
   495  Field PEGraphTextInfo.graphSeriesTitle As Char 128 // PE_GRAPH_TEXT_LEN
   496  Field PEGraphTextInfo.graphXAxisTitle As Char 128 // PE_GRAPH_TEXT_LEN
   497  Field PEGraphTextInfo.graphYAxisTitle As Char 128 // PE_GRAPH_TEXT_LEN
   498  Field PEGraphTextInfo.graphZAxisTitle As Char 128 // PE_GRAPH_TEXT_LEN
   499End_Type // PEGraphTextInfo
   500
   501
   502// ************************************************************************** //
   503// ** Printer Functions                                                    ** //
   504// ************************************************************************** //
   505
   506External_Function OpenPrinter "OpenPrinterA" WINSPOOL.DRV ;
   507  Pointer pPrinterName ;
   508  Pointer phPrinter ;
   509  Pointer pDefault ;
   510  Returns Integer
   511
   512External_Function GetPrinterDriver "GetPrinterDriverA" WINSPOOL.DRV ;
   513  Handle hPrinter ;
   514  Pointer pEnvironment ;
   515  dWord dLevel ;
   516  Pointer pDriverInfo ;
   517  dWord cbBuf ;
   518  Pointer pcbNeeded ;
   519  Returns Integer
   520
   521External_Function ClosePrinter "ClosePrinter" WINSPOOL.DRV ;
   522  Handle hPrinter ;
   523  Returns Integer
   524
   525// ************************************************************************** //
   526// ** Engine Management Functions                                          ** //
   527// ************************************************************************** //
   528
   529External_Function32 PEOpenEngine "PEOpenEngine" CRPE32.DLL ;
   530  Returns Integer
   531
   532External_Function32 PECloseEngine "PECloseEngine" CRPE32.DLL ;
   533  Returns Integer
   534
   535External_Function32 PECanCloseEngine "PECanCloseEngine" CRPE32.DLL ;
   536  Returns Integer
   537
   538External_Function32 PEGetVersion "PEGetVersion" CRPE32.DLL ;
   539  Integer versionRequested Returns Integer
   540
   541// ************************************************************************** //
   542// ** Data Management Functions                                            ** //
   543// ************************************************************************** //
   544
   545External_Function32 PEHasSavedData "PEHasSavedData" CRPE32.DLL ;
   546  Integer printJob Pointer hasSavedData Returns Integer
   547
   548External_Function32 PEDiscardSavedData "PEDiscardSavedData" CRPE32.DLL ;
   549  Integer printJob Returns Integer
   550
   551// ************************************************************************** //
   552// ** Print Job Management Functions                                       ** //
   553// ************************************************************************** //
   554
   555External_Function32 PEPrintReport "PEPrintReport" CRPE32.DLL ;
   556  String reportName Integer toPrnt Integer toW String WTitle ;
   557  Integer left Integer top Integer WWidth Integer WHeight ;
   558  Integer WStyle Handle prntW Returns Integer
   559
   560External_Function32 PEOpenPrintJob "PEOpenPrintJob" CRPE32.DLL ;
   561  String reportFilePath Returns Integer
   562
   563External_Function32 PEClosePrintJob "PEClosePrintJob" CRPE32.DLL ;
   564  Integer printJob Returns Integer
   565
   566External_Function32 PEStartPrintJob "PEStartPrintJob" CRPE32.DLL ;
   567  Integer printJob Integer waitUntilDone Returns Integer
   568
   569External_Function32 PEGetJobStatus "PEGetJobStatus" CRPE32.DLL ;
   570  Integer printJob Pointer jobInfo Returns Integer
   571
   572External_Function32 PECancelPrintJob "PECancelPrintJob" CRPE32.DLL ;
   573  Integer printJob Returns Integer
   574
   575External_Function32 PEIsPrintJobFinished "PEIsPrintJobFinished" CRPE32.DLL ;
   576  Integer printJob Returns Integer
   577
   578// ************************************************************************** //
   579// ** Print Window Management Functions                                    ** //
   580// ************************************************************************** //
   581
   582External_Function32 PEGetWindowHandle "PEGetWindowHandle" CRPE32.DLL ;
   583  Integer printJob Returns Handle
   584
   585External_Function32 PEPrintWindow "PEPrintWindow" CRPE32.DLL ;
   586  Integer printJob Integer waitUntilDone Returns Integer
   587
   588External_Function32 PECloseWindow "PECloseWindow" CRPE32.DLL ;
   589  Integer printJob Returns Integer
   590
   591// ************************************************************************** //
   592// ** Print Destination Functions                                          ** //
   593// ************************************************************************** //
   594
   595External_Function32 PESelectPrinter "PESelectPrinter" CRPE32.DLL ;
   596  Integer printJob String driverName String printerName ;
   597  String portName Pointer mode Returns Integer
   598
   599External_Function32 PEGetSelectedPrinter "PEGetSelectedPrinter" CRPE32.DLL ;
   600  Integer printJob Pointer drvHndl Pointer drvLen ;
   601  Pointer prntHndl Pointer prntLen Pointer portHndl ;
   602  Pointer portLen Pointer mode Returns Integer
   603
   604External_Function32 PEOutputToPrinter "PEOutputToPrinter" CRPE32.DLL ;
   605  Integer printJob Integer nCopies Returns Integer
   606
   607External_Function32 PEOutputToWindow "PEOutputToWindow" CRPE32.DLL ;
   608  Integer printJob String title Integer left Integer top Integer width ;
   609  Integer height Integer style Handle parentWindow Returns Integer
   610
   611External_Function32 PEGetExportOptions "PEGetExportOptions" CRPE32.DLL ;
   612  Integer printJob Pointer options Returns Integer
   613
   614External_Function32 PEExportTo "PEExportTo" CRPE32.DLL ;
   615  Integer printJob Pointer options Returns Integer
   616
   617External_Function32 PEExportPrintWindow "PEExportPrintWindow" CRPE32.DLL ;
   618  Integer printJob Integer toMail Integer waitUntilDone Returns Integer
   619
   620External_Function32 PEOutputToFile "PEOutputToFile" CRPE32.DLL ;
   621  Integer printJob String outputFilePath Integer type Pointer options ;
   622  Returns Integer
   623
   624// ************************************************************************** //
   625// ** Sorting Functions                                                    ** //
   626// ************************************************************************** //
   627
   628External_Function32 PEGetNSortFields "PEGetNSortFields" CRPE32.DLL ;
   629  Integer printJob Returns Integer
   630
   631External_Function32 PEGetNthSortField "PEGetNthSortField" CRPE32.DLL ;
   632  Integer printJob Integer sortFieldN Pointer nameHandle Pointer nameLength ;
   633  Pointer direction Returns Integer
   634
   635External_Function32 PESetNthSortField "PESetNthSortField" CRPE32.DLL ;
   636  Integer printJob Integer sortFieldN String name Integer direction ;
   637  Returns Integer
   638
   639External_Function32 PEDeleteNthSortField "PEDeleteNthSortField" CRPE32.DLL ;
   640  Integer printJob Integer sortFieldN Returns Integer
   641
   642External_Function32 PEGetNGroupSortFields "PEGetNGroupSortFields" CRPE32.DLL ;
   643  Integer printJob Returns Integer
   644
   645External_Function32 PEGetNthGroupSortField "PEGetNthGroupSortField" CRPE32.DLL ;
   646  Integer printJob Integer sortFieldN Pointer nameHandle Pointer nameLength ;
   647  Pointer direction Returns Integer
   648
   649External_Function32 PESetNthGroupSortField "PESetNthGroupSortField" CRPE32.DLL ;
   650  Integer printJob Integer sortFieldN String name Integer direction ;
   651  Returns Integer
   652
   653External_Function32 PEDeleteNthGroupSortField "PEDeleteNthGroupSortField" CRPE32.DLL ;
   654  Integer printJob Integer sortFieldN Returns Integer
   655
   656// ************************************************************************** //
   657// ** Formula Functions                                                    ** //
   658// ************************************************************************** //
   659
   660External_Function32 PEGetFormula "PEGetFormula" CRPE32.DLL ;
   661  Integer printJob String FormulaName Pointer textHandle ;
   662  Pointer textLength Returns Integer
   663
   664External_Function32 PESetFormula "PESetFormula" CRPE32.DLL ;
   665  Integer printJob String formulaName String formulaString ;
   666  Returns Integer
   667
   668External_Function32 PECheckFormula "PECheckFormula" CRPE32.DLL ;
   669  Integer printJob String formulaName Returns Integer
   670
   671External_Function32 PEGetNFormulas "PEGetNFormulas" CRPE32.DLL ;
   672  Integer printJob Returns Integer
   673
   674External_Function32 PEGetNthFormula "PEGetNthFormula" CRPE32.DLL ;
   675  Integer printJob Integer formulaN Pointer nameHandle ;
   676  Pointer nameLength Pointer textHandle Pointer textLength ;
   677  Returns Integer
   678
   679// ************************************************************************** //
   680// ** Selection Formula Functions                                          ** //
   681// ************************************************************************** //
   682
   683External_Function32 PEGetSelectionFormula "PEGetSelectionFormula" CRPE32.DLL ;
   684  Integer printJob Pointer textHandle Pointer textLength ;
   685  Returns Integer
   686
   687External_Function32 PESetSelectionFormula "PESetSelectionFormula" CRPE32.DLL ;
   688  Integer printJob String formulaString Returns Integer
   689
   690External_Function32 PECheckSelectionFormula "PECheckSelectionFormula" CRPE32.DLL ;
   691  Integer printJob Returns Integer
   692
   693External_Function32 PEGetGroupSelectionFormula "PEGetGroupSelectionFormula" CRPE32.DLL ;
   694  Integer printJob Pointer textHandle Pointer textLength ;
   695  Returns Integer
   696
   697External_Function32 PESetGroupSelectionFormula "PESetGroupSelectionFormula" CRPE32.DLL ;
   698  Integer printJob String formulaString Returns Integer
   699
   700External_Function32 PECheckGroupSelectionFormula "PECheckGroupSelectionFormula" CRPE32.DLL ;
   701  Integer printJob Returns Integer
   702
   703// ************************************************************************** //
   704// ** Server Management Functions                                          ** //
   705// ************************************************************************** //
   706
   707External_Function32 PELogOnServer "PELogOnServer" CRPE32.DLL ;
   708  String dllName Pointer logOnInfo Returns Integer
   709
   710External_Function32 PELogOffServer "PELogOffServer" CRPE32.DLL ;
   711  String dllName Pointer logOnInfo Returns Integer
   712
   713External_Function32 PEGetSQLQuery "PEGetSQLQuery" CRPE32.DLL ;
   714  Integer printJob Pointer textHandle Pointer textLength ;
   715  Returns Integer
   716
   717External_Function32 PESetSQLQuery "PESetSQLQuery" CRPE32.DLL ;
   718  Integer printJob String queryString Returns Integer
   719
   720External_Function32 PELogOnServerWithPrivateInfo "PELogOnServerWithPrivateInfo" CRPE32.DLL ;
   721  String dllName Pointer privateInfo Returns Integer
   722
   723// ************************************************************************** //
   724// ** Print Format Management Functions                                    ** //
   725// ************************************************************************** //
   726
   727External_Function32 PEGetReportTitle "PEGetReportTitle" CRPE32.DLL ;
   728  Integer printJob Pointer titleHandle Pointer titleLength ;
   729  Returns Integer
   730
   731External_Function32 PESetReportTitle "PESetReportTitle" CRPE32.DLL ;
   732  Integer printJob String title Returns Integer
   733
   734External_Function32 PEGetPrintOptions "PEGetPrintOptions" CRPE32.DLL ;
   735  Integer printJob Pointer options Returns Integer
   736
   737External_Function32 PESetPrintOptions "PESetPrintOptions" CRPE32.DLL ;
   738  Integer printJob Pointer options Returns Integer
   739
   740External_Function32 PEGetSectionFormat "PEGetSectionFormat" CRPE32.DLL ;
   741  Integer printJob Integer sectionCode Pointer options ;
   742  Returns Integer
   743
   744External_Function32 PESetSectionFormat "PESetSectionFormat" CRPE32.DLL ;
   745  Integer printJob Integer sectionCode Pointer options ;
   746  Returns Integer
   747
   748External_Function32 PEGetMargins "PEGetMargins" CRPE32.DLL ;
   749  Integer printJob Pointer left Pointer right ;
   750  Pointer top Pointer bottom Returns Integer
   751
   752External_Function32 PESetMargins "PESetMargins" CRPE32.DLL ;
   753  Integer printJob Integer left Integer right ;
   754  Integer top Integer bottom Returns Integer
   755
   756External_Function32 PEGetMinimumSectionHeight "PEGetMinimumSectionHeight" CRPE32.DLL ;
   757  Integer printJob Integer sectionCode Pointer minimumHeight ;
   758  Returns Integer
   759
   760External_Function32 PESetMinimumSectionHeight "PESetMinimumSectionHeight" CRPE32.DLL ;
   761  Integer printJob Integer sectionCode Integer minimumHeight ;
   762  Returns Integer
   763
   764External_Function32 PEGetLineHeight "PEGetLineHeight" CRPE32.DLL ;
   765  Integer printJob Integer sectionCode Integer lineN Pointer height ;
   766  Pointer ascent Returns Integer
   767
   768External_Function32 PESetLineHeight "PESetLineHeight" CRPE32.DLL ;
   769  Integer printJob Integer sectionCode Integer lineN Integer height ;
   770  Integer ascent Returns Integer
   771
   772External_Function32 PEGetNLinesInSection "PEGetNLinesInSection" CRPE32.DLL ;
   773  Integer printJob Integer sectionCode Returns Integer
   774
   775External_Function32 PESetFont "PESetFont" CRPE32.DLL ;
   776  Integer pJob Integer code Integer scp String face ;
   777  Integer fam Integer pitch Integer cSet Integer size ;
   778  Integer ital Integer undl Integer stck Integer wght ;
   779  Returns Integer
   780
   781External_Function32 PEGetNDetailCopies "PEGetNDetailCopies" CRPE32.DLL ;
   782  Integer printJob Pointer nDetailCopies Returns Integer
   783
   784External_Function32 PESetNDetailCopies "PESetNDetailCopies" CRPE32.DLL ;
   785  Integer printJob Integer nDetailCopies Returns Integer
   786
   787External_Function32 PEGetPrintDate "PEGetPrintDate" CRPE32.DLL ;
   788  Integer printJob Pointer year Pointer month Pointer day ;
   789  Returns Integer
   790
   791External_Function32 PESetPrintDate "PESetPrintDate" CRPE32.DLL ;
   792  Integer printJob Integer year Integer month Integer day ;
   793  Returns Integer
   794
   795// ************************************************************************** //
   796// ** Window Customization Functions                                       ** //
   797// ************************************************************************** //
   798
   799External_Function32 PEShowNextPage "PEShowNextPage" CRPE32.DLL ;
   800  Integer printJob Returns Integer
   801
   802External_Function32 PEShowFirstPage "PEShowFirstPage" CRPE32.DLL ;
   803  Integer printJob Returns Integer
   804
   805External_Function32 PEShowPreviousPage "PEShowPreviousPage" CRPE32.DLL ;
   806  Integer printJob Returns Integer
   807
   808External_Function32 PEShowLastPage "PEShowLastPage" CRPE32.DLL ;
   809  Integer printJob Returns Integer
   810
   811External_Function32 PEShowPrintControls "PEShowPrintControls" CRPE32.DLL ;
   812  Integer printJob Integer showPrintControls Returns Integer
   813
   814External_Function32 PEPrintControlsShowing "PEPrintControlsShowing" CRPE32.DLL ;
   815  Integer printJob Pointer controlsShowing Returns Integer
   816
   817External_Function32 PEZoomPreviewWindow "PEZoomPreviewWindow" CRPE32.DLL ;
   818  Integer printJob Integer level Returns Integer
   819
   820External_Function32 PENextPrintWindowMagnification "PENextPrintWindowMagnification" CRPE32.DLL ;
   821  Integer printJob Returns Integer
   822
   823// ************************************************************************** //
   824// ** Group Management Functions                                           ** //
   825// ************************************************************************** //
   826
   827External_Function32 PEGetNGroups "PEGetNGroups" CRPE32.DLL ;
   828  Integer printJob Returns Integer
   829
   830External_Function32 PEGetGroupCondition "PEGetGroupCondition" CRPE32.DLL ;
   831  Integer printJob Integer sectionCode Pointer conditionFieldHandle ;
   832  Pointer conditionFieldLength Pointer condition ;
   833  Pointer sortDir Returns Integer
   834
   835External_Function32 PESetGroupCondition "PESetGroupCondition" CRPE32.DLL ;
   836  Integer printJob Integer sectionCode String conditionField Integer condition ;
   837  Integer sortDirection Returns Integer
   838
   839// ************************************************************************** //
   840// ** Table Management Functions                                           ** //
   841// ************************************************************************** //
   842
   843External_Function32 PEGetNTables "PEGetNTables" CRPE32.DLL ;
   844  Integer printJob Returns Integer
   845
   846External_Function32 PEGetNthTableType "PEGetNthTableType" CRPE32.DLL ;
   847  Integer printJob Integer tableN Pointer tableType Returns Integer
   848
   849External_Function32 PEGetNthTableLogOnInfo "PEGetNthTableLogOnInfo" CRPE32.DLL ;
   850  Integer printJob Integer tableN Pointer logOnInfo Returns Integer
   851
   852External_Function32 PESetNthTableLogOnInfo "PESetNthTableLogOnInfo" CRPE32.DLL ;
   853  Integer printJob Integer tableN Pointer logOnInfo ;
   854  Integer propagateAcrossTables Returns Integer
   855
   856External_Function32 PEGetNthTableLocation "PEGetNthTableLocation" CRPE32.DLL ;
   857  Integer printJob Integer tableN Pointer location Returns Integer
   858
   859External_Function32 PESetNthTableLocation "PESetNthTableLocation" CRPE32.DLL ;
   860  Integer printJob Integer tableN Pointer location Returns Integer
   861
   862External_Function32 PETestNthTableConnectivity "PETestNthTableConnectivity" CRPE32.DLL ;
   863  Integer printJob Integer tableN Returns Integer
   864
   865External_Function32 PEGetNthTableSessionInfo "PEGetNthTableSessionInfo" CRPE32.DLL ;
   866  Integer printJob Integer tableN Pointer sessionInfo Returns Integer
   867
   868External_Function32 PESetNthTableSessionInfo "PESetNthTableSessionInfo" CRPE32.DLL ;
   869  Integer printJob Integer tableN Pointer sessionInfo Integer propagateAcrossTables ;
   870  Returns Integer
   871
   872// ************************************************************************** //
   873// ** Graph/Chart Management Functions                                     ** //
   874// ************************************************************************** //
   875
   876External_Function32 PEGetGraphData "PEGetGraphData" CRPE32.DLL ;
   877  Integer printJob Integer sectionCode Integer graphN ;
   878  Pointer graphDataInfo Returns Integer
   879
   880External_Function32 PESetGraphData "PESetGraphData" CRPE32.DLL ;
   881  Integer printJob Integer sectionCode Integer graphN ;
   882  Pointer graphDataInfo Returns Integer
   883
   884External_Function32 PEGetGraphOptions "PEGetGraphOptions" CRPE32.DLL ;
   885  Integer printJob Integer sectionCode Integer graphN ;
   886  Pointer graphOptions Returns Integer
   887
   888External_Function32 PESetGraphOptions "PESetGraphOptions" CRPE32.DLL ;
   889  Integer printJob Integer sectionCode Integer graphN ;
   890  Pointer graphOptions Returns Integer
   891
   892External_Function32 PEGetGraphText "PEGetGraphText" CRPE32.DLL ;
   893  Integer printJob Integer sectionCode Integer graphN ;
   894  Pointer graphTextInfo Returns Integer
   895
   896External_Function32 PESetGraphText "PESetGraphText" CRPE32.DLL ;
   897  Integer printJob Integer sectionCode Integer graphN ;
   898  Pointer graphTextInfo Returns Integer
   899
   900External_Function32 PEGetGraphType "PEGetGraphType" CRPE32.DLL ;
   901  Integer printJob Integer sectionCode Integer graphN ;
   902  Pointer graphType Returns Integer
   903
   904External_Function32 PESetGraphType "PESetGraphType" CRPE32.DLL ;
   905  Integer printJob Integer sectionCode Integer graphN ;
   906  Integer graphType Returns Integer
   907
   908// ************************************************************************** //
   909// ** Stored Procedure Management Functions                                ** //
   910// ************************************************************************** //
   911
   912External_Function32 PEGetNParams "PEGetNParams" CRPE32.DLL ;
   913  Integer printJob Returns Integer
   914
   915External_Function32 PEGetNthParam "PEGetNthParam" CRPE32.DLL ;
   916  Integer printJob Integer paramN Pointer textHandle ;
   917  Pointer textLength Returns Integer
   918
   919External_Function32 PESetNthParam "PESetNthParam" CRPE32.DLL ;
   920  Integer printJob Integer paramN String szParamValue ;
   921  Returns Integer
   922
   923// ************************************************************************** //
   924// ** Error Management Functions                                           ** //
   925// ************************************************************************** //
   926
   927External_Function32 PEGetErrorCode "PEGetErrorCode" CRPE32.DLL ;
   928  Integer printJob Returns Integer
   929
   930External_Function32 PEGetErrorText "PEGetErrorText" CRPE32.DLL ;
   931  Integer printJob Pointer textHandle Pointer textLength ;
   932  Returns Integer
   933
   934// ************************************************************************** //
   935// ** Miscellaneous Functions                                              ** //
   936// ************************************************************************** //
   937
   938External_Function32 PEGetHandleString "PEGetHandleString" CRPE32.DLL ;
   939  Integer textHandle Pointer buffer Integer bufferLength ;
   940  Returns Integer
   941
   942// ************************************************************************** //
   943// **                                                                      ** //
   944// ** Class definition                                                     ** //
   945// **                                                                      ** //
   946// ************************************************************************** //
   947
   948// Crystal uses error numbers 500 thru 599 and 999
   949#REPLACE MIN_CRW_ERROR_NUM 500
   950#REPLACE MAX_CRW_ERROR_NUM 999
   951#REPLACE CRW_IGNORE_NUM 999
   952
   953
   954{ ClassLibrary=Windows }
   955{ HelpTopic=CrystalReport }
   956Class CrystalReport Is A cObject
   957
   958  Procedure Construct_Object
   959    Forward Send Construct_Object
   960
   961    // Added to support error trapping.
   962    Object WinQLErrors Is An Array
   963    End_Object // WinQLErrors
   964
   965    //Set Focus_Mode to No_Activate
   966    // Normal Interface property's
   967
   968    // Added to support preview window and status panel.
   969
   970    { Visibility=Private }
   971    Property Integer Private.PreviewWindow_Id 0
   972
   973    { Visibility=Private }
   974    Property Integer StatusPanel_Id 0
   975
   976    //*** BW Changed default value from CRW_PRINT_TO_WINDOW to PRINT_TO_UNDEDFINED
   977    { Visibility=Private }
   978    Property Integer Private.Output_Destination PRINT_TO_UNDEFINED
   979
   980    Property Integer Report_View_Id 0
   981    Property String Report_Data_Path ""
   982    Property String Report_Name ""
   983
   984    // OutputToWindow properties
   985    Property String WindowTitle ""
   986    Property Integer WindowLeftCoordinate 0
   987    Property Integer WindowTopCoordinate 0
   988    Property Integer WindowWidth 640
   989    Property Integer WindowHeight 480
   990    Property Integer WindowStyle 0
   991
   992    Property Handle ParentWindowHandle 0
   993
   994    // OutputToPrinter properties
   995    Property Integer Copies 1
   996
   997    { Visibility=Private }
   998    Property Boolean UsesEngine False
   999
  1000    // This property holds the handle to the print job.
  1001    { Visibility=Private }
  1002    Property Integer PrintJob 0
  1003
  1004    // This property reflects whether the last engine funtion generated an error.
  1005    Property Boolean FunctionGeneratedError_State False
  1006
  1007    // Should saved data be discarded
  1008    Property Boolean DiscardSavedData_State True
  1009
  1010    // The following properties are used for exporting reports
  1011    Property Integer ExportFormatType CRW_CrystalReportType
  1012    Property Boolean UseReportNumberFormat_State False
  1013    Property Boolean UseReportDateFormat_State False
  1014    Property String StringDelimiter "'"
  1015    Property String FieldDelimiter ";"
  1016    // ExportToDisk properties
  1017    Property String ExportFileName ""
  1018    // ExportToMAPI properties
  1019    Property String ToList ""
  1020    Property String CCList ""
  1021    Property String SubjectText ""
  1022    Property String MessageText ""
  1023    // HTML support...
  1024    Property String HTMLFileName ""
  1025
  1026    // These errors are ignored by default.
  1027    Send IgnoreError 545 // Request canceled by user
  1028    Send IgnoreError 542 // No next page
  1029    Send IgnoreError 543 // No previous page
  1030  End_Procedure // Construct_Object
  1031
  1032  // Trapped error support...
  1033  //
  1034  { Visibility=Private }
  1035  Function IsTrapped Integer iError Returns Integer
  1036    Integer iTrapped
  1037    If iError Eq CRW_IGNORE_NUM Function_Return True
  1038    If ((iError Lt MIN_CRW_ERROR_NUM) Or (iError Gt MAX_CRW_ERROR_NUM)) Begin
  1039      Error DFERR_CRYSTAL_REPORT C_$ErrorNumberOutOfRange
  1040      Function_Return 0
  1041    End // If ((iError Lt MIN_CRW_ERROR_NUM) Or (iError Gt MAX_CRW_ERROR_NUM)) Begin
  1042    Get Array_Value Of (WinQLErrors(self)) Item (iError-500) To iTrapped
  1043    Function_Return (Not(iTrapped))
  1044  End_Function // IsTrapped
  1045
  1046
  1047  { Visibility=Private }
  1048  Procedure IgnoreError Integer iError
  1049    If iError Eq CRW_IGNORE_NUM Procedure_Return // Error CRW_IGNORE_NUM is always ignored...
  1050    If ((iError Lt MIN_CRW_ERROR_NUM) Or (iError Gt MAX_CRW_ERROR_NUM)) Begin
  1051      Error DFERR_CRYSTAL_REPORT C_$ErrorNumberOutOfRange
  1052      Procedure_Return
  1053    End // If ((iError Lt MIN_CRW_ERROR_NUM) Or (iError Gt MAX_CRW_ERROR_NUM)) Begin
  1054    Set Array_Value Of (WinQLErrors(self)) Item (iError-500) To True
  1055  End_Procedure // AddError
  1056
  1057  { Visibility=Private }
  1058  Procedure TrapError Integer iError
  1059    If iError Eq CRW_IGNORE_NUM Procedure_Return // Error CRW_IGNORE_NUM is always ignored...
  1060    If ((iError Lt MIN_CRW_ERROR_NUM) Or (iError Gt MAX_CRW_ERROR_NUM)) Begin
  1061      Error DFERR_CRYSTAL_REPORT C_$ErrorNumberOutOfRange
  1062      Procedure_Return
  1063    End // If ((iError Lt MIN_CRW_ERROR_NUM) Or (iError Gt MAX_CRW_ERROR_NUM)) Begin
  1064    Set Array_Value Of (WinQLErrors(self)) Item (iError-500) To False
  1065  End_Procedure // TrapError
  1066
  1067  { Visibility=Private }
  1068  Procedure IgnoreAll
  1069    Integer iCounter
  1070    While iCounter Le 100
  1071      Set Array_Value Of (WinQLErrors(self)) Item iCounter To True
  1072      Increment iCounter
  1073    End // While iCounter Le 100
  1074  End_Procedure // IgnoreAll
  1075
  1076  { Visibility=Private }
  1077  Procedure Trapall
  1078    Integer iCounter
  1079    While iCounter Le 100
  1080      Set Array_Value Of (WinQLErrors(self)) Item iCounter To False
  1081      Increment iCounter
  1082    End // While iCounter Le 100
  1083  End_Procedure // TrapAll
  1084
  1085  // PreviewWindow support...
  1086
  1087  { MethodType=Property }
  1088  Procedure Set PreviewWindow_Id Integer iObject
  1089    Set WinQLReport_Id Of iObject To self
  1090    Set Private.PreviewWindow_Id To iObject
  1091  End_Procedure // Set PreviewWindow_Id
  1092
  1093  { MethodType=Property }
  1094  Function PreviewWindow_Id Returns Integer
  1095    Function_Return (Private.PreviewWindow_Id(self))
  1096  End_Function // PreviewWindow_Id
  1097
  1098  // *********************************************************************** //
  1099  // ** Hook procedure's                                                  ** //
  1100  // *********************************************************************** //
  1101
  1102  // This hook procedure is called after the print job has been opened.
  1103  //
  1104  { MethodType=Event }
  1105  Procedure OnInitializeReport
  1106  End_Procedure // OnInitializeReport
  1107
  1108  // This hook procedure is called just before a print job is closed.
  1109  //
  1110  { MethodType=Event }
  1111  Procedure OnDeInitializeReport
  1112  End_Procedure // OnDeInitializeReport
  1113
  1114  // This hook procedure is called just before a the print job is started.
  1115  //
  1116  { MethodType=Event }
  1117  Procedure OnStartPrinting
  1118  End_Procedure // OnStartPrinting
  1119
  1120  // This hook procedure is calledjust after a print job has finished.
  1121  //
  1122  { MethodType=Event }
  1123  Procedure OnStopPrinting
  1124  End_Procedure // OnStopPrinting
  1125
  1126  // *********************************************************************** //
  1127  // ** Engine Management Functions                                       ** //
  1128  // *********************************************************************** //
  1129
  1130  { Visibility=Private }
  1131  Procedure OpenEngine
  1132    Integer iResult
  1133    Move (PEOpenEngine()) To iResult
  1134    Send HandlePossibleError
  1135  End_Procedure // OpenEngine
  1136
  1137  { Visibility=Private }
  1138  Procedure CloseEngine
  1139    Integer iResult iVoid iCounter
  1140    // Make sure we can close the engine
  1141    Move (CanCloseEngine(self)) To iResult
  1142    While (Not(iResult))
  1143      Increment iCounter
  1144      If iCounter Gt 2000 Begin
  1145        // We've tried long enough
  1146        Error DFERR_CRYSTAL_REPORT C_$EngineTimeoutError
  1147        Set FunctionGeneratedError_State To True
  1148        Procedure_Return // Return without closing the engine.
  1149      End // If iCounter Gt 2000 Begin
  1150      Move (CanCloseEngine(self)) To iResult
  1151    End // While (Not(iResult))
  1152    Move (PECloseEngine()) To iVoid
  1153  End_Procedure // CloseEngine
  1154
  1155  { Visibility=Private }
  1156  Function CanCloseEngine Returns Integer
  1157    Integer iResult
  1158    Move (PECanCloseEngine()) To iResult
  1159    Send HandlePossibleError
  1160    Function_Return iResult
  1161  End_Function // CanCloseEngine
  1162
  1163  { MethodType=Property }
  1164  Function DLLVersion Returns Number
  1165    Integer iComplex iPower
  1166    Number nMinor nMajor nVersion
  1167    Move (PEGetVersion(PE_GV_DLL)) To iComplex
  1168    // Crystal 7 fix...
  1169    Move (Low(iComplex)) To iComplex
  1170    Send HandlePossibleError
  1171    Move (Number(iComplex iAnd 255)) To nMinor
  1172    Move (Number(iComplex / 256)) To nMajor
  1173    If nMinor Begin
  1174      Move (Log(nMinor)/Log(10)) To iPower
  1175      Move (10^(-(iPower+1))) To nVersion
  1176    End // If nMinor Begin
  1177    Else Move 0.0 To nVersion
  1178    Move (nMinor*nVersion) To nVersion
  1179    Move (nMajor+nVersion) To nVersion
  1180    Function_Return nVersion
  1181  End_Function // DLLVersion
  1182
  1183  { MethodType=Property }
  1184  Function EngineVersion Returns Number
  1185    Integer iResult iComplex iPower
  1186    Number nMinor nMajor nVersion
  1187    Move (PEGetVersion(PE_GV_ENGINE)) To iComplex
  1188    // Crystal 7 fix...
  1189    Move (Low(iComplex)) To iComplex
  1190    Send HandlePossibleError
  1191    Move (Number(iComplex iAnd 255)) To nMinor
  1192    Move (Number(iComplex / 256)) To nMajor
  1193    If nMinor Begin
  1194      Move (Log(nMinor)/Log(10)) To iPower
  1195      Move (10^(-(iPower+1))) To nVersion
  1196    End // If nMinor Begin
  1197    Else Move 0.0 To nVersion
  1198    Move (nMinor*nVersion) To nVersion
  1199    Move (nMajor+nVersion) To nVersion
  1200    Function_Return nVersion
  1201  End_Function // EngineVersion
  1202
  1203  // *********************************************************************** //
  1204  // ** Data Management Functions                                         ** //
  1205  // *********************************************************************** //
  1206
  1207  { MethodType=Property Visibility=Private }
  1208  Function HasSavedData Returns Integer
  1209    Integer iPrintJob iResult
  1210    Pointer pPEInteger
  1211    String sPEInteger
  1212    Get PrintJob To iPrintJob
  1213    FillType PEInteger With 0 To sPEInteger
  1214    GetAddress Of sPEInteger To pPEInteger
  1215    Move (PEHasSavedData(iPrintJob,pPEInteger)) To iResult
  1216    Send HandlePossibleError
  1217    GetBuff From sPEInteger At PEInteger.integer To iResult
  1218    Function_Return iResult
  1219  End_Function // HasSavedData
  1220
  1221  { Visibility=Private }
  1222  Procedure DiscardSavedData
  1223    Integer iPrintJob iResult
  1224    Get PrintJob To iPrintJob
  1225    Move (PEDiscardSavedData(iPrintJob)) To iResult
  1226    Send HandlePossibleError
  1227  End_Procedure // DiscardSavedData
  1228
  1229  // *********************************************************************** //
  1230  // ** Print Job Management Functions                                    ** //
  1231  // *********************************************************************** //
  1232
  1233  { Obsolete=True }
  1234  Procedure PrintReportToPrinter String sReportName
  1235    Integer iResult
  1236    Move (ToANSI(sReportName)) To sReportName
  1237    Move (PEPrintReport(sReportName,1,0,0,0,0,0,0,0,0)) To iResult
  1238    Send HandlePossibleError
  1239  End_Procedure // PrintReportToPrinter
  1240
  1241  { Obsolete=True }
  1242  Procedure PrintReportToWindow String sReportName String sTitle Integer iLeft ;
  1243    Integer iTop Integer iWidth Integer iHeight Integer iStyle Handle hParent
  1244    Integer iResult
  1245    Move (ToANSI(sReportName)) To sReportName
  1246    Move (ToANSI(sTitle)) To sTitle
  1247    Move (PEPrintReport(sReportName,0,1,sTitle,iLeft,iTop,iWidth,iHeight,iStyle,hParent)) To iResult
  1248    Send HandlePossibleError
  1249  End_Procedure // PrintReportToWindow
  1250
  1251  { Visibility=Private }
  1252  Procedure OpenPrintJob String sReportName
  1253    Integer iPrintJob
  1254    //Move sReportName To sReportName
  1255    Move (PEOpenPrintJob(sReportName)) To iPrintJob
  1256    // Crystal 7 fix...
  1257    Move (Low(iPrintJob)) To iPrintJob
  1258    Send HandlePossibleError
  1259    Set PrintJob To iPrintJob
  1260  End_Procedure // OpenPrintJob
  1261
  1262  { Visibility=Private }
  1263  Procedure ClosePrintJob
  1264    Integer iPrintJob iResult
  1265    Get PrintJob To iPrintJob
  1266    Move (PEClosePrintJob(iPrintJob)) To iResult
  1267    // If the function executed successfull, reset PrintJob
  1268    If iResult Set PrintJob To 0
  1269    Send HandlePossibleError
  1270  End_Procedure // ClosePrintJob
  1271
  1272  { Visibility=Private }
  1273  Procedure StartPrintJob // Integer iWaitUntilDone
  1274    Integer iPrintJob iResult iObject
  1275    Get PrintJob To iPrintJob
  1276    // note that the statuspanel logic is private (and unused). This could
  1277    // change in the future
  1278    // Check if there is a status object...
  1279    If (StatusPanel_Id(self)) Begin
  1280      Move (StatusPanel_Id(self)) To iObject
  1281// in case this pkg is used inside of a set of packages that does not support
  1282// the label property, we will exclude this from the code. Even if supported this
  1283// only works if the container object supports the label property.
  1284#IFDEF SET_LABEL
  1285  #IFDEF GET_LABEL
  1286      Set Label Of iObject To (Label(self))
  1287  #ENDIF
  1288#ENDIF
  1289      Send Popup To iObject
  1290    End // If (StatusPanel_Id(self)) Begin
  1291    Move (PEStartPrintJob(iPrintJob,True)) To iResult
  1292    Send HandlePossibleError
  1293    // Stop displaying status info...
  1294    If iObject Send Deactivate To (StatusPanel_Id(self))
  1295  End_Procedure // StartPrintJob
  1296
  1297  Function JobStatus Returns Integer
  1298    Integer iPrintJob iResult
  1299    String sPEJobInfo
  1300    Pointer pPEJobInfo
  1301    Get PrintJob To iPrintJob
  1302    FillType PEJobInfo With 0 To sPEJobInfo
  1303    Put PEJobInfo_Size To sPEJobInfo At PEJobInfo.StructSize
  1304    GetAddress Of sPEJobInfo To pPEJobInfo
  1305    Move (PEGetJobStatus(iPrintJob,pPEJobInfo)) To iResult
  1306    // Crystal 7 fix...
  1307    Move (Low(iResult)) To iResult
  1308    Send HandlePossibleError
  1309    Function_Return iResult
  1310  End_Function // JobStatus
  1311
  1312  { MethodType=Property }
  1313  Function NumRecordsRead Returns Integer
  1314    Integer iPrintJob iResult
  1315    String sPEJobInfo
  1316    Pointer pPEJobInfo
  1317    Get PrintJob To iPrintJob
  1318    FillType PEJobInfo With 0 To sPEJobInfo
  1319    // See PEJobInfo structure for comments...
  1320    Put (PEJobInfo_Size+4) To sPEJobInfo At PEJobInfo.StructSize
  1321    GetAddress Of sPEJobInfo To pPEJobInfo
  1322    Move (PEGetJobStatus(iPrintJob,pPEJobInfo)) To iResult
  1323    Send HandlePossibleError
  1324    GetBuff From sPEJobInfo At PEJobInfo.NumRecordsRead To iResult
  1325    Function_Return iResult
  1326  End_Function // NumRecordsRead
  1327
  1328  { MethodType=Property }
  1329  Function NumRecordsSelected Returns Integer
  1330    Integer iPrintJob iResult
  1331    String sPEJobInfo
  1332    Pointer pPEJobInfo
  1333    Get PrintJob To iPrintJob
  1334    FillType PEJobInfo With 0 To sPEJobInfo
  1335    // See PEJobInfo structure for comments...
  1336    Put (PEJobInfo_Size+4) To sPEJobInfo At PEJobInfo.StructSize
  1337    GetAddress Of sPEJobInfo To pPEJobInfo
  1338    Move (PEGetJobStatus(iPrintJob,pPEJobInfo)) To iResult
  1339    Send HandlePossibleError
  1340    GetBuff From sPEJobInfo At PEJobInfo.NumRecordsSelected To iResult
  1341    Function_Return iResult
  1342  End_Function // NumRecordsSelected
  1343
  1344  { MethodType=Property }
  1345  Function NumRecordsPrinted Returns Integer
  1346    Integer iPrintJob iResult
  1347    String sPEJobInfo
  1348    Pointer pPEJobInfo
  1349    Get PrintJob To iPrintJob
  1350    FillType PEJobInfo With 0 To sPEJobInfo
  1351    // See PEJobInfo structure for comments...
  1352    Put (PEJobInfo_Size+4) To sPEJobInfo At PEJobInfo.StructSize
  1353    GetAddress Of sPEJobInfo To pPEJobInfo
  1354    Move (PEGetJobStatus(iPrintJob,pPEJobInfo)) To iResult
  1355    Send HandlePossibleError
  1356    GetBuff From sPEJobInfo At PEJobInfo.NumRecordsPrinted To iResult
  1357    Function_Return iResult
  1358  End_Function // NumRecordsPrinted
  1359
  1360  { MethodType=Property }
  1361  Function DisplayPageN Returns Integer
  1362    Integer iPrintJob iResult
  1363    String sPEJobInfo
  1364    Pointer pPEJobInfo
  1365    Get PrintJob To iPrintJob
  1366    FillType PEJobInfo With 0 To sPEJobInfo
  1367    // See PEJobInfo structure for comments...
  1368    Put (PEJobInfo_Size+4) To sPEJobInfo At PEJobInfo.StructSize
  1369    GetAddress Of sPEJobInfo To pPEJobInfo
  1370    Move (PEGetJobStatus(iPrintJob,pPEJobInfo)) To iResult
  1371    Send HandlePossibleError
  1372    GetBuff From sPEJobInfo At PEJobInfo.DisplayPageN To iResult
  1373    Function_Return iResult
  1374  End_Function // DisplayPageN
  1375
  1376  { MethodType=Property }
  1377  Function LatestPageN Returns Integer
  1378    Integer iPrintJob iResult
  1379    String sPEJobInfo
  1380    Pointer pPEJobInfo
  1381    Get PrintJob To iPrintJob
  1382    FillType PEJobInfo With 0 To sPEJobInfo
  1383    // See PEJobInfo structure for comments...
  1384    Put (PEJobInfo_Size+4) To sPEJobInfo At PEJobInfo.StructSize
  1385    GetAddress Of sPEJobInfo To pPEJobInfo
  1386    Move (PEGetJobStatus(iPrintJob,pPEJobInfo)) To iResult
  1387    Send HandlePossibleError
  1388    GetBuff From sPEJobInfo At PEJobInfo.LatestPageN To iResult
  1389    Function_Return iResult
  1390  End_Function // LatestPageN
  1391
  1392  { MethodType=Property }
  1393  Function StartPageN Returns Integer
  1394    Integer iPrintJob iResult
  1395    String sPEJobInfo
  1396    Pointer pPEJobInfo
  1397    Get PrintJob To iPrintJob
  1398    FillType PEJobInfo With 0 To sPEJobInfo
  1399    // See PEJobInfo structure for comments...
  1400    Put (PEJobInfo_Size+4) To sPEJobInfo At PEJobInfo.StructSize
  1401    GetAddress Of sPEJobInfo To pPEJobInfo
  1402    Move (PEGetJobStatus(iPrintJob,pPEJobInfo)) To iResult
  1403    Send HandlePossibleError
  1404    GetBuff From sPEJobInfo At PEJobInfo.StartPageN To iResult
  1405    Function_Return iResult
  1406  End_Function // StartPageN
  1407
  1408  { MethodType=Property }
  1409  Function PrintEnded Returns Integer
  1410    Integer iPrintJob iResult
  1411    String sPEJobInfo
  1412    Pointer pPEJobInfo
  1413    Get PrintJob To iPrintJob
  1414    FillType PEJobInfo With 0 To sPEJobInfo
  1415    // See PEJobInfo structure for comments...
  1416    Put (PEJobInfo_Size+4) To sPEJobInfo At PEJobInfo.StructSize
  1417    GetAddress Of sPEJobInfo To pPEJobInfo
  1418    Move (PEGetJobStatus(iPrintJob,pPEJobInfo)) To iResult
  1419    Send HandlePossibleError
  1420    GetBuff From sPEJobInfo At PEJobInfo.printEnded To iResult
  1421    Function_Return iResult
  1422  End_Function // PrintEnded
  1423
  1424  Procedure CancelPrintJob
  1425    Integer iPrintJob iVoid
  1426    Get PrintJob To iPrintJob
  1427    Move (PECancelPrintJob(iPrintJob)) To iVoid
  1428    //Set PrintJob To 0
  1429    Send HandlePossibleError
  1430  End_Procedure // CancelPrintJob
  1431
  1432  { MethodType=Property }
  1433  Function IsPrintJobFinished Returns Integer
  1434    Integer iPrintJob iResult
  1435    Get PrintJob To iPrintJob
  1436    Move (PEIsPrintJobFinished(iPrintJob)) To iResult
  1437    Send HandlePossibleError
  1438    Function_Return iResult
  1439  End_Function // IsPrintJobFinished
  1440
  1441  // *********************************************************************** //
  1442  // ** Print Window Management Functions                                 ** //
  1443  // *********************************************************************** //
  1444
  1445    { MethodType=Property }
  1446    Function WindowHandle Returns Handle
  1447      Integer iPrintJob
  1448      Handle hResult
  1449      Get PrintJob To iPrintJob
  1450      Move (PEGetWindowHandle(iPrintJob)) To hResult
  1451      Send HandlePossibleError
  1452      Function_Return hResult
  1453    End_Function // WindowHandle
  1454
  1455    Procedure PrintWindow // Integer iWaitUntilDone
  1456      Integer iPrintJob iResult
  1457      Get PrintJob To iPrintJob
  1458      Move (PEPrintWindow(iPrintJob,True)) To iResult
  1459      Send HandlePossibleError
  1460    End_Procedure // PrintWindow
  1461
  1462    Procedure SelectAndPrintWindow
  1463      Integer iPrintJob iResult
  1464      Get PrintJob To iPrintJob
  1465      Get SelectAndSetPrinter To iResult
  1466      If iResult Move (PEPrintWindow(iPrintJob,True)) To iResult
  1467      Send HandlePossibleError
  1468    End_Procedure // SelectAndPrintWindow
  1469
  1470    Procedure CloseWindow
  1471      Integer iPrintJob iVoid
  1472      Get PrintJob To iPrintJob
  1473      Move (PECloseWindow(iPrintJob)) To iVoid
  1474      Send HandlePossibleError
  1475    End_Procedure // CloseWindow
  1476
  1477  // *********************************************************************** //
  1478  // ** Print Destination Functions                                       ** //
  1479  // *********************************************************************** //
  1480
  1481  { Visibility=Private }
  1482  Function PointerToString Pointer pString Returns String
  1483    String sCharacter sString
  1484    Pointer pCharacter
  1485    Integer iResult
  1486
  1487    // Create a single character buffer
  1488    Move (Character(0)) To sCharacter
  1489    GetAddress Of sCharacter To pCharacter
  1490
  1491    // Read characters until the null character
  1492    // WARNING: No overflow checking is performed
  1493    Move (CopyMemory(pCharacter,pString,1)) To iResult
  1494    While (Ascii(sCharacter) <> 0)
  1495      Append sString sCharacter
  1496      Increment pString
  1497      Move (CopyMemory(pCharacter,pString,1)) To iResult
  1498    Loop // While (Ascii(sCharacter) <> 0)
  1499    Function_Return sString
  1500  End_Function // PointerToString
  1501
  1502  { MethodType=Property Visibility=Private }
  1503  Function DriverName String sPrinterName Returns String
  1504    String sDriverInfo sDriverName
  1505    Handle hPrinter
  1506    Integer iResult iNeeded
  1507    Pointer pDriverPath
  1508
  1509    // Make sure AddressOf works!
  1510    Move 0 To hPrinter
  1511    Move 0 To iNeeded
  1512    Move sPrinterName To sPrinterName
  1513
  1514    // Open the printer
  1515    Move (OpenPrinter(AddressOf(sPrinterName),AddressOf(hPrinter),0)) To iResult
  1516    If (iResult = 0) Begin
  1517      Get ShowLastError To iResult
  1518      Function_Return ""
  1519    End // If (iResult = 0) Begin
  1520
  1521    // Get the driver info
  1522    ZeroType _DRIVER_INFO_2 To sDriverInfo
  1523    Move (GetPrinterDriver(hPrinter,0,2,AddressOf(sDriverInfo),_DRIVER_INFO_2_Size,AddressOf(iNeeded))) To iResult
  1524    If (iResult = 0) Begin
  1525      Get ShowLastError To iResult
  1526      Function_Return ""
  1527    End // If (iResult = 0) Begin
  1528
  1529    // Get the driver name and strip the path and extension
  1530    GetBuff From sDriverInfo at _DRIVER_INFO_2.pDriverPath To pDriverPath
  1531    Get PointerToString pDriverPath To sDriverName
  1532    While (Pos("\",sDriverName))
  1533      Move (Right(sDriverName,(Length(sDriverName)-Pos("\",sDriverName)))) To sDriverName
  1534    End // While (Pos("\",sDriver))
  1535    Move (Left(sDriverName,(Pos(".",sDriverName)-1))) To sDriverName
  1536
  1537    // Close the printer
  1538    Move (ClosePrinter(hPrinter)) To iResult
  1539    If (iResult = 0) Get ShowLastError To iResult
  1540
  1541    Function_Return sDriverName
  1542  End_Function // DriverName
  1543
  1544  { Visibility=Private }
  1545  Function SelectAndSetPrinter Returns Integer
  1546    String sDriver sDevice sPort
  1547    Integer iResult iPrintJob
  1548    Pointer pHeap
  1549
  1550    Get PrintJob To iPrintJob
  1551    Get PrintDialog Of (WinQLSelectPrinter(Self)) To iResult
  1552    If (iResult) Function_Return
  1553    Get DeviceName Of (WinQLSelectPrinter(Self)) To sDevice
  1554    Get OutputName Of (WinQLSelectPrinter(Self)) To sPort
  1555    Get DriverName sDevice To sDriver
  1556
  1557    If (Flags(WinQLSelectPrinter(Self)) iAnd PD_PAGENUMS) Begin
  1558      Set StartPageN To (FromPage(WinQLSelectPrinter(Self)))
  1559      Set StopPageN To (ToPage(WinQLSelectPrinter(Self)))
  1560    End // If (Flags(WinQLSelectPrinter(Self)) iAnd PD_PAGENUMS) Begin
  1561    Set NReportCopies To (Copies(WinQLSelectPrinter(Self)))
  1562    Set Collation To (Collate(WinQLSelectPrinter(Self)))
  1563
  1564    // Lock allocated memory
  1565    Move (GlobalLock(DevModeHandle(WinQLSelectPrinter(Self)))) To pHeap
  1566
  1567    Move (PESelectPrinter(iPrintJob,sDriver,sDevice,sPort,pHeap)) To iResult
  1568    Send HandlePossibleError
  1569
  1570    // Unlock allocated memory
  1571    Move (GlobalUnlock(DevModeHandle(WinQLSelectPrinter(Self)))) To iResult
  1572    Move (GlobalFree(DevModeHandle(WinQlSelectPrinter(Self)))) To iResult
  1573    Move (GlobalFree(DevNamesHandle(WinQLSelectPrinter(Self)))) To iResult
  1574
  1575    Function_Return True
  1576  End_Function // SelectAndSetPrinter
  1577
  1578  Procedure SelectAndSetPrinter
  1579    String sDriver sDevice sPort
  1580    Integer iResult iPrintJob
  1581    Pointer pHeap
  1582
  1583    Get PrintJob To iPrintJob
  1584    Get PrintDialog Of (WinQLSelectPrinter(Self)) To iResult
  1585    If (iResult) Procedure_Return
  1586    Get DeviceName Of (WinQLSelectPrinter(Self)) To sDevice
  1587    Get OutputName Of (WinQLSelectPrinter(Self)) To sPort
  1588    Get DriverName sDevice To sDriver
  1589
  1590    If (Flags(WinQLSelectPrinter(Self)) iAnd PD_PAGENUMS) Begin
  1591      Set StartPageN To (FromPage(WinQLSelectPrinter(Self)))
  1592      Set StopPageN To (ToPage(WinQLSelectPrinter(Self)))
  1593    End // If (Flags(WinQLSelectPrinter(Self)) iAnd PD_PAGENUMS) Begin
  1594    Set NReportCopies To (Copies(WinQLSelectPrinter(Self)))
  1595    Set Collation To (Collate(WinQLSelectPrinter(Self)))
  1596
  1597    // Lock allocated memory
  1598    Move (GlobalLock(DevModeHandle(WinQLSelectPrinter(Self)))) To pHeap
  1599
  1600    Move (PESelectPrinter(iPrintJob,sDriver,sDevice,sPort,pHeap)) To iResult
  1601    Send HandlePossibleError
  1602
  1603    // Unlock allocated memory
  1604    Move (GlobalUnlock(DevModeHandle(WinQLSelectPrinter(Self)))) To iResult
  1605    Move (GlobalFree(DevModeHandle(WinQlSelectPrinter(Self)))) To iResult
  1606    Move (GlobalFree(DevNamesHandle(WinQLSelectPrinter(Self)))) To iResult
  1607  End_Procedure // SelectAndSetPrinter
  1608
  1609  Procedure SelectPrinter String sDriver String sPrinter String sPort String sDEVMODE
  1610    Integer iPrintJob iResult
  1611    Pointer pDEVMODE
  1612    Get PrintJob To iPrintJob
  1613    //Move (ToANSI(sDriver+Character(0))) To sDriver
  1614    //Move (ToANSI(sPrinter+Character(0))) To sPrinter
  1615    //Move (ToANSI(sPort+Character(0))) To sPort
  1616    GetAddress Of sDEVMODE To pDEVMODE
  1617    Move (PESelectPrinter(iPrintJob,sDriver,sPrinter,sPort,pDEVMODE)) To iResult
  1618    Send HandlePossibleError
  1619  End_Procedure // SelectPrinter
  1620
  1621  { MethodType=Property }
  1622  Function PrinterDriver Returns String
  1623    Integer iPrintJob iResult iTextHandle iTextLength
  1624    String sDriver sPrinter sPort sDEVMODE sReturn
  1625    Pointer pDriver pPrinter pPort pDEVMODE pReturn
  1626    Get PrintJob To iPrintJob
  1627    FillType PETextStructure With 0 To sDriver
  1628    FillType PETextStructure With 0 To sPrinter
  1629    FillType PETextStructure With 0 To sPort
  1630    GetAddress Of sDriver To pDriver
  1631    GetAddress Of sPrinter To pPrinter
  1632    GetAddress Of sPort To pPort
  1633    FillType DevMode With 0 To sDEVMODE
  1634    GetAddress Of sDEVMODE To pDEVMODE
  1635    Move (PEGetSelectedPrinter(iPrintJob,pDriver,pDriver+4,pPrinter,pPrinter+4,pPort,pPort+4,pDEVMODE)) To iResult
  1636    Send HandlePossibleError
  1637    GetBuff From sDriver At PETextStructure.textHandle To iTextHandle
  1638    GetBuff From sDriver At PETextStructure.textLength To iTextLength
  1639    If iTextLength Gt 255 Move 255 To iTextLength
  1640    Move (Repeat(Character(0),255)) To sReturn
  1641    GetAddress Of sReturn To pReturn
  1642    Move (PEGetHandleString(iTextHandle,pReturn,iTextLength)) To iResult
  1643    Send HandlePossibleError
  1644    Function_Return (ToOEM(cString(sReturn)))
  1645  End_Function // PrinterDriver
  1646
  1647  { MethodType=Property }
  1648  Function PrinterName Returns String
  1649    Integer iPrintJob iResult iTextHandle iTextLength
  1650    String sDriver sPrinter sPort sDEVMODE sReturn
  1651    Pointer pDriver pPrinter pPort pDEVMODE pReturn
  1652    Get PrintJob To iPrintJob
  1653    FillType PETextStructure With 0 To sDriver
  1654    FillType PETextStructure With 0 To sPrinter
  1655    FillType PETextStructure With 0 To sPort
  1656    GetAddress Of sDriver To pDriver
  1657    GetAddress Of sPrinter To pPrinter
  1658    GetAddress Of sPort To pPort
  1659    FillType DevMode With 0 To sDEVMODE
  1660    GetAddress Of sDEVMODE To pDEVMODE
  1661    Move (PEGetSelectedPrinter(iPrintJob,pDriver,pDriver+4,pPrinter,pPrinter+4,pPort,pPort+4,pDEVMODE)) To iResult
  1662    Send HandlePossibleError
  1663    GetBuff From sPrinter At PETextStructure.textHandle To iTextHandle
  1664    GetBuff From sPrinter At PETextStructure.textLength To iTextLength
  1665    If iTextLength Gt 255 Move 255 To iTextLength
  1666    Move (Repeat(Character(0),255)) To sReturn
  1667    GetAddress Of sReturn To pReturn
  1668    Move (PEGetHandleString(iTextHandle,pReturn,iTextLength)) To iResult
  1669    Send HandlePossibleError
  1670    Function_Return (ToOEM(cString(sReturn)))
  1671  End_Function // PrinterName
  1672
  1673  { MethodType=Property }
  1674  Function PrinterPort Returns String
  1675    Integer iPrintJob iResult iTextHandle iTextLength
  1676    String sDriver sPrinter sPort sDEVMODE sReturn
  1677    Pointer pDriver pPrinter pPort pDEVMODE pReturn
  1678    Get PrintJob To iPrintJob
  1679    FillType PETextStructure With 0 To sDriver
  1680    FillType PETextStructure With 0 To sPrinter
  1681    FillType PETextStructure With 0 To sPort
  1682    GetAddress Of sDriver To pDriver
  1683    GetAddress Of sPrinter To pPrinter
  1684    GetAddress Of sPort To pPort
  1685    FillType DevMode With 0 To sDEVMODE
  1686    GetAddress Of sDEVMODE To pDEVMODE
  1687    Move (PEGetSelectedPrinter(iPrintJob,pDriver,pDriver+4,pPrinter,pPrinter+4,pPort,pPort+4,pDEVMODE)) To iResult
  1688    Send HandlePossibleError
  1689    GetBuff From sPort At PETextStructure.textHandle To iTextHandle
  1690    GetBuff From sPort At PETextStructure.textLength To iTextLength
  1691    If iTextLength Gt 255 Move 255 To iTextLength
  1692    Move (Repeat(Character(0),255)) To sReturn
  1693    GetAddress Of sReturn To pReturn
  1694    Move (PEGetHandleString(iTextHandle,pReturn,iTextLength)) To iResult
  1695    Send HandlePossibleError
  1696    Function_Return (ToOEM(cString(sReturn)))
  1697  End_Function // PrinterPort
  1698
  1699  Function PrinterDEVMODE Returns String
  1700    Integer iPrintJob iResult iTextHandle iTextLength
  1701    String sDriver sPrinter sPort sDEVMODE sReturn
  1702    Pointer pDriver pPrinter pPort pDEVMODE pReturn
  1703    Get PrintJob To iPrintJob
  1704    FillType PETextStructure With 0 To sDriver
  1705    FillType PETextStructure With 0 To sPrinter
  1706    FillType PETextStructure With 0 To sPort
  1707    GetAddress Of sDriver To pDriver
  1708    GetAddress Of sPrinter To pPrinter
  1709    GetAddress Of sPort To pPort
  1710    FillType DevMode With 0 To sDEVMODE
  1711    GetAddress Of sDEVMODE To pDEVMODE
  1712    Move (PEGetSelectedPrinter(iPrintJob,pDriver,pDriver+4,pPrinter,pPrinter+4,pPort,pPort+4,pDEVMODE)) To iResult
  1713    Send HandlePossibleError
  1714    Function_Return sDEVMODE
  1715  End_Function // PrinterDEVMODE
  1716
  1717  Procedure OutputToPrinter Integer iCopies
  1718    Integer iPrintJob iResult
  1719    Get PrintJob To iPrintJob
  1720    Move (PEOutputToPrinter(iPrintJob,iCopies)) To iResult
  1721    Send HandlePossibleError
  1722    Send StartPrintJob True
  1723  End_Procedure // OutputToPrinter
  1724
  1725  Procedure OutputToWindow String sTitle Integer iLeft Integer iTop Integer iWidth ;
  1726    Integer iHeight Integer iStyle Handle hParent
  1727    Integer iPrintJob iResult
  1728    Get PrintJob To iPrintJob
  1729    Move (ToANSI(sTitle+Character(0))) To sTitle
  1730    Move (PEOutputToWindow(iPrintJob,sTitle,iLeft,iTop,iWidth,iHeight,iStyle,hParent)) To iResult
  1731    Send HandlePossibleError
  1732    Send StartPrintJob True
  1733  End_Procedure // OutputToWindow
  1734
  1735  { MethodType=Property Visibility=Private }
  1736  Procedure Set ExportProperties String sFormatDLLName Integer iFormatType
  1737    If sFormatDLLName Eq "u2fcr" Set ExportFormatType To CRW_CrystalReportType
  1738    Else If sFormatDLLName Eq "u2fdif" Set ExportFormatType To CRW_DIFType
  1739    Else If sFormatDLLName Eq "u2fwordw" Set ExportFormatType To CRW_WordWinType
  1740    Else If sFormatDLLName Eq "u2frec" Set ExportFormatType To CRW_RecordType
  1741    Else If sFormatDLLName Eq "u2frtf" Set ExportFormatType To CRW_RichTextFormatType
  1742    Else If ((sFormatDLLName Eq "u2fsepv") And (iFormatType Eq 0)) Set ExportFormatType To CRW_CommaSeparatedType
  1743    Else If ((sFormatDLLName Eq "u2fsepv") And (iFormatType Eq 1)) Set ExportFormatType To CRW_TabSeparatedType
  1744    Else If ((sFormatDLLName Eq "u2fsepv") And (iFormatType Eq 2)) Set ExportFormatType To CRW_CharSeparatedType
  1745    Else If ((sFormatDLLName Eq "u2ftext") And (iFormatType Eq 0)) Set ExportFormatType To CRW_TextType
  1746    Else If ((sFormatDLLName Eq "u2ftext") And (iFormatType Eq 1)) Set ExportFormatType To CRW_TabbedTextType
  1747    Else If ((sFormatDLLName Eq "u2fwks") And (iFormatType Eq 0)) Set ExportFormatType To CRW_LotusWksType
  1748    Else If ((sFormatDLLName Eq "u2fwks") And (iFormatType Eq 1)) Set ExportFormatType To CRW_LotusWk1Type
  1749    Else If ((sFormatDLLName Eq "u2fwks") And (iFormatType Eq 2)) Set ExportFormatType To CRW_LotusWk3Type
  1750    Else If ((sFormatDLLName Eq "u2fxls") And (iFormatType Eq 0)) Set ExportFormatType To CRW_Xls2Type
  1751    Else If ((sFormatDLLName Eq "u2fxls") And (iFormatType Eq 1)) Set ExportFormatType To CRW_Xls3Type
  1752    Else If ((sFormatDLLName Eq "u2fxls") And (iFormatType Eq 2)) Set ExportFormatType To CRW_Xls4Type
  1753    Else If ((sFormatDLLName Eq "u2fxls") And (iFormatType Eq 3)) Set ExportFormatType To CRW_Xls5Type
  1754    //HTML support...
  1755    Else If ((sFormatDLLName Eq "u2fhtml") And (iFormatType Eq 0)) Set ExportFormatType To CRW_HTML3Type
  1756    Else If ((sFormatDLLName Eq "u2fhtml") And (iFormatType Eq 1)) Set ExportFormatType To CRW_Explorer2Type
  1757    Else If ((sFormatDLLName Eq "u2fhtml") And (iFormatType Eq 2)) Set ExportFormatType To CRW_Netscape2Type
  1758    // Adobe Portable Document Format (PDF) support...
  1759    Else If sFormatDLLName Eq "u2fpdf" Set ExportFormatType To CRW_AcrobatType
  1760  End_Procedure // Set ExportProperties
  1761
  1762  Function ExportOptions Returns Integer
  1763    Integer iPrintJob iResult iFormatType iLength iVoid
  1764    Pointer pPEExportOptions pFormatOptions pDestinationOptions pDestination
  1765    String sPEExportOptions sFormatDLLName sDestinationDLLName sDestination
  1766    Get PrintJob To iPrintJob
  1767    // Fill the PEExportOptions structure
  1768    FillType PEExportOptions With 0 To sPEExportOptions
  1769    GetAddress Of sPEExportOptions To pPEExportOptions
  1770    Put PEExportOptions_Size To sPEExportOptions At PEExportOptions.StructSize
  1771    Move (PEGetExportOptions(iPrintJob,pPEExportOptions)) To iResult
  1772    Send HandlePossibleError
  1773    // Retrieve the user's selections.
  1774    GetBuff_String From sPEExportOptions At PEExportOptions.formatDLLName To sFormatDLLName
  1775    // Just in case, the DLL names used now do NOT include any characters that need conversion but future versions might...
  1776    Move (ToOEM(sFormatDLLName)) To sFormatDLLName
  1777    GetBuff From sPEExportOptions At PEExportOptions.formatType To iFormatType
  1778    // Set the Export options properties.
  1779    Set ExportProperties To sFormatDLLName iFormatType
  1780    GetBuff_String From sPEExportOptions At PEExportOptions.destinationDLLName To sDestinationDLLName
  1781    // Just in case, the DLL names used now do NOT include any characters that need conversion but future versions might...
  1782    Move (ToOEM(sDestinationDLLName)) To sDestinationDLLName
  1783    If (LowerCase(sDestinationDLLName)) Eq "u2ddisk" Set Private.Output_Destination To CRW_PRINT_TO_FILE
  1784    Else Set Output_Destination To CRW_PRINT_TO_MAPI
  1785    GetBuff From sPEExportOptions At PEExportOptions.formatOptions To pFormatOptions
  1786    GetBuff From sPEExportOptions At PEExportOptions.nFormatOptionsBytes To iLength
  1787    Move (Repeat(Character(0),iLength)) To sDestination
  1788    GetAddress Of sDestination To pDestination
  1789    Move (CopyMemory(pDestination,pFormatOptions,iLength)) To iVoid
  1790    Set UseReportNumberFormat_State To (BytesToCVT(sDestination,3,2))
  1791    Set UseReportDateFormat_State To (BytesToCVT(sDestination,5,2))
  1792    Set StringDelimiter To (Mid(sDestination,1,7))
  1793    Set FieldDelimiter To (Mid(sDestination,16,8))
  1794    GetBuff From sPEExportOptions At PEExportOptions.destinationOptions To pDestinationOptions
  1795    GetBuff From sPEExportOptions At PEExportOptions.nDestinationOptionsBytes To iLength
  1796    Move (Repeat(Character(0),iLength)) To sDestination
  1797    GetAddress Of sDestination To pDestination
  1798    Move (CopyMemory(pDestination,pDestinationOptions,iLength)) To iVoid
  1799    If (Private.Output_Destination(self)) Eq CRW_PRINT_TO_FILE ;
  1800      Set ExportFileName To (Mid(sDestination,(iLength-2),3))
  1801    Else Begin
  1802      Move (Right(sDestination,(Length(sDestination)-4))) To sDestination
  1803      Set ToList To (Left(sDestination,(Pos(Character(0),sDestination))))
  1804      Move ((Right(sDestination,(Length(sDestination)-(Pos(Character(0),sDestination)))))) To sDestination
  1805      Set CCList To (Left(sDestination,(Pos(Character(0),sDestination))))
  1806      Move ((Right(sDestination,(Length(sDestination)-(Pos(Character(0),sDestination)))))) To sDestination
  1807      Set SubjectText To (Left(sDestination,(Pos(Character(0),sDestination))))
  1808      Move ((Right(sDestination,(Length(sDestination)-(Pos(Character(0),sDestination)))))) To sDestination
  1809      Set MessageText To (Left(sDestination,(Pos(Character(0),sDestination))))
  1810    End // Else Begin
  1811    Function_Return iResult
  1812  End_Function // ExportOptions
  1813
  1814  { Visibility=Private }
  1815  Function UXFCharSeparatedOptions Returns Pointer
  1816    Pointer pUXFCharSeparatedOptions pMemoryObject
  1817    String sUXFCharSeparatedOptions sStringDelimiter sFieldDelimiter
  1818    Integer iVoid
  1819    // Fill the UXFCharSeparatedOptions structure.
  1820    FillType UXFCharSeparatedOptions With 0 To sUXFCharSeparatedOptions
  1821    Put UXFCharSeparatedOptions_Size To sUXFCharSeparatedOptions At UXFCharSeparatedOptions.StructSize
  1822    Put (UseReportNumberFormat_State(self)) To sUXFCharSeparatedOptions At UXFCharSeparatedOptions.useReportNumberFormat
  1823    Put (UseReportDateFormat_State(self)) To sUXFCharSeparatedOptions At UXFCharSeparatedOptions.useReportDateFormat
  1824    Move (ToANSI(StringDelimiter(self))) To sStringDelimiter
  1825    Put sStringDelimiter To sUXFCharSeparatedOptions At UXFCharSeparatedOptions.stringDelimiter
  1826    Move (ToANSI(FieldDelimiter(self))) To sFieldDelimiter
  1827    Put_String sFieldDelimiter To sUXFCharSeparatedOptions At UXFCharSeparatedOptions.fieldDelimiter
  1828    GetAddress Of sUXFCharSeparatedOptions To pUXFCharSeparatedOptions
  1829    // Allocate a fixed memory object and initialize the contents to zero.
  1830    Move (GlobalAlloc((GMEM_FIXED iOr GMEM_ZEROINIT),UXFCharSeparatedOptions_Size)) To pMemoryObject
  1831    If Not pMemoryObject Begin
  1832      Error DFERR_CRYSTAL_REPORT C_$UnableToAllocateMemory
  1833      Function_Return False
  1834    End // If Not pMemoryObject Begin
  1835    Move (CopyMemory(pMemoryObject,pUXFCharSeparatedOptions,UXFCharSeparatedOptions_Size)) To iVoid
  1836    Function_Return pMemoryObject
  1837  End_Function // UXFCharSeparatedOptions
  1838
  1839  { Visibility=Private }
  1840  Function UXFCommaTabSeparatedOptions Returns Pointer
  1841    Pointer pUXFCommaTabSeparatedOptions pMemoryObject
  1842    String sUXFCommaTabSeparatedOptions
  1843    Integer iVoid
  1844    // Fill the UXFCommaTabSeparatedOptions structure.
  1845    FillType UXFCommaTabSeparatedOptions With 0 To sUXFCommaTabSeparatedOptions
  1846    Put UXFCommaTabSeparatedOptions_Size To sUXFCommaTabSeparatedOptions At UXFCommaTabSeparatedOptions.StructSize
  1847    Put (UseReportNumberFormat_State(self)) To sUXFCommaTabSeparatedOptions At UXFCommaTabSeparatedOptions.useReportNumberFormat
  1848    Put (UseReportDateFormat_State(self)) To sUXFCommaTabSeparatedOptions At UXFCommaTabSeparatedOptions.useReportDateFormat
  1849    GetAddress Of sUXFCommaTabSeparatedOptions To pUXFCommaTabSeparatedOptions
  1850    // Allocate a fixed memory object and initialize the contents to zero.
  1851    Move (GlobalAlloc((GMEM_FIXED iOr GMEM_ZEROINIT),UXFCommaTabSeparatedOptions_Size)) To pMemoryObject
  1852    If Not pMemoryObject Begin
  1853      Error DFERR_CRYSTAL_REPORT C_$UnableToAllocateMemory
  1854      Function_Return False
  1855    End // If Not pMemoryObject Begin
  1856    Move (CopyMemory(pMemoryObject,pUXFCommaTabSeparatedOptions,UXFCommaTabSeparatedOptions_Size)) To iVoid
  1857    Function_Return pMemoryObject
  1858  End_Function // UXFCommaTabSeparatedOptions
  1859
  1860  { Visibility=Private }
  1861  Function UXFDIFOptions Returns Pointer
  1862    Pointer pUXFDIFOptions pMemoryObject
  1863    String sUXFDIFOptions
  1864    Integer iVoid
  1865    // Fill the UXFDIFOptions structure.
  1866    FillType UXFDIFOptions With 0 To sUXFDIFOptions
  1867    Put UXFDIFOptions_Size To sUXFDIFOptions At UXFDIFOptions.StructSize
  1868    Put (UseReportNumberFormat_State(self)) To sUXFDIFOptions At UXFDIFOptions.useReportNumberFormat
  1869    Put (UseReportDateFormat_State(self)) To sUXFDIFOptions At UXFDIFOptions.useReportDateFormat
  1870    GetAddress Of sUXFDIFOptions To pUXFDIFOptions
  1871    // Allocate a fixed memory object and initialize the contents to zero.
  1872    Move (GlobalAlloc((GMEM_FIXED iOr GMEM_ZEROINIT),UXFDIFOptions_Size)) To pMemoryObject
  1873    If Not pMemoryObject Begin
  1874      Error DFERR_CRYSTAL_REPORT C_$UnableToAllocateMemory
  1875      Function_Return False
  1876    End // If Not pMemoryObject Begin
  1877    Move (CopyMemory(pMemoryObject,pUXFDIFOptions,UXFDIFOptions_Size)) To iVoid
  1878    Function_Return pMemoryObject
  1879  End_Function // UXFDIFOptions
  1880
  1881  { Visibility=Private }
  1882  Function UXFRecordStyleOptions Returns Pointer
  1883    Pointer pUXFRecordStyleOptions pMemoryObject
  1884    String sUXFRecordStyleOptions
  1885    Integer iVoid
  1886    // Fill the UXFRecordStyleOptions structure.
  1887    FillType UXFRecordStyleOptions With 0 To sUXFRecordStyleOptions
  1888    Put UXFRecordStyleOptions_Size To sUXFRecordStyleOptions At UXFRecordStyleOptions.StructSize
  1889    Put (UseReportNumberFormat_State(self)) To sUXFRecordStyleOptions At UXFRecordStyleOptions.useReportNumberFormat
  1890    Put (UseReportDateFormat_State(self)) To sUXFRecordStyleOptions At UXFRecordStyleOptions.useReportDateFormat
  1891    GetAddress Of sUXFRecordStyleOptions To pUXFRecordStyleOptions
  1892    // Allocate a fixed memory object and initialize the contents to zero.
  1893    Move (GlobalAlloc((GMEM_FIXED iOr GMEM_ZEROINIT),UXFRecordStyleOptions_Size)) To pMemoryObject
  1894    If Not pMemoryObject Begin
  1895      Error DFERR_CRYSTAL_REPORT C_$UnableToAllocateMemory
  1896      Function_Return False
  1897    End // If Not pMemoryObject Begin
  1898    Move (CopyMemory(pMemoryObject,pUXFRecordStyleOptions,UXFRecordStyleOptions_Size)) To iVoid
  1899    Function_Return pMemoryObject
  1900  End_Function // UXFRecordStyleOptions
  1901
  1902  // HTML support...
  1903  { Visibility=Private }
  1904  Function UXFHTML3Options Returns Pointer
  1905    Pointer pFileName pUXFHTML3Options
  1906    String sFileName sUXFHTML3Options
  1907    Handle hFileName hUXFHTML3Options
  1908    Integer iVoid
  1909    ZeroType UXFHTML3Options To sUXFHTML3Options
  1910    Move ((HTMLFileName(Self))+Character(0)) To sFileName
  1911    GetAddress Of sFileName To pFileName
  1912    Move (GlobalAlloc((GMEM_FIXED iOr GMEM_ZEROINIT),(Length(sFileName)))) To hFileName
  1913    If Not hFileName Begin
  1914      Error DFERR_CRYSTAL_REPORT C_$UnableToAllocateMemory
  1915      Function_Return False
  1916    End // If Not hFileName Begin
  1917    Move (CopyMemory(hFileName,pFileName,(Length(sFileName)))) To iVoid
  1918    Put UXFHTML3Options_Size To sUXFHTML3Options At UXFHTML3Options.StructSize
  1919    Put hFileName To sUXFHTML3Options At UXFHTML3Options.fileName
  1920    GetAddress Of sUXFHTML3Options To pUXFHTML3Options
  1921    // Allocate a fixed memory object and initialize the contents to zero.
  1922    Move (GlobalAlloc((GMEM_FIXED iOr GMEM_ZEROINIT),UXFHTML3Options_Size)) To hUXFHTML3Options
  1923    If Not hUXFHTML3Options Begin
  1924      Error DFERR_CRYSTAL_REPORT C_$UnableToAllocateMemory
  1925      Function_Return False
  1926    End // If Not hUXFHTML3Options Begin
  1927    Move (CopyMemory(hUXFHTML3Options,pUXFHTML3Options,UXFHTML3Options_Size)) To iVoid
  1928    Function_Return hUXFHTML3Options
  1929  End_Function // UXFHTML3Options
  1930
  1931  { Visibility=Private }
  1932  Function FormatDLLName Returns String
  1933    Integer iExportFormatType
  1934    Get ExportFormatType To iExportFormatType
  1935    If iExportFormatType Eq CRW_CrystalReportType Function_Return "u2fcr"
  1936    If iExportFormatType Eq CRW_DIFType Function_Return "u2fdif"
  1937    If iExportFormatType Eq CRW_WordWinType Function_Return "u2fwordw"
  1938    If iExportFormatType Eq CRW_RecordType Function_Return "u2frec"
  1939    If iExportFormatType Eq CRW_RichTextFormatType Function_Return "u2frtf"
  1940    If iExportFormatType Eq CRW_CommaSeparatedType Function_Return "u2fsepv"
  1941    If iExportFormatType Eq CRW_TabSeparatedType Function_Return "u2fsepv"
  1942    If iExportFormatType Eq CRW_CharSeparatedType Function_Return "u2fsepv"
  1943    If iExportFormatType Eq CRW_TextType Function_Return "u2ftext"
  1944    If iExportFormatType Eq CRW_TabbedTextType Function_Return "u2ftext"
  1945    If iExportFormatType Eq CRW_LotusWksType Function_Return "u2fwks"
  1946    If iExportFormatType Eq CRW_LotusWk1Type Function_Return "u2fwks"
  1947    If iExportFormatType Eq CRW_LotusWk3Type Function_Return "u2fwks"
  1948    If iExportFormatType Eq CRW_Xls2Type Function_Return "u2fxls"
  1949    If iExportFormatType Eq CRW_Xls3Type Function_Return "u2fxls"
  1950    If iExportFormatType Eq CRW_Xls4Type Function_Return "u2fxls"
  1951    If iExportFormatType Eq CRW_Xls5Type Function_Return "u2fxls"
  1952    // HTML support...
  1953    If iExportFormatType Eq CRW_HTML3Type Function_Return "u2fhtml"
  1954    If iExportFormatType Eq CRW_Explorer2Type Function_Return "u2fhtml"
  1955    If iExportFormatType Eq CRW_Netscape2Type Function_Return "u2fhtml"
  1956    // Adobe Portable Document Format (PDF) support...
  1957    If iExportFormatType Eq CRW_AcrobatType Function_Return "u2fpdf"
  1958    Function_Return "u2fcr" // Default value
  1959  End_Function // FormatDLLName
  1960
  1961  { Visibility=Private }
  1962  Function FormatType Returns Integer
  1963    Integer iExportFormatType
  1964    Get ExportFormatType To iExportFormatType
  1965    If iExportFormatType Eq CRW_CrystalReportType Function_Return 0
  1966    If iExportFormatType Eq CRW_DIFType Function_Return 0
  1967    If iExportFormatType Eq CRW_WordWinType Function_Return 0
  1968    If iExportFormatType Eq CRW_RecordType Function_Return 0
  1969    If iExportFormatType Eq CRW_RichTextFormatType Function_Return 0
  1970    If iExportFormatType Eq CRW_CommaSeparatedType Function_Return 0
  1971    If iExportFormatType Eq CRW_TabSeparatedType Function_Return 1
  1972    If iExportFormatType Eq CRW_CharSeparatedType Function_Return 2
  1973    If iExportFormatType Eq CRW_TextType Function_Return 0
  1974    If iExportFormatType Eq CRW_TabbedTextType Function_Return 1
  1975    If iExportFormatType Eq CRW_LotusWksType Function_Return 0
  1976    If iExportFormatType Eq CRW_LotusWk1Type Function_Return 1
  1977    If iExportFormatType Eq CRW_LotusWk3Type Function_Return 2
  1978    If iExportFormatType Eq CRW_Xls2Type Function_Return 0
  1979    If iExportFormatType Eq CRW_Xls3Type Function_Return 1
  1980    If iExportFormatType Eq CRW_Xls4Type Function_Return 2
  1981    If iExportFormatType Eq CRW_Xls5Type Function_Return 3
  1982    // HTML support...
  1983    If iExportFormatType Eq CRW_HTML3Type Function_Return 0
  1984    If iExportFormatType Eq CRW_Explorer2Type Function_Return 1
  1985    If iExportFormatType Eq CRW_Netscape2Type Function_Return 2
  1986    // Adobe Portable Document Format (PDF) support...
  1987    If iExportFormatType Eq CRW_AcrobatType Function_Return 0
  1988    Function_Return 0 // Default value
  1989  End_Function // FormatType
  1990
  1991  { Visibility=Private }
  1992  Function FormatOptions Returns Pointer
  1993    Integer iExportFormatType
  1994    Get ExportFormatType To iExportFormatType
  1995    If iExportFormatType Eq CRW_DIFType Function_Return (UXFDIFOptions(self))
  1996    If iExportFormatType Eq CRW_RecordType Function_Return (UXFRecordStyleOptions(self))
  1997    If iExportFormatType Eq CRW_CommaSeparatedType Function_Return (UXFCommaTabSeparatedOptions(self))
  1998    If iExportFormatType Eq CRW_TabSeparatedType Function_Return (UXFCommaTabSeparatedOptions(self))
  1999    If iExportFormatType Eq CRW_CharSeparatedType Function_Return (UXFCharSeparatedOptions(self))
  2000    // HTML support...
  2001    If iExportFormatType Eq CRW_HTML3Type Function_Return (UXFHTML3Options(self))
  2002    If iExportFormatType Eq CRW_Explorer2Type Function_Return (UXFHTML3Options(self))
  2003    If iExportFormatType Eq CRW_Netscape2Type Function_Return (UXFHTML3Options(self))
  2004    Function_Return 0 // Default value
  2005  End_Function // FormatOptions
  2006
  2007  { Visibility=Private }
  2008  Procedure ExportToDisk
  2009    Pointer pUXDDiskOptions pPEExportOptions pMemoryObject pFormatOptions
  2010    String sUXDDiskOptions sPEExportOptions sFileName
  2011    Integer iPrintJob iResult iVoid
  2012    Get PrintJob To iPrintJob
  2013    Move (LowerCase(ExportFileName(self))) To sFileName
  2014    Move (ToANSI(sFileName+Character(0))) To sFileName
  2015    Move (FormatOptions(self)) To pFormatOptions
  2016    // Fill the UXDDiskOptions structure.
  2017    FillType UXDDiskOptions With 0 To sUXDDiskOptions
  2018    Put (Length(sFileName)+7+32768) To sUXDDiskOptions At UXDDiskOptions.StructSize
  2019    Put_String sFileName To sUXDDiskOptions At UXDDiskOptions.fileName
  2020    GetAddress Of sUXDDiskOptions To pUXDDiskOptions
  2021    // Allocate a fixed memory object and initialize the contents to zero.
  2022    Move (GlobalAlloc((GMEM_FIXED iOr GMEM_ZEROINIT),(Length(sFileName)+7))) To pMemoryObject
  2023    If Not pMemoryObject Begin
  2024      Error DFERR_CRYSTAL_REPORT C_$UnableToAllocateMemory
  2025      Procedure_Return
  2026    End // If Not pMemoryObject Begin
  2027    Move (CopyMemory(pMemoryObject,pUXDDiskOptions,(Length(sFileName)+7))) To iVoid
  2028    // Fill the PEExportOptions structure.
  2029    FillType PEExportOptions With 0 To sPEExportOptions
  2030    Put PEExportOptions_Size To sPEExportOptions At PEExportOptions.StructSize
  2031    Put_String (FormatDLLName(self)) To sPEExportOptions At PEExportOptions.formatDLLName
  2032    Put (FormatType(self)) To sPEExportOptions At PEExportOptions.formatType
  2033    Put pFormatOptions To sPEExportOptions At PEExportOptions.formatOptions
  2034    Put_String ("u2ddisk"+Character(0)) To sPEExportOptions At PEExportOptions.destinationDLLName
  2035    Put UXDDiskType To sPEExportOptions At PEExportOptions.destinationType
  2036    // 07-05-1999, fix for CRW_PRINT_TO_FILE without a ExportFileName...
  2037    If (Trim(ExportFileName(Self))<>"") Put pMemoryObject To sPEExportOptions At PEExportOptions.destinationOptions
  2038    Put 0 To sPEExportOptions At PEExportOptions.nDestinationOptionsBytes
  2039    GetAddress Of sPEExportOptions To pPEExportOptions
  2040    Move (PEExportTo(iPrintJob,pPEExportOptions)) To iResult
  2041    Send HandlePossibleError
  2042    // Start the actual export.
  2043    Send StartPrintJob True
  2044    // Free all memory objects used by this procedure.
  2045    Move (GlobalFree(pMemoryObject)) To iResult
  2046    If iResult Ne 0 Begin
  2047      Error DFERR_CRYSTAL_REPORT C_$UnableToFreeMemory
  2048      Procedure_Return
  2049    End // If iResult Ne 0 Begin
  2050    If pFormatOptions Begin
  2051      Move (GlobalFree(pFormatOptions)) To iResult
  2052      If iResult Ne 0 Begin
  2053        Error DFERR_CRYSTAL_REPORT C_$UnableToFreeMemory
  2054        Procedure_Return
  2055      End // If iResult Begin
  2056    End // If pFormatOptions Begin
  2057  End_Procedure // ExportToDisk
  2058
  2059  { Visibility=Private }
  2060  Procedure ExportToMAPI
  2061    Pointer pUXDMAPIOptions pPEExportOptions pMemoryObject pFormatOptions
  2062    String sUXDMAPIOptions sPEExportOptions sFormatDLLName
  2063    Integer iPrintJob iResult iVoid
  2064    Get PrintJob To iPrintJob
  2065    Move (FormatOptions(self)) To pFormatOptions
  2066    // Fill the UXDMAPIOptions structure.
  2067    Move (Character(1)+Character(0)+Character(24)+Character(0)) To sUXDMAPIOptions
  2068    Append sUXDMAPIOptions (ToList(self)+Character(0))
  2069    Append sUXDMAPIOptions (CCList(self)+Character(0))
  2070    Append sUXDMAPIOptions (SubjectText(self)+Character(0))
  2071    Append sUXDMAPIOptions (MessageText(self)+Character(0))
  2072    Append sUXDMAPIOptions (Repeat(Character(0),6))
  2073    GetAddress Of sUXDMAPIOptions To pUXDMAPIOptions
  2074    // Allocate a fixed memory object and initialize the contents to zero.
  2075    Move (GlobalAlloc((GMEM_FIXED iOr GMEM_ZEROINIT),(Length(sUXDMAPIOptions)))) To pMemoryObject
  2076    If Not pMemoryObject Begin
  2077      Error DFERR_CRYSTAL_REPORT C_$UnableToAllocateMemory
  2078      Procedure_Return
  2079    End // If Not pMemoryObject Begin
  2080    Move (CopyMemory(pMemoryObject,pUXDMAPIOptions,(Length(sUXDMAPIOptions)))) To iVoid
  2081    // Fill the PEExportOptions structure.
  2082    FillType PEExportOptions With 0 To sPEExportOptions
  2083    Put PEExportOptions_Size To sPEExportOptions At PEExportOptions.StructSize
  2084    Put_String (FormatDLLName(self)) To sPEExportOptions At PEExportOptions.formatDLLName
  2085    Put (FormatType(self)) To sPEExportOptions At PEExportOptions.formatType
  2086    Put pFormatOptions To sPEExportOptions At PEExportOptions.formatOptions
  2087    Put_String ("u2dmapi"+Character(0)) To sPEExportOptions At PEExportOptions.destinationDLLName
  2088    Put UXDMAPIType To sPEExportOptions At PEExportOptions.destinationType
  2089    If (ToList(self)) Gt "" Put pMemoryObject To sPEExportOptions At PEExportOptions.destinationOptions
  2090    Put 0 To sPEExportOptions At PEExportOptions.nFormatOptionsBytes
  2091    Put 0 To sPEExportOptions At PEExportOptions.nDestinationOptionsBytes
  2092    GetAddress Of sPEExportOptions To pPEExportOptions
  2093    Move (PEExportTo(iPrintJob,pPEExportOptions)) To iResult
  2094    Send HandlePossibleError
  2095    // Start the actual export.
  2096    Send StartPrintJob True
  2097    // Free all memory objects used by this procedure.
  2098    Move (GlobalFree(pMemoryObject)) To iResult
  2099    If iResult Ne 0 Begin
  2100      Error DFERR_CRYSTAL_REPORT C_$UnableToFreeMemory
  2101      Procedure_Return
  2102    End // If iResult Ne 0 Begin
  2103    If pFormatOptions Begin
  2104      Move (GlobalFree(pFormatOptions)) To iResult
  2105      If iResult Ne 0 Begin
  2106        Error DFERR_CRYSTAL_REPORT C_$UnableToFreeMemory
  2107        Procedure_Return
  2108      End // If iResult Begin
  2109    End // If pFormatOptions Begin
  2110  End_Procedure // ExportToMAPI
  2111
  2112  Procedure ExportPrintWindow Integer iToMail // Integer iWaitUntilDone
  2113    Integer iPrintJob iResult
  2114    Get PrintJob To iPrintJob
  2115    Move (PEExportPrintWindow(iPrintJob,iToMail,True)) To iResult
  2116    Send HandlePossibleError
  2117  End_Procedure // ExportPrintWindow
  2118
  2119
  2120  Procedure ExportWindowToDisk
  2121    Integer iPrintJob iResult
  2122    Get PrintJob To iPrintJob
  2123    Move (PEExportPrintWindow(iPrintJob,False,True)) To iResult
  2124    Send HandlePossibleError
  2125  End_Procedure // ExportWindowToDisk
  2126
  2127  Procedure ExportWindowToMail
  2128    Integer iPrintJob iResult
  2129    Get PrintJob To iPrintJob
  2130    Move (PEExportPrintWindow(iPrintJob,True,True)) To iResult
  2131    Send HandlePossibleError
  2132  End_Procedure // ExportWindowToMail
  2133
  2134  // *********************************************************************** //
  2135  // ** Sorting Functions                                                 ** //
  2136  // *********************************************************************** //
  2137
  2138  { MethodType=Property }
  2139  Function NSortFields Returns Integer
  2140    Integer iPrintJob iResult
  2141    Get PrintJob To iPrintJob
  2142    Move (PEGetNSortFields(iPrintJob)) To iResult
  2143    // Crystal 7 fix...
  2144    Move (Low(iResult)) To iResult
  2145    Send HandlePossibleError
  2146    Function_Return iResult
  2147  End_Function // NSortFields
  2148
  2149  { MethodType=Property }
  2150  Function NthSortFieldName Integer iSortFieldN Returns String
  2151    Integer iPrintJob iResult iTextHandle iTextLength
  2152    String sPETextStructure sPEInteger sReturn
  2153    Pointer pPETextStructure pPEInteger pReturn
  2154    Get PrintJob To iPrintJob
  2155    FillType PETextStructure With 0 To sPETextStructure
  2156    GetAddress Of sPETextStructure To pPETextStructure
  2157    FillType PEInteger With 0 To sPEInteger
  2158    GetAddress Of sPEInteger To pPEInteger
  2159    Move (PEGetNthSortField(iPrintJob,iSortFieldN,pPETextStructure,pPETextStructure+4,pPEInteger)) To iResult
  2160    Send HandlePossibleError
  2161    GetBuff From sPETextStructure At PETextStructure.textHandle To iTextHandle
  2162    GetBuff From sPETextStructure At PETextStructure.textLength To iTextLength
  2163    If iTextLength Gt 255 Move 255 To iTextLength
  2164    Move (Repeat(Character(0),255)) To sReturn
  2165    GetAddress Of sReturn To pReturn
  2166    Move (PEGetHandleString(iTextHandle,pReturn,iTextLength)) To iResult
  2167    Send HandlePossibleError
  2168    Function_Return (ToOEM(cString(sReturn)))
  2169  End_Function // NthSortFieldName
  2170
  2171  { MethodType=Property }
  2172  Function NthSortFieldDirection Integer iSortFieldN Returns Integer
  2173    Integer iPrintJob iResult
  2174    String sPETextStructure sPEInteger
  2175    Pointer pPETextStructure pPEInteger
  2176    Get PrintJob To iPrintJob
  2177    FillType PETextStructure With 0 To sPETextStructure
  2178    GetAddress Of sPETextStructure To pPETextStructure
  2179    FillType PEInteger With 0 To sPEInteger
  2180    GetAddress Of sPEInteger To pPEInteger
  2181    Move (PEGetNthSortField(iPrintJob,iSortFieldN,pPETextStructure,pPETextStructure+4,pPEInteger)) To iResult
  2182    Send HandlePossibleError
  2183    GetBuff From sPEInteger At PEInteger.integer To iResult
  2184    Function_Return iResult
  2185  End_Function // NthSortFieldDirection
  2186
  2187  { MethodType=Property }
  2188  Procedure Set NthSortFieldName Integer iSortFieldN String sName
  2189    Integer iPrintJob iDirection iResult
  2190    If (NSortFields(self)-1) Ge iSortFieldN Begin
  2191      Get PrintJob To iPrintJob
  2192      Get NthSortFieldDirection iSortFieldN To iDirection
  2193      Move (ToANSI(sName+Character(0))) To sName
  2194      Move (PESetNthSortField(iPrintJob,iSortFieldN,sName,iDirection)) To iResult
  2195      Send HandlePossibleError
  2196    End // If (NSortFields(self)-1) Ge iSortFieldN Begin
  2197    Else Begin
  2198      Error DFERR_CRYSTAL_REPORT C_$InvalidFieldNumber
  2199      Set FunctionGeneratedError_State To True
  2200    End // Else Begin
  2201  End_Procedure // Set NthSortFieldName
  2202
  2203  { MethodType=Property }
  2204  Procedure Set NthSortFieldDirection Integer iSortFieldN Integer iDirection
  2205    Integer iPrintJob iResult
  2206    String sName
  2207    If (NSortFields(self)-1) Ge iSortFieldN Begin
  2208      Get PrintJob To iPrintJob
  2209      Get NthSortFieldName iSortFieldN To sName
  2210      Move (ToANSI(sName+Character(0))) To sName
  2211      Move (PESetNthSortField(iPrintJob,iSortFieldN,sName,iDirection)) To iResult
  2212      Send HandlePossibleError
  2213    End // If (NSortFields(self)-1) Ge iSortFieldN Begin
  2214    Else Begin
  2215      Error DFERR_CRYSTAL_REPORT C_$InvalidFieldNumber
  2216      Set FunctionGeneratedError_State To True
  2217    End // Else Begin
  2218  End_Procedure // Set NthSortFieldDirection
  2219
  2220  Procedure AddSortField String sName Integer iDirection
  2221    Integer iPrintJob iSortFieldN iResult
  2222    Get NSortFields To iSortFieldN
  2223    Get PrintJob To iPrintJob
  2224    Move (ToANSI(sName+Character(0))) To sName
  2225    Move (PESetNthSortField(iPrintJob,iSortFieldN,sName,iDirection)) To iResult
  2226    Send HandlePossibleError
  2227  End_Procedure // AddSortField
  2228
  2229  Procedure DeleteNthSortField Integer iSortFieldN
  2230    Integer iPrintJob iResult
  2231    Get PrintJob To iPrintJob
  2232    Move (PEDeleteNthSortField(iPrintJob,iSortFieldN)) To iResult
  2233    Send HandlePossibleError
  2234  End_Procedure // DeleteNthSortField
  2235
  2236  { MethodType=Property }
  2237  Function NGroupSortFields Returns Integer
  2238    Integer iPrintJob iResult
  2239    Get PrintJob To iPrintJob
  2240    Move (PEGetNGroupSortFields(iPrintJob)) To iResult
  2241    // Crystal 7 fix...
  2242    Move (Low(iResult)) To iResult
  2243    Send HandlePossibleError
  2244    Function_Return iResult
  2245  End_Function // NGroupSortFields
  2246
  2247  { MethodType=Property }
  2248  Function NthGroupSortFieldName Integer iSortFieldN Returns String
  2249    Integer iPrintJob iResult iTextHandle iTextLength
  2250    String sPETextStructure sPEInteger sReturn
  2251    Pointer pPETextStructure pPEInteger pReturn
  2252    Get PrintJob To iPrintJob
  2253    FillType PETextStructure With 0 To sPETextStructure
  2254    GetAddress Of sPETextStructure To pPETextStructure
  2255    FillType PEInteger With 0 To sPEInteger
  2256    GetAddress Of sPEInteger To pPEInteger
  2257    Move (PEGetNthGroupSortField(iPrintJob,iSortFieldN,pPETextStructure,pPETextStructure+4,pPEInteger)) To iResult
  2258    Send HandlePossibleError
  2259    GetBuff From sPETextStructure At PETextStructure.textHandle To iTextHandle
  2260    GetBuff From sPETextStructure At PETextStructure.textLength To iTextLength
  2261    If iTextLength Gt 255 Move 255 To iTextLength
  2262    Move (Repeat(Character(0),255)) To sReturn
  2263    GetAddress Of sReturn To pReturn
  2264    Move (PEGetHandleString(iTextHandle,pReturn,iTextLength)) To iResult
  2265    Send HandlePossibleError
  2266    Function_Return (ToOEM(cString(sReturn)))
  2267  End_Function // NthGroupSortFieldName
  2268
  2269  { MethodType=Property }
  2270  Function NthGroupSortFieldDirection Integer iSortFieldN Returns Integer
  2271    Integer iPrintJob iResult
  2272    String sPETextStructure sPEInteger
  2273    Pointer pPETextStructure pPEInteger
  2274    Get PrintJob To iPrintJob
  2275    FillType PETextStructure With 0 To sPETextStructure
  2276    GetAddress Of sPETextStructure To pPETextStructure
  2277    FillType PEInteger With 0 To sPEInteger
  2278    GetAddress Of sPEInteger To pPEInteger
  2279    Move (PEGetNthGroupSortField(iPrintJob,iSortFieldN,pPETextStructure,pPETextStructure+4,pPEInteger)) To iResult
  2280    Send HandlePossibleError
  2281    GetBuff From sPEInteger At PEInteger.integer To iResult
  2282    Function_Return iResult
  2283  End_Function // NthGroupSortFieldDirection
  2284
  2285  { MethodType=Property }
  2286  Procedure Set NthGroupSortFieldName Integer iSortFieldN String sName
  2287    Integer iPrintJob iDirection iResult
  2288    If (NGroupSortFields(self)-1) Ge iSortFieldN Begin
  2289      Get PrintJob To iPrintJob
  2290      Get NthGroupSortFieldDirection iSortFieldN To iDirection
  2291      Move (ToANSI(sName+Character(0))) To sName
  2292      Move (PESetNthGroupSortField(iPrintJob,iSortFieldN,sName,iDirection)) To iResult
  2293      Send HandlePossibleError
  2294    End // If (NSortFields(self)-1) Ge iSortFieldN Begin
  2295    Else Begin
  2296      Error DFERR_CRYSTAL_REPORT C_$InvalidFieldNumber
  2297      Set FunctionGeneratedError_State To True
  2298    End // Else Begin
  2299  End_Procedure // Set NthGroupSortFieldName
  2300
  2301  { MethodType=Property }
  2302  Procedure Set NthGroupSortFieldDirection Integer iSortFieldN Integer iDirection
  2303    Integer iPrintJob iResult
  2304    String sName
  2305    If (NGroupSortFields(self)-1) Ge iSortFieldN Begin
  2306      Get PrintJob To iPrintJob
  2307      Get NthGroupSortFieldName iSortFieldN To sName
  2308      Move (ToANSI(sName+Character(0))) To sName
  2309      Move (PESetNthGroupSortField(iPrintJob,iSortFieldN,sName,iDirection)) To iResult
  2310      Send HandlePossibleError
  2311    End // If (NSortFields(self)-1) Ge iSortFieldN Begin
  2312    Else Begin
  2313      Error DFERR_CRYSTAL_REPORT C_$InvalidFieldNumber
  2314      Set FunctionGeneratedError_State To True
  2315    End // Else Begin
  2316  End_Procedure // Set NthGroupSortFieldDirection
  2317
  2318  Procedure AddGroupSortField String sName Integer iDirection
  2319    Integer iPrintJob iSortFieldN iResult
  2320    Get NGroupSortFields To iSortFieldN
  2321    Get PrintJob To iPrintJob
  2322    Move (ToANSI(sName+Character(0))) To sName
  2323    Move (PESetNthGroupSortField(iPrintJob,iSortFieldN,sName,iDirection)) To iResult
  2324    Send HandlePossibleError
  2325  End_Procedure // AddGroupSortField
  2326
  2327  Procedure DeleteNthGroupSortField Integer iSortFieldN
  2328    Integer iPrintJob iResult
  2329    Get PrintJob To iPrintJob
  2330    Move (PEDeleteNthGroupSortField(iPrintJob,iSortFieldN)) To iResult
  2331    Send HandlePossibleError
  2332  End_Procedure // DeleteNthGroupSortField
  2333
  2334  // *********************************************************************** //
  2335  // ** Formula Functions                                                 ** //
  2336  // *********************************************************************** //
  2337
  2338  { MethodType=Property }
  2339  Function Formula String sFormulaName Returns String
  2340    Integer iPrintJob iResult iTextHandle iTextLength
  2341    Pointer pPETextStructure pReturn
  2342    String sPETextStructure sReturn
  2343    Get PrintJob To iPrintJob
  2344    Move (ToANSI(sFormulaName+Character(0))) To sFormulaName
  2345    FillType PETextStructure With 0 To sPETextStructure
  2346    GetAddress Of sPETextStructure To pPETextStructure
  2347    Move (PEGetFormula(iPrintJob,sFormulaName,pPETextStructure,pPETextStructure+4)) To iResult
  2348    Send HandlePossibleError
  2349    GetBuff From sPETextStructure At PETextStructure.textHandle To iTextHandle
  2350    GetBuff From sPETextStructure At PETextStructure.textLength To iTextLength
  2351    If iTextLength Gt 255 Move 255 To iTextLength
  2352    Move (Repeat(Character(0),255)) To sReturn
  2353    GetAddress Of sReturn To pReturn
  2354    Move (PEGetHandleString(iTextHandle,pReturn,iTextLength)) To iResult
  2355    Send HandlePossibleError
  2356    Function_Return (ToOEM(cString(sReturn)))
  2357  End_Function // Formula
  2358
  2359  { MethodType=Property }
  2360  Procedure Set Formula String sFormulaName String sFormulaText
  2361    Integer iPrintJob iResult
  2362    Pointer pFormulaName
  2363    Get PrintJob To iPrintJob
  2364    Move (ToANSI(sFormulaName+Character(0))) To sFormulaName
  2365    Move (ToANSI(sFormulaText+Character(0))) To sFormulaText
  2366    Move (PESetFormula(iPrintJob,sFormulaName,sFormulaText)) To iResult
  2367    Send HandlePossibleError
  2368  End_Procedure // Set Formula
  2369
  2370  Function CheckFormula String sFormulaName Returns Integer
  2371    Integer iPrintJob iResult
  2372    Get PrintJob To iPrintJob
  2373    Move (ToANSI(sFormulaName+Character(0))) To sFormulaName
  2374    Move (PECheckFormula(iPrintJob,sFormulaName)) To iResult
  2375    Send HandlePossibleError
  2376    Function_Return iResult
  2377  End_Function // CheckFormula
  2378
  2379  { MethodType=Property }
  2380  Function NFormulas Returns Integer
  2381    Integer iPrintJob iResult
  2382    Get PrintJob To iPrintJob
  2383    Move (PEGetNFormulas(iPrintJob)) To iResult
  2384    // Crystal 7 fix...
  2385    Move (Low(iResult)) To iResult
  2386    Send HandlePossibleError
  2387    Function_Return iResult
  2388  End_Function // NFormulas
  2389
  2390  { MethodType=Property }
  2391  Function NthFormulaName Integer iFormulaN Returns String
  2392    Integer iPrintJob iResult iTextHandle iTextLength
  2393    String sFormulaName sFormulaText sReturn
  2394    Pointer pFormulaName pFormulaText pReturn
  2395    Get PrintJob To iPrintJob
  2396    FillType PETextStructure With 0 To sFormulaName
  2397    FillType PETextStructure With 0 To sFormulaText
  2398    GetAddress Of sFormulaName To pFormulaName
  2399    GetAddress Of sFormulaText To pFormulaText
  2400    Move (PEGetNthFormula(iPrintJob,iFormulaN,pFormulaName,pFormulaName+4,pFormulaText,pFormulaText+4)) To iResult
  2401    Send HandlePossibleError
  2402    GetBuff From sFormulaName At PETextStructure.textHandle To iTextHandle
  2403    GetBuff From sFormulaName At PETextStructure.textLength To iTextLength
  2404    If iTextLength Gt 255 Move 255 To iTextLength
  2405    Move (Repeat(Character(0),255)) To sReturn
  2406    GetAddress Of sReturn To pReturn
  2407    Move (PEGetHandleString(iTextHandle,pReturn,iTextLength)) To iResult
  2408    Send HandlePossibleError
  2409    Function_Return (ToOEM(cString(sReturn)))
  2410  End_Function // NthFormulaName
  2411
  2412  { MethodType=Property }
  2413  Function NthFormulaText Integer iFormulaN Returns String
  2414    Integer iPrintJob iResult iTextHandle iTextLength
  2415    String sFormulaName sFormulaText sReturn
  2416    Pointer pFormulaName pFormulaText pReturn
  2417    Get PrintJob To iPrintJob
  2418    FillType PETextStructure With 0 To sFormulaName
  2419    FillType PETextStructure With 0 To sFormulaText
  2420    GetAddress Of sFormulaName To pFormulaName
  2421    GetAddress Of sFormulaText To pFormulaText
  2422    Move (PEGetNthFormula(iPrintJob,iFormulaN,pFormulaName,pFormulaName+4,pFormulaText,pFormulaText+4)) To iResult
  2423    Send HandlePossibleError
  2424    GetBuff From sFormulaText At PETextStructure.textHandle To iTextHandle
  2425    GetBuff From sFormulaText At PETextStructure.textLength To iTextLength
  2426    If iTextLength Gt 255 Move 255 To iTextLength
  2427    Move (Repeat(Character(0),255)) To sReturn
  2428    GetAddress Of sReturn To pReturn
  2429    Move (PEGetHandleString(iTextHandle,pReturn,iTextLength)) To iResult
  2430    Send HandlePossibleError
  2431    Function_Return (ToOEM(cString(sReturn)))
  2432  End_Function // NthFormulaText
  2433
  2434  // *********************************************************************** //
  2435  // ** Selection Formula Functions                                       ** //
  2436  // *********************************************************************** //
  2437
  2438  { MethodType=Property }
  2439  Function SelectionFormula Returns String
  2440    Integer iPrintJob iResult iTextHandle iTextLength
  2441    String sPETextStructure sReturn
  2442    Pointer pPETextStructure pReturn
  2443    Get PrintJob To iPrintJob
  2444    FillType PETextStructure With 0 To sPETextStructure
  2445    GetAddress Of sPETextStructure To pPETextStructure
  2446    Move (PEGetSelectionFormula(iPrintJob,pPETextStructure,pPETextStructure+4)) To iResult
  2447    Send HandlePossibleError
  2448    GetBuff From sPETextStructure At PETextStructure.textHandle To iTextHandle
  2449    GetBuff From sPETextStructure At PETextStructure.textLength To iTextLength
  2450    If iTextLength Gt 255 Move 255 To iTextLength
  2451    Move (Repeat(Character(0),255)) To sReturn
  2452    GetAddress Of sReturn To pReturn
  2453    Move (PEGetHandleString(iTextHandle,pReturn,iTextLength)) To iResult
  2454    Send HandlePossibleError
  2455    Function_Return (ToOEM(Replaces(Character(0),(cString(sReturn)),"")))
  2456  End_Function // SelectionFormula
  2457
  2458  { MethodType=Property }
  2459  Procedure Set SelectionFormula String sFormulaString
  2460    Integer iPrintJob iResult
  2461    Get PrintJob To iPrintJob
  2462    Move (ToANSI(sFormulaString+Character(0))) To sFormulaString
  2463    Move (PESetSelectionFormula(iPrintJob,sFormulaString)) To iResult
  2464    Send HandlePossibleError
  2465  End_Procedure // Set SelectionFormula
  2466
  2467  Function CheckSelectionFormula Returns Integer
  2468    Integer iPrintJob iResult
  2469    Get PrintJob To iPrintJob
  2470    Move (PECheckSelectionFormula(iPrintJob)) To iResult
  2471    Send HandlePossibleError
  2472    Function_Return iResult
  2473  End_Function // CheckSelectionFormula
  2474
  2475  { MethodType=Property }
  2476  Function GroupSelectionFormula Returns String
  2477    Integer iPrintJob iResult iTextHandle iTextLength
  2478    String sPETextStructure sReturn
  2479    Pointer pPETextStructure pReturn
  2480    Get PrintJob To iPrintJob
  2481    FillType PETextStructure With 0 To sPETextStructure
  2482    GetAddress Of sPETextStructure To pPETextStructure
  2483    Move (PEGetGroupSelectionFormula(iPrintJob,pPETextStructure,pPETextStructure+4)) To iResult
  2484    Send HandlePossibleError
  2485    GetBuff From sPETextStructure At PETextStructure.textHandle To iTextHandle
  2486    GetBuff From sPETextStructure At PETextStructure.textLength To iTextLength
  2487    If iTextLength Gt 255 Move 255 To iTextLength
  2488    Move (Repeat(Character(0),255)) To sReturn
  2489    GetAddress Of sReturn To pReturn
  2490    Move (PEGetHandleString(iTextHandle,pReturn,iTextLength)) To iResult
  2491    Send HandlePossibleError
  2492    Function_Return (ToOEM(cString(sReturn)))
  2493  End_Function // GroupSelectionFormula
  2494
  2495  { MethodType=Property }
  2496  Procedure Set GroupSelectionFormula String sFormulaString
  2497    Integer iPrintJob iResult
  2498    Get PrintJob To iPrintJob
  2499    Move (ToANSI(sFormulaString+Character(0))) To sFormulaString
  2500    Move (PESetGroupSelectionFormula(iPrintJob,sFormulaString)) To iResult
  2501    Send HandlePossibleError
  2502  End_Procedure // Set GroupSelectionFormula
  2503
  2504  Function CheckGroupSelectionFormula Returns Integer
  2505    Integer iPrintJob iResult
  2506    Get PrintJob To iPrintJob
  2507    Move (PECheckGroupSelectionFormula(iPrintJob)) To iResult
  2508    Send HandlePossibleError
  2509    Function_Return iResult
  2510  End_Function // CheckGroupSelectionFormula
  2511
  2512  // *********************************************************************** //
  2513  // ** Server Management Functions                                       ** //
  2514  // *********************************************************************** //
  2515
  2516  Procedure LogOnServer String sDLLName String sServerName String sDatabaseName String sUserID String sPassword
  2517    Integer iResult iOldLength
  2518    Pointer pPELogOnInfo
  2519    String sPELogOnInfo
  2520    Move (ToANSI(sDLLName+Character(0))) To sDLLName
  2521    Move (ToANSI(sServerName+Character(0))) To sServerName
  2522    Move (ToANSI(sDatabaseName+Character(0))) To sDatabaseName
  2523    Move (ToANSI(sUserID+Character(0))) To sUserID
  2524    Move (ToANSI(sPassword+Character(0))) To sPassword
  2525    FillType PELogOnInfo With 0 To sPELogOnInfo
  2526    Put PELogOnInfo_Size To sPELogOnInfo At PELogOnInfo.StructSize
  2527    Put_String sServerName To sPELogOnInfo At PELogOnInfo.ServerName
  2528    Put_String sDatabaseName To sPELogOnInfo At PELogOnInfo.DatabaseName
  2529    Put_String sUserID To sPELogOnInfo At PELogOnInfo.UserID
  2530    Put_String sPassword To sPELogOnInfo At PELogOnInfo.Password
  2531    GetAddress Of sPELogOnInfo To pPELogOnInfo
  2532    Move (PELogOnServer(sDLLName,pPELogOnInfo)) To iResult
  2533    Send HandlePossibleError
  2534  End_Procedure // LogOnServer
  2535
  2536  Procedure LogOffServer String sDLLName String sServerName String sDatabaseName String sUserID String sPassword
  2537    Integer iResult
  2538    String sPELogOnInfo
  2539    Pointer pPELogOnInfo
  2540    Move (ToANSI(sDLLName+Character(0))) To sDLLName
  2541    Move (ToANSI(sServerName+Character(0))) To sServerName
  2542    Move (ToANSI(sDatabaseName+Character(0))) To sDatabaseName
  2543    Move (ToANSI(sUserID+Character(0))) To sUserID
  2544    Move (ToANSI(sPassword+Character(0))) To sPassword
  2545    FillType PELogOnInfo With 0 To sPELogOnInfo
  2546    Put PELogOnInfo_Size To sPELogOnInfo At PELogOnInfo.StructSize
  2547    Put_String sServerName To sPELogOnInfo At PELogOnInfo.ServerName
  2548    Put_String sDatabaseName To sPELogOnInfo At PELogOnInfo.DatabaseName
  2549    Put_String sUserID To sPELogOnInfo At PELogOnInfo.UserID
  2550    Put_String sPassword To sPELogOnInfo At PELogOnInfo.Password
  2551    GetAddress Of sPELogOnInfo To pPELogOnInfo
  2552    Move (PELogOffServer(sDLLName,pPELogOnInfo)) To iResult
  2553    Send HandlePossibleError
  2554  End_Procedure // LogOffServer
  2555
  2556  { MethodType=Property }
  2557  Function SQLQuery Returns String
  2558    Integer iPrintJob iResult iTextHandle iTextLength iOldLength
  2559    String sPETextStructure
  2560    Pointer pPETextStructure pReturn
  2561    Get PrintJob To iPrintJob
  2562    FillType PETextStructure With 0 To sPETextStructure
  2563    GetAddress Of sPETextStructure To pPETextStructure
  2564    Move (PEGetSQLQuery(iPrintJob,pPETextStructure,pPETextStructure+4)) To iResult
  2565    Send HandlePossibleError
  2566    GetBuff From sPETextStructure At PETextStructure.textHandle To iTextHandle
  2567    GetBuff From sPETextStructure At PETextStructure.textLength To iTextLength
  2568    Get_Argument_Size To iOldLength
  2569    If iTextLength Gt iOldLength Set_Argument_Size iTextLength
  2570    String sReturn
  2571    Set_Argument_Size iOldLength
  2572    Move (Repeat(Character(0),iTextLength)) To sReturn
  2573    GetAddress Of sReturn To pReturn
  2574    Move (PEGetHandleString(iTextHandle,pReturn,iTextLength)) To iResult
  2575    Send HandlePossibleError
  2576    Function_Return (ToOEM(cString(sReturn)))
  2577  End_Function // SQLQuery
  2578
  2579  { MethodType=Property }
  2580  Procedure Set SQLQuery String sQueryString
  2581    Integer iPrintJob iResult
  2582    Get PrintJob To iPrintJob
  2583    Move (ToANSI(sQueryString+Character(0))) To sQueryString
  2584    Move (PESetSQLQuery(iPrintJob,sQueryString)) To iResult
  2585    Send HandlePossibleError
  2586  End_Procedure // Set SQLQuery
  2587
  2588  // *********************************************************************** //
  2589  // ** Print Format Management Functions                                 ** //
  2590  // *********************************************************************** //
  2591
  2592  { MethodType=Property }
  2593  Function ReportTitle Returns String
  2594    Integer iPrintJob iResult iTextHandle iTextLength
  2595    String sPETextStructure sReturn
  2596    Pointer pPETextStructure pReturn
  2597    Get PrintJob To iPrintJob
  2598    FillType PETextStructure With 0 To sPETextStructure
  2599    GetAddress Of sPETextStructure To pPETextStructure
  2600    Move (PEGetReportTitle(iPrintJob,pPETextStructure,pPETextStructure+4)) To iResult
  2601    Send HandlePossibleError
  2602    GetBuff From sPETextStructure At PETextStructure.textHandle To iTextHandle
  2603    GetBuff From sPETextStructure At PETextStructure.textLength To iTextLength
  2604    If iTextLength Gt 255 Move 255 To iTextLength
  2605    Move (Repeat(Character(0),255)) To sReturn
  2606    GetAddress Of sReturn To pReturn
  2607    Move (PEGetHandleString(iTextHandle,pReturn,iTextLength)) To iResult
  2608    Send HandlePossibleError
  2609    Function_Return (ToOEM(cString(sReturn)))
  2610  End_Function // ReportTitle
  2611
  2612  { MethodType=Property }
  2613  Procedure Set ReportTitle String sTitle
  2614    Integer iPrintJob iResult
  2615    Get PrintJob To iPrintJob
  2616    Move (ToANSI(sTitle+Character(0))) To sTitle
  2617    Move (PESetReportTitle(iPrintJob,sTitle)) To iResult
  2618    Send HandlePossibleError
  2619  End_Procedure // Set ReportTitle
  2620
  2621  { MethodType=Property }
  2622  Function StartPageN Returns Integer
  2623    Integer iPrintJob iResult
  2624    String sPEPrintOptions
  2625    Pointer pPEPrintOptions
  2626    Get PrintJob To iPrintJob
  2627    FillType PEPrintOptions With 0 To sPEPrintOptions
  2628    Put PEPrintOptions_Size To sPEPrintOptions At PEPrintOptions.StructSize
  2629    GetAddress Of sPEPrintOptions To pPEPrintOptions
  2630    Move (PEGetPrintOptions(iPrintJob,pPEPrintOptions)) To iResult
  2631    Send HandlePossibleError
  2632    GetBuff From sPEPrintOptions At PEPrintOptions.startPageN To iResult
  2633    Function_Return iResult
  2634  End_Function // StartPageN
  2635
  2636  { MethodType=Property }
  2637  Function StopPageN Returns Integer
  2638    Integer iPrintJob iResult
  2639    String sPEPrintOptions
  2640    Pointer pPEPrintOptions
  2641    Get PrintJob To iPrintJob
  2642    FillType PEPrintOptions With 0 To sPEPrintOptions
  2643    Put PEPrintOptions_Size To sPEPrintOptions At PEPrintOptions.StructSize
  2644    GetAddress Of sPEPrintOptions To pPEPrintOptions
  2645    Move (PEGetPrintOptions(iPrintJob,pPEPrintOptions)) To iResult
  2646    Send HandlePossibleError
  2647    GetBuff From sPEPrintOptions At PEPrintOptions.stopPageN To iResult
  2648    Function_Return iResult
  2649  End_Function // StopPageN
  2650
  2651  { MethodType=Property }
  2652  Function NReportCopies Returns Integer
  2653    Integer iPrintJob iResult
  2654    String sPEPrintOptions
  2655    Pointer pPEPrintOptions
  2656    Get PrintJob To iPrintJob
  2657    FillType PEPrintOptions With 0 To sPEPrintOptions
  2658    Put PEPrintOptions_Size To sPEPrintOptions At PEPrintOptions.StructSize
  2659    GetAddress Of sPEPrintOptions To pPEPrintOptions
  2660    Move (PEGetPrintOptions(iPrintJob,pPEPrintOptions)) To iResult
  2661    Send HandlePossibleError
  2662    GetBuff From sPEPrintOptions At PEPrintOptions.NReportCopies To iResult
  2663    Function_Return iResult
  2664  End_Function // NReportCopies
  2665
  2666  { MethodType=Property }
  2667  Function Collation Returns Integer
  2668    Integer iPrintJob iResult
  2669    String sPEPrintOptions
  2670    Pointer pPEPrintOptions
  2671    Get PrintJob To iPrintJob
  2672    FillType PEPrintOptions With 0 To sPEPrintOptions
  2673    Put PEPrintOptions_Size To sPEPrintOptions At PEPrintOptions.StructSize
  2674    GetAddress Of sPEPrintOptions To pPEPrintOptions
  2675    Move (PEGetPrintOptions(iPrintJob,pPEPrintOptions)) To iResult
  2676    Send HandlePossibleError
  2677    GetBuff From sPEPrintOptions At PEPrintOptions.collation To iResult
  2678    Function_Return iResult
  2679  End_Function // Collation
  2680
  2681  { MethodType=Property }
  2682  Procedure Set StartPageN Integer iStartPageN
  2683    Integer iPrintJob iResult
  2684    String sPEPrintOptions
  2685    Pointer pPEPrintOptions
  2686    Get PrintJob To iPrintJob
  2687    FillType PEPrintOptions With 0 To sPEPrintOptions
  2688    Put PEPrintOptions_Size To sPEPrintOptions At PEPrintOptions.StructSize
  2689    GetAddress Of sPEPrintOptions To pPEPrintOptions
  2690    Move (PEGetPrintOptions(iPrintJob,pPEPrintOptions)) To iResult
  2691    Send HandlePossibleError
  2692    Put iStartPageN To sPEPrintOptions At PEPrintOptions.startPageN
  2693    GetAddress Of sPEPrintOptions To pPEPrintOptions
  2694    Move (PESetPrintOptions(iPrintJob,pPEPrintOptions)) To iResult
  2695    Send HandlePossibleError
  2696  End_Procedure // Set StartPageN
  2697
  2698  { MethodType=Property }
  2699  Procedure Set StopPageN Integer iStopPageN
  2700    Integer iPrintJob iResult
  2701    String sPEPrintOptions
  2702    Pointer pPEPrintOptions
  2703    Get PrintJob To iPrintJob
  2704    FillType PEPrintOptions With 0 To sPEPrintOptions
  2705    Put PEPrintOptions_Size To sPEPrintOptions At PEPrintOptions.StructSize
  2706    GetAddress Of sPEPrintOptions To pPEPrintOptions
  2707    Move (PEGetPrintOptions(iPrintJob,pPEPrintOptions)) To iResult
  2708    Send HandlePossibleError
  2709    Put iStopPageN To sPEPrintOptions At PEPrintOptions.stopPageN
  2710    GetAddress Of sPEPrintOptions To pPEPrintOptions
  2711    Move (PESetPrintOptions(iPrintJob,pPEPrintOptions)) To iResult
  2712    Send HandlePossibleError
  2713  End_Procedure // Set StopPageN
  2714
  2715  { MethodType=Property }
  2716  Procedure Set NReportCopies Integer iNReportCopies
  2717    Integer iPrintJob iResult
  2718    String sPEPrintOptions
  2719    Pointer pPEPrintOptions
  2720    Get PrintJob To iPrintJob
  2721    FillType PEPrintOptions With 0 To sPEPrintOptions
  2722    Put PEPrintOptions_Size To sPEPrintOptions At PEPrintOptions.StructSize
  2723    GetAddress Of sPEPrintOptions To pPEPrintOptions
  2724    Move (PEGetPrintOptions(iPrintJob,pPEPrintOptions)) To iResult
  2725    Send HandlePossibleError
  2726    Put iNReportCopies To sPEPrintOptions At PEPrintOptions.nReportCopies
  2727    GetAddress Of sPEPrintOptions To pPEPrintOptions
  2728    Move (PESetPrintOptions(iPrintJob,pPEPrintOptions)) To iResult
  2729    Send HandlePossibleError
  2730  End_Procedure // Set NReportCopies
  2731
  2732  { MethodType=Property }
  2733  Procedure Set Collation Integer iCollation
  2734    Integer iPrintJob iResult
  2735    String sPEPrintOptions
  2736    Pointer pPEPrintOptions
  2737    Get PrintJob To iPrintJob
  2738    FillType PEPrintOptions With 0 To sPEPrintOptions
  2739    Put PEPrintOptions_Size To sPEPrintOptions At PEPrintOptions.StructSize
  2740    GetAddress Of sPEPrintOptions To pPEPrintOptions
  2741    Move (PEGetPrintOptions(iPrintJob,pPEPrintOptions)) To iResult
  2742    Send HandlePossibleError
  2743    Put iCollation To sPEPrintOptions At PEPrintOptions.collation
  2744    GetAddress Of sPEPrintOptions To pPEPrintOptions
  2745    Move (PESetPrintOptions(iPrintJob,pPEPrintOptions)) To iResult
  2746    Send HandlePossibleError
  2747  End_Procedure // Set Collation
  2748
  2749  { MethodType=Property }
  2750  Function Visible Integer iSectionCode Returns Integer
  2751    Integer iPrintJob iResult
  2752    String sPESectionOptions
  2753    Pointer pPESectionOptions
  2754    Get PrintJob To iPrintJob
  2755    FillType PESectionOptions With 0 To sPESectionOptions
  2756    Put PESectionOptions_Size To sPESectionOptions At PESectionOptions.StructSize
  2757    GetAddress Of sPESectionOptions To pPESectionOptions
  2758    Move (PEGetSectionFormat(iPrintJob,iSectionCode,pPESectionOptions)) To iResult
  2759    Send HandlePossibleError
  2760    GetBuff From sPESectionOptions At PESectionOptions.visible To iResult
  2761    Function_Return iResult
  2762  End_Function // Visible
  2763
  2764  { MethodType=Property }
  2765  Function NewPageBefore Integer iSectionCode Returns Integer
  2766    Integer iPrintJob iResult
  2767    String sPESectionOptions
  2768    Pointer pPESectionOptions
  2769    Get PrintJob To iPrintJob
  2770    FillType PESectionOptions With 0 To sPESectionOptions
  2771    Put PESectionOptions_Size To sPESectionOptions At PESectionOptions.StructSize
  2772    GetAddress Of sPESectionOptions To pPESectionOptions
  2773    Move (PEGetSectionFormat(iPrintJob,iSectionCode,pPESectionOptions)) To iResult
  2774    Send HandlePossibleError
  2775    GetBuff From sPESectionOptions At PESectionOptions.NewPageBefore To iResult
  2776    Function_Return iResult
  2777  End_Function // NewPageBefore
  2778
  2779  { MethodType=Property }
  2780  Function NewPageAfter Integer iSectionCode Returns Integer
  2781    Integer iPrintJob iResult
  2782    String sPESectionOptions
  2783    Pointer pPESectionOptions
  2784    Get PrintJob To iPrintJob
  2785    FillType PESectionOptions With 0 To sPESectionOptions
  2786    Put PESectionOptions_Size To sPESectionOptions At PESectionOptions.StructSize
  2787    GetAddress Of sPESectionOptions To pPESectionOptions
  2788    Move (PEGetSectionFormat(iPrintJob,iSectionCode,pPESectionOptions)) To iResult
  2789    Send HandlePossibleError
  2790    GetBuff From sPESectionOptions At PESectionOptions.NewPageAfter To iResult
  2791    Function_Return iResult
  2792  End_Function // NewPageAfter
  2793
  2794  { MethodType=Property }
  2795  Function KeepTogether Integer iSectionCode Returns Integer
  2796    Integer iPrintJob iResult
  2797    String sPESectionOptions
  2798    Pointer pPESectionOptions
  2799    Get PrintJob To iPrintJob
  2800    FillType PESectionOptions With 0 To sPESectionOptions
  2801    Put PESectionOptions_Size To sPESectionOptions At PESectionOptions.StructSize
  2802    GetAddress Of sPESectionOptions To pPESectionOptions
  2803    Move (PEGetSectionFormat(iPrintJob,iSectionCode,pPESectionOptions)) To iResult
  2804    Send HandlePossibleError
  2805    GetBuff From sPESectionOptions At PESectionOptions.KeepTogether To iResult
  2806    Function_Return iResult
  2807  End_Function // KeepTogether
  2808
  2809  { MethodType=Property }
  2810  Function SuppressBlankLines Integer iSectionCode Returns Integer
  2811    Integer iPrintJob iResult
  2812    String sPESectionOptions
  2813    Pointer pPESectionOptions
  2814    Get PrintJob To iPrintJob
  2815    FillType PESectionOptions With 0 To sPESectionOptions
  2816    Put PESectionOptions_Size To sPESectionOptions At PESectionOptions.StructSize
  2817    GetAddress Of sPESectionOptions To pPESectionOptions
  2818    Move (PEGetSectionFormat(iPrintJob,iSectionCode,pPESectionOptions)) To iResult
  2819    Send HandlePossibleError
  2820    GetBuff From sPESectionOptions At PESectionOptions.SuppressBlankLines To iResult
  2821    Function_Return iResult
  2822  End_Function // SuppressBlankLines
  2823
  2824  { MethodType=Property }
  2825  Function ResetPageNAfter Integer iSectionCode Returns Integer
  2826    Integer iPrintJob iResult
  2827    String sPESectionOptions
  2828    Pointer pPESectionOptions
  2829    Get PrintJob To iPrintJob
  2830    FillType PESectionOptions With 0 To sPESectionOptions
  2831    Put PESectionOptions_Size To sPESectionOptions At PESectionOptions.StructSize
  2832    GetAddress Of sPESectionOptions To pPESectionOptions
  2833    Move (PEGetSectionFormat(iPrintJob,iSectionCode,pPESectionOptions)) To iResult
  2834    Send HandlePossibleError
  2835    GetBuff From sPESectionOptions At PESectionOptions.ResetPageNAfter To iResult
  2836    Function_Return iResult
  2837  End_Function // ResetPageNAfter
  2838
  2839  { MethodType=Property }
  2840  Function PrintAtBottomOfPage Integer iSectionCode Returns Integer
  2841    Integer iPrintJob iResult
  2842    String sPESectionOptions
  2843    Pointer pPESectionOptions
  2844    Get PrintJob To iPrintJob
  2845    FillType PESectionOptions With 0 To sPESectionOptions
  2846    Put PESectionOptions_Size To sPESectionOptions At PESectionOptions.StructSize
  2847    GetAddress Of sPESectionOptions To pPESectionOptions
  2848    Move (PEGetSectionFormat(iPrintJob,iSectionCode,pPESectionOptions)) To iResult
  2849    Send HandlePossibleError
  2850    GetBuff From sPESectionOptions At PESectionOptions.printAtBottomOfPage To iResult
  2851    Function_Return iResult
  2852  End_Function // PrintAtBottomOfPage
  2853
  2854  { MethodType=Property }
  2855  Procedure Set Visible Integer iSectionCode Integer iVisible
  2856    Integer iPrintJob iResult
  2857    String sPESectionOptions
  2858    Pointer pPESectionOptions
  2859    Get PrintJob To iPrintJob
  2860    FillType PESectionOptions With 0 To sPESectionOptions
  2861    Put PESectionOptions_Size To sPESectionOptions At PESectionOptions.StructSize
  2862    GetAddress Of sPESectionOptions To pPESectionOptions
  2863    Move (PEGetSectionFormat(iPrintJob,iSectionCode,pPESectionOptions)) To iResult
  2864    Send HandlePossibleError
  2865    Put iVisible To sPESectionOptions At PESectionOptions.visible
  2866    GetAddress Of sPESectionOptions To pPESectionOptions
  2867    Move (PESetSectionFormat(iPrintJob,iSectionCode,pPESectionOptions)) To iResult
  2868    Send HandlePossibleError
  2869  End_Procedure // Set Visible
  2870
  2871  { MethodType=Property }
  2872  Procedure Set NewPageBefore Integer iSectionCode Integer iNewPageBefore
  2873    Integer iPrintJob iResult
  2874    String sPESectionOptions
  2875    Pointer pPESectionOptions
  2876    Get PrintJob To iPrintJob
  2877    FillType PESectionOptions With 0 To sPESectionOptions
  2878    Put PESectionOptions_Size To sPESectionOptions At PESectionOptions.StructSize
  2879    GetAddress Of sPESectionOptions To pPESectionOptions
  2880    Move (PEGetSectionFormat(iPrintJob,iSectionCode,pPESectionOptions)) To iResult
  2881    Send HandlePossibleError
  2882    Put iNewPageBefore To sPESectionOptions At PESectionOptions.NewPageBefore
  2883    GetAddress Of sPESectionOptions To pPESectionOptions
  2884    Move (PESetSectionFormat(iPrintJob,iSectionCode,pPESectionOptions)) To iResult
  2885    Send HandlePossibleError
  2886  End_Procedure // Set NewPageBefore
  2887
  2888  { MethodType=Property }
  2889  Procedure Set NewPageAfter Integer iSectionCode Integer iNewPageAfter
  2890    Integer iPrintJob iResult
  2891    String sPESectionOptions
  2892    Pointer pPESectionOptions
  2893    Get PrintJob To iPrintJob
  2894    FillType PESectionOptions With 0 To sPESectionOptions
  2895    Put PESectionOptions_Size To sPESectionOptions At PESectionOptions.StructSize
  2896    GetAddress Of sPESectionOptions To pPESectionOptions
  2897    Move (PEGetSectionFormat(iPrintJob,iSectionCode,pPESectionOptions)) To iResult
  2898    Send HandlePossibleError
  2899    Put iNewPageAfter To sPESectionOptions At PESectionOptions.NewPageAfter
  2900    GetAddress Of sPESectionOptions To pPESectionOptions
  2901    Move (PESetSectionFormat(iPrintJob,iSectionCode,pPESectionOptions)) To iResult
  2902    Send HandlePossibleError
  2903  End_Procedure // Set NewPageAfter
  2904
  2905  { MethodType=Property }
  2906  Procedure Set KeepTogether Integer iSectionCode Integer iKeepTogether
  2907    Integer iPrintJob iResult
  2908    String sPESectionOptions
  2909    Pointer pPESectionOptions
  2910    Get PrintJob To iPrintJob
  2911    FillType PESectionOptions With 0 To sPESectionOptions
  2912    Put PESectionOptions_Size To sPESectionOptions At PESectionOptions.StructSize
  2913    GetAddress Of sPESectionOptions To pPESectionOptions
  2914    Move (PEGetSectionFormat(iPrintJob,iSectionCode,pPESectionOptions)) To iResult
  2915    Send HandlePossibleError
  2916    Put iKeepTogether To sPESectionOptions At PESectionOptions.KeepTogether
  2917    GetAddress Of sPESectionOptions To pPESectionOptions
  2918    Move (PESetSectionFormat(iPrintJob,iSectionCode,pPESectionOptions)) To iResult
  2919    Send HandlePossibleError
  2920  End_Procedure // Set KeepTogether
  2921
  2922  { MethodType=Property }
  2923  Procedure Set SuppressBlankLines Integer iSectionCode Integer iSuppressBlankLines
  2924    Integer iPrintJob iResult
  2925    String sPESectionOptions
  2926    Pointer pPESectionOptions
  2927    Get PrintJob To iPrintJob
  2928    FillType PESectionOptions With 0 To sPESectionOptions
  2929    Put PESectionOptions_Size To sPESectionOptions At PESectionOptions.StructSize
  2930    GetAddress Of sPESectionOptions To pPESectionOptions
  2931    Move (PEGetSectionFormat(iPrintJob,iSectionCode,pPESectionOptions)) To iResult
  2932    Send HandlePossibleError
  2933    Put iSuppressBlankLines To sPESectionOptions At PESectionOptions.SuppressBlankLines
  2934    GetAddress Of sPESectionOptions To pPESectionOptions
  2935    Move (PESetSectionFormat(iPrintJob,iSectionCode,pPESectionOptions)) To iResult
  2936    Send HandlePossibleError
  2937  End_Procedure // Set SuppressBlankLines
  2938
  2939  { MethodType=Property }
  2940  Procedure Set ResetPageNAfter Integer iSectionCode Integer iResetPageNAfter
  2941    Integer iPrintJob iResult
  2942    String sPESectionOptions
  2943    Pointer pPESectionOptions
  2944    Get PrintJob To iPrintJob
  2945    FillType PESectionOptions With 0 To sPESectionOptions
  2946    Put PESectionOptions_Size To sPESectionOptions At PESectionOptions.StructSize
  2947    GetAddress Of sPESectionOptions To pPESectionOptions
  2948    Move (PEGetSectionFormat(iPrintJob,iSectionCode,pPESectionOptions)) To iResult
  2949    Send HandlePossibleError
  2950    Put iResetPageNAfter To sPESectionOptions At PESectionOptions.ResetPageNAfter
  2951    GetAddress Of sPESectionOptions To pPESectionOptions
  2952    Move (PESetSectionFormat(iPrintJob,iSectionCode,pPESectionOptions)) To iResult
  2953    Send HandlePossibleError
  2954  End_Procedure // Set ResetPageNAfter
  2955
  2956  { MethodType=Property }
  2957  Procedure Set PrintAtBottomOfPage Integer iSectionCode Integer iPrintAtBottomOfPage
  2958    Integer iPrintJob iResult
  2959    String sPESectionOptions
  2960    Pointer pPESectionOptions
  2961    Get PrintJob To iPrintJob
  2962    FillType PESectionOptions With 0 To sPESectionOptions
  2963    Put PESectionOptions_Size To sPESectionOptions At PESectionOptions.StructSize
  2964    GetAddress Of sPESectionOptions To pPESectionOptions
  2965    Move (PEGetSectionFormat(iPrintJob,iSectionCode,pPESectionOptions)) To iResult
  2966    Send HandlePossibleError
  2967    Put iPrintAtBottomOfPage To sPESectionOptions At PESectionOptions.PrintAtBottomOfPage
  2968    GetAddress Of sPESectionOptions To pPESectionOptions
  2969    Move (PESetSectionFormat(iPrintJob,iSectionCode,pPESectionOptions)) To iResult
  2970    Send HandlePossibleError
  2971  End_Procedure // Set PrintAtBottomOfPage
  2972
  2973  { MethodType=Property }
  2974  Function LeftMargin Returns Integer
  2975    Integer iPrintJob iResult
  2976    String sLeft sRight sTop sBottom
  2977    Pointer pLeft pRight pTop pBottom
  2978    Get PrintJob To iPrintJob
  2979    FillType PEInteger With 0 To sLeft
  2980    FillType PEInteger With 0 To sRight
  2981    FillType PEInteger With 0 To sTop
  2982    FillType PEInteger With 0 To sBottom
  2983    GetAddress Of sLeft To pLeft
  2984    GetAddress Of sRight To pRight
  2985    GetAddress Of sTop To pTop
  2986    GetAddress Of sBottom To pBottom
  2987    Move (PEGetMargins(iPrintJob,pLeft,pRight,pTop,pBottom)) To iResult
  2988    Send HandlePossibleError
  2989    GetBuff From sLeft At PEInteger.integer To iResult
  2990    Function_Return iResult
  2991  End_Function // LeftMargin
  2992
  2993  { MethodType=Property }
  2994  Function RightMargin Returns Integer
  2995    Integer iPrintJob iResult
  2996    String sLeft sRight sTop sBottom
  2997    Pointer pLeft pRight pTop pBottom
  2998    Get PrintJob To iPrintJob
  2999    FillType PEInteger With 0 To sLeft
  3000    FillType PEInteger With 0 To sRight
  3001    FillType PEInteger With 0 To sTop
  3002    FillType PEInteger With 0 To sBottom
  3003    GetAddress Of sLeft To pLeft
  3004    GetAddress Of sRight To pRight
  3005    GetAddress Of sTop To pTop
  3006    GetAddress Of sBottom To pBottom
  3007    Move (PEGetMargins(iPrintJob,pLeft,pRight,pTop,pBottom)) To iResult
  3008    Send HandlePossibleError
  3009    GetBuff From sRight At PEInteger.integer To iResult
  3010    Function_Return iResult
  3011  End_Function // RightMargin
  3012
  3013  { MethodType=Property }
  3014  Function TopMargin Returns Integer
  3015    Integer iPrintJob iResult
  3016    String sLeft sRight sTop sBottom
  3017    Pointer pLeft pRight pTop pBottom
  3018    Get PrintJob To iPrintJob
  3019    FillType PEInteger With 0 To sLeft
  3020    FillType PEInteger With 0 To sRight
  3021    FillType PEInteger With 0 To sTop
  3022    FillType PEInteger With 0 To sBottom
  3023    GetAddress Of sLeft To pLeft
  3024    GetAddress Of sRight To pRight
  3025    GetAddress Of sTop To pTop
  3026    GetAddress Of sBottom To pBottom
  3027    Move (PEGetMargins(iPrintJob,pLeft,pRight,pTop,pBottom)) To iResult
  3028    Send HandlePossibleError
  3029    GetBuff From sTop At PEInteger.integer To iResult
  3030    Function_Return iResult
  3031  End_Function // TopMargin
  3032
  3033  { MethodType=Property }
  3034  Function BottomMargin Returns Integer
  3035    Integer iPrintJob iResult
  3036    String sLeft sRight sTop sBottom
  3037    Pointer pLeft pRight pTop pBottom
  3038    Get PrintJob To iPrintJob
  3039    FillType PEInteger With 0 To sLeft
  3040    FillType PEInteger With 0 To sRight
  3041    FillType PEInteger With 0 To sTop
  3042    FillType PEInteger With 0 To sBottom
  3043    GetAddress Of sLeft To pLeft
  3044    GetAddress Of sRight To pRight
  3045    GetAddress Of sTop To pTop
  3046    GetAddress Of sBottom To pBottom
  3047    Move (PEGetMargins(iPrintJob,pLeft,pRight,pTop,pBottom)) To iResult
  3048    Send HandlePossibleError
  3049    GetBuff From sBottom At PEInteger.integer To iResult
  3050    Function_Return iResult
  3051  End_Function // BottomMargin
  3052
  3053  { MethodType=Property }
  3054  Procedure Set LeftMargin Integer iLeft
  3055    Integer iPrintJob iResult iRight iTop iBottom
  3056    Get PrintJob To iPrintJob
  3057    Move (RightMargin(self)) To iRight
  3058    Move (TopMargin(self)) To iTop
  3059    Move (BottomMargin(self)) To iBottom
  3060    Move (PESetMargins(iPrintJob,iLeft,iRight,iTop,iBottom)) To iResult
  3061    Send HandlePossibleError
  3062  End_Procedure // Set LeftMargin
  3063
  3064  { MethodType=Property }
  3065  Procedure Set RightMargin Integer iRight
  3066    Integer iPrintJob iResult iLeft iTop iBottom
  3067    Get PrintJob To iPrintJob
  3068    Move (LeftMargin(self)) To iLeft
  3069    Move (TopMargin(self)) To iTop
  3070    Move (BottomMargin(self)) To iBottom
  3071    Move (PESetMargins(iPrintJob,iLeft,iRight,iTop,iBottom)) To iResult
  3072    Send HandlePossibleError
  3073  End_Procedure // Set RightMargin
  3074
  3075  { MethodType=Property }
  3076  Procedure Set TopMargin Integer iTop
  3077    Integer iPrintJob iResult iLeft iRight iBottom
  3078    Get PrintJob To iPrintJob
  3079    Move (LeftMargin(self)) To iLeft
  3080    Move (RightMargin(self)) To iRight
  3081    Move (BottomMargin(self)) To iBottom
  3082    Move (PESetMargins(iPrintJob,iLeft,iRight,iTop,iBottom)) To iResult
  3083    Send HandlePossibleError
  3084  End_Procedure // Set TopMargin
  3085
  3086  { MethodType=Property }
  3087  Procedure Set BottomMargin Integer iBottom
  3088    Integer iPrintJob iResult iLeft iRight iTop
  3089    Get PrintJob To iPrintJob
  3090    Move (LeftMargin(self)) To iLeft
  3091    Move (RightMargin(self)) To iRight
  3092    Move (TopMargin(self)) To iTop
  3093    Move (PESetMargins(iPrintJob,iLeft,iRight,iTop,iBottom)) To iResult
  3094    Send HandlePossibleError
  3095  End_Procedure // Set BottomMargin
  3096
  3097  { MethodType=Property }
  3098  Function MinimumSectionHeight Integer iSectionCode Returns Integer
  3099    Integer iPrintJob iResult
  3100    String sPEInteger
  3101    Pointer pPEInteger
  3102    Get PrintJob To iPrintJob
  3103    FillType PEInteger With 0 To sPEInteger
  3104    GetAddress Of sPEInteger To pPEInteger
  3105    Move (PEGetMinimumSectionHeight(iPrintJob,iSectionCode,pPEInteger)) To iResult
  3106    Send HandlePossibleError
  3107    GetBuff From sPEInteger At PEInteger.integer To iResult
  3108    Function_Return iResult
  3109  End_Function // MinimumSectionHeight
  3110
  3111  { MethodType=Property }
  3112  Procedure Set MinimumSectionHeight Integer iSectionCode Integer iMimimumHeight
  3113    Integer iPrintJob iResult
  3114    Get PrintJob To iPrintJob
  3115    Move (PESetMinimumSectionHeight(iPrintJob,iSectionCode,iMimimumHeight)) To iResult
  3116    Send HandlePossibleError
  3117  End_Procedure // Set MinimumSectionHeight
  3118
  3119  { MethodType=Property }
  3120  Function LineHeight Integer iSectionCode Integer iLineN Returns Integer
  3121    Integer iPrintJob iResult
  3122    String sHeight sAscent
  3123    Pointer pHeight pAscent
  3124    Get PrintJob To iPrintJob
  3125    FillType PEInteger With 0 To sHeight
  3126    FillType PEInteger With 0 To sAscent
  3127    GetAddress Of sHeight To pHeight
  3128    GetAddress Of sAscent To pAscent
  3129    Move (PEGetLineHeight(iPrintJob,iSectionCode,iLineN,pHeight,pAscent)) To iResult
  3130    Send HandlePossibleError
  3131    GetBuff From sHeight At PEInteger.integer To iResult
  3132    Function_Return iResult
  3133  End_Function // LineHeight
  3134
  3135  { MethodType=Property }
  3136  Function LineAscent Integer iSectionCode Integer iLineN Returns Integer
  3137    Integer iPrintJob iResult
  3138    String sHeight sAscent
  3139    Pointer pHeight pAscent
  3140    Get PrintJob To iPrintJob
  3141    FillType PEInteger With 0 To sHeight
  3142    FillType PEInteger With 0 To sAscent
  3143    GetAddress Of sHeight To pHeight
  3144    GetAddress Of sAscent To pAscent
  3145    Move (PEGetLineHeight(iPrintJob,iSectionCode,iLineN,pHeight,pAscent)) To iResult
  3146    Send HandlePossibleError
  3147    GetBuff From sAscent At PEInteger.integer To iResult
  3148    Function_Return iResult
  3149  End_Function // LineAscent
  3150
  3151  { MethodType=Property }
  3152  Procedure Set LineHeight Integer iSectionCode Integer iLineN Integer iHeight
  3153    Integer iPrintJob iResult iAscent
  3154    Get PrintJob To iPrintJob
  3155    Move (LineAscent(self,iSectionCode,iLineN)) To iAscent
  3156    Move (PESetLineHeight(iPrintJob,iSectionCode,iLineN,iHeight,iAscent)) To iResult
  3157    Send HandlePossibleError
  3158  End_Procedure // Set LineHeight
  3159
  3160  { MethodType=Property }
  3161  Procedure Set LineAscent Integer iSectionCode Integer iLineN Integer iAscent
  3162    Integer iPrintJob iResult iHeight
  3163    Get PrintJob To iPrintJob
  3164    Move (LineHeight(self,iSectionCode,iLineN)) To iHeight
  3165    Move (PESetLineHeight(iPrintJob,iSectionCode,iLineN,iHeight,iAscent)) To iResult
  3166    Send HandlePossibleError
  3167  End_Procedure // Set LineAscent
  3168
  3169  { MethodType=Property }
  3170  Function NLinesInSection Integer iSectionCode Returns Integer
  3171    Integer iPrintJob iResult
  3172    Get PrintJob To iPrintJob
  3173    Move (PEGetNLinesInSection(iPrintJob,iSectionCode)) To iResult
  3174    Send HandlePossibleError
  3175    Function_Return iResult
  3176  End_Function // NLinesInSection
  3177
  3178  { Visibility=Private }
  3179  Function SelectAndSetFont Integer iSection Integer iScope Returns Integer
  3180    Integer iResult iFontFamily iFontPitch iFontCharSet iFontPointSize
  3181    Integer iFontItalic iFontUnderline iFontStrikeOut iFontWeight
  3182    String sFaceName
  3183    Get FontDialog Of (WinQLSelectFont(self)) To iResult
  3184    If iResult Begin
  3185      Get FaceName Of (WinQLSelectFont(self)) To sFaceName
  3186      Get FontFamily Of (WinQLSelectFont(self)) To iFontFamily
  3187      Get FontPitch Of (WinQLSelectFont(self)) To iFontPitch
  3188      Get FontCharSet Of (WinQLSelectFont(self)) To iFontCharSet
  3189      Get FontPointSize Of (WinQLSelectFont(self)) To iFontPointSize
  3190      Get FontItalic Of (WinQLSelectFont(self)) To iFontItalic
  3191      Get FontUnderline Of (WinQLSelectFont(self)) To iFontUnderline
  3192      Get FontStrikeOut Of (WinQLSelectFont(self)) To iFontStrikeOut
  3193      Get FontWeight Of (WinQLSelectFont(self)) To iFontWeight
  3194      Set Font To iSection iScope sFaceName iFontFamily iFontPitch iFontCharSet ;
  3195        (iFontPointSize/10) iFontItalic iFontUnderline iFontStrikeOut iFontWeight
  3196    End // If iResult Begin
  3197    Function_Return iResult
  3198  End_Function // SelectAndSetFont
  3199
  3200  Procedure SelectAndSetFont Integer iSection Integer iScope
  3201    Integer iResult iFontFamily iFontPitch iFontCharSet iFontPointSize
  3202    Integer iFontItalic iFontUnderline iFontStrikeOut iFontWeight
  3203    String sFaceName
  3204    Get FontDialog Of (WinQLSelectFont(self)) To iResult
  3205    If iResult Begin
  3206      Get FaceName Of (WinQLSelectFont(self)) To sFaceName
  3207      Get FontFamily Of (WinQLSelectFont(self)) To iFontFamily
  3208      Get FontPitch Of (WinQLSelectFont(self)) To iFontPitch
  3209      Get FontCharSet Of (WinQLSelectFont(self)) To iFontCharSet
  3210      Get FontPointSize Of (WinQLSelectFont(self)) To iFontPointSize
  3211      Get FontItalic Of (WinQLSelectFont(self)) To iFontItalic
  3212      Get FontUnderline Of (WinQLSelectFont(self)) To iFontUnderline
  3213      Get FontStrikeOut Of (WinQLSelectFont(self)) To iFontStrikeOut
  3214      Get FontWeight Of (WinQLSelectFont(self)) To iFontWeight
  3215      Set Font To iSection iScope sFaceName iFontFamily iFontPitch iFontCharSet ;
  3216        (iFontPointSize/10) iFontItalic iFontUnderline iFontStrikeOut iFontWeight
  3217    End // If iResult Begin
  3218  End_Procedure // SelectAndSetFont
  3219
  3220  Procedure Set Font Integer iSection Integer iScope String sFaceName Integer iFamily Integer iPitch ;
  3221    Integer iCharSet Integer iSize Integer iItalic Integer iUnder Integer iStrike Integer iWeight
  3222    Integer iPrintJob iResult
  3223    Get PrintJob To iPrintJob
  3224    Move (ToANSI(sFaceName+Character(0))) To sFaceName
  3225    Move (PESetFont(iPrintJob,iSection,iScope,sFaceName,iFamily,iPitch,iCharSet,iSize,iItalic,iUnder,iStrike,iWeight)) To iResult
  3226    Send HandlePossibleError
  3227  End_Procedure // Set Font
  3228
  3229  { MethodType=Property }
  3230  Function NDetailCopies Returns Integer
  3231    Integer iPrintJob iResult
  3232    String sPEInteger
  3233    Pointer pPEInteger
  3234    Get PrintJob To iPrintJob
  3235    FillType PEInteger With 0 To sPEInteger
  3236    GetAddress Of sPEInteger To pPEInteger
  3237    Move (PEGetNDetailCopies(iPrintJob,pPEInteger)) To iResult
  3238    Send HandlePossibleError
  3239    GetBuff From sPEInteger At PEInteger.integer To iResult
  3240    Function_Return iResult
  3241  End_Function // NDetailCopies
  3242
  3243  { MethodType=Property }
  3244  Procedure Set NDetailCopies Integer iNDetailCopies
  3245    Integer iPrintJob iResult
  3246    Get PrintJob To iPrintJob
  3247    Move (PESetNDetailCopies(iPrintJob,iNDetailCopies)) To iResult
  3248    Send HandlePossibleError
  3249  End_Procedure // Set NDetailCopies
  3250
  3251  { MethodType=Property }
  3252  Function PrintDate Returns Date
  3253    Integer iPrintJob iResult iYear iMonth iDay iFormat iSeparator
  3254    String sYear sMonth sDay
  3255    Pointer pYear pMonth pDay
  3256    Get PrintJob To iPrintJob
  3257    FillType PEInteger With 0 To sYear
  3258    FillType PEInteger With 0 To sMonth
  3259    FillType PEInteger With 0 To sDay
  3260    GetAddress Of sYear To pYear
  3261    GetAddress Of sMonth To pMonth
  3262    GetAddress Of sDay To pDay
  3263    Move (PEGetPrintDate(iPrintJob,pYear,pMonth,pDay)) To iResult
  3264    Send HandlePossibleError
  3265    GetBuff From sYear At PEInteger.integer To iYear
  3266    GetBuff From sMonth At PEInteger.integer To iMonth
  3267    GetBuff From sDay At PEInteger.integer To iDay
  3268    Get_Attribute DF_Date_Format To iFormat
  3269    Get_Attribute DF_Date_Separator To iSeparator
  3270    If iFormat Eq DF_DATE_MILITARY Function_Return ;
  3271      (Date(String(iYear)+Character(iSeparator)+String(iMonth)+Character(iSeparator)+String(iDay)))
  3272    Else If iFormat Eq DF_DATE_USA Function_Return ;
  3273      (Date(String(iMonth)+Character(iSeparator)+String(iDay)+Character(iSeparator)+String(iYear)))
  3274    Else Function_Return (Date(String(iDay)+Character(iSeparator)+String(iMonth)+Character(iSeparator)+String(iYear)))
  3275  End_Function // PrintDate
  3276
  3277  { MethodType=Property }
  3278  Procedure Set PrintDate Date dPrintDate
  3279    Integer iPrintJob iResult iYear iMonth iDay iFormat
  3280    Get PrintJob To iPrintJob
  3281    Get_Date_Format To iFormat
  3282    If iFormat Eq DF_DATE_MILITARY Begin
  3283      If (Length(String(dPrintDate))) Eq 8 Begin
  3284        Move (Integer(Left(dPrintDate,2))) To iYear
  3285        Move (Integer(Mid(dPrintDate,2,4))) To iMonth
  3286      End // If (Length(String(dPrintDate,2))) Eq 8 Begin
  3287      Else Begin
  3288        Move (Integer(Left(dPrintDate,4))) To iYear
  3289        Move (Integer(Mid(dPrintDate,2,6))) To iMonth
  3290      End // Else Begin
  3291      Move (Integer(Right(dPrintDate,2))) To iDay
  3292    End // If iFormat Eq DF_DATE_MILITARY Begin
  3293    Else If iFormat Eq DF_DATE_USA Begin
  3294      Move (Integer(Left(dPrintDate,2))) To iMonth
  3295      Move (Integer(Mid(dPrintDate,2,4))) To iDay
  3296      If (Length(String(dPrintDate))) Eq 8 Move (Integer(Right(dPrintDate,2))) To iYear
  3297      Else Move (Integer(Right(dPrintDate,4))) To iYear
  3298    End // Else If iFormat Eq DF_DATE_USA Begin
  3299    Else Begin
  3300      Move (Integer(Left(dPrintDate,2))) To iDay
  3301      Move (Integer(Mid(dPrintDate,2,4))) To iMonth
  3302      If (Length(String(dPrintDate))) Eq 8 Move (Integer(Right(dPrintDate,2))) To iYear
  3303      Else Move (Integer(Right(dPrintDate,4))) To iYear
  3304    End // Else Begin
  3305    Move (PESetPrintDate(iPrintJob,iYear,iMonth,iDay)) To iResult
  3306    Send HandlePossibleError
  3307  End_Procedure // Set PrintDate
  3308
  3309  // *********************************************************************** //
  3310  // ** Window Customization Functions                                    ** //
  3311  // *********************************************************************** //
  3312
  3313  Procedure ShowNextPage
  3314    Integer iPrintJob iResult
  3315    Get PrintJob To iPrintJob
  3316    Move (PEShowNextPage(iPrintJob)) To iResult
  3317    Send HandlePossibleError
  3318  End_Procedure // ShowNextPage
  3319
  3320  Procedure ShowFirstPage
  3321    Integer iPrintJob iResult
  3322    Get PrintJob To iPrintJob
  3323    Move (PEShowFirstPage(iPrintJob)) To iResult
  3324    Send HandlePossibleError
  3325  End_Procedure // ShowFirstPage
  3326
  3327  Procedure ShowPreviousPage
  3328    Integer iPrintJob iResult
  3329    Get PrintJob To iPrintJob
  3330    Move (PEShowPreviousPage(iPrintJob)) To iResult
  3331    Send HandlePossibleError
  3332  End_Procedure // ShowPreviousPage
  3333
  3334  Procedure ShowLastPage
  3335    Integer iPrintJob iResult
  3336    Get PrintJob To iPrintJob
  3337    Move (PEShowLastPage(iPrintJob)) To iResult
  3338    Send HandlePossibleError
  3339  End_Procedure // ShowLastPage
  3340
  3341  { MethodType=Property }
  3342  Procedure Set ShowPrintControls Integer iShowPrintControls
  3343    Integer iPrintJob iResult
  3344    Get PrintJob To iPrintJob
  3345    Move (PEShowPrintControls(iPrintJob,iShowPrintControls)) To iResult
  3346    Send HandlePossibleError
  3347  End_Procedure // Set ShowPrintControls
  3348
  3349  { MethodType=Property }
  3350  Function ShowPrintControls Returns Integer
  3351    Integer iPrintJob iResult
  3352    String sPEInteger
  3353    Pointer pPEInteger
  3354    Get PrintJob To iPrintJob
  3355    FillType PEInteger With 0 To sPEInteger
  3356    GetAddress Of sPEInteger To pPEInteger
  3357    Move (PEPrintControlsShowing(iPrintJob,pPEInteger)) To iResult
  3358    Send HandlePossibleError
  3359    GetBuff From sPEInteger At PEInteger.integer To iResult
  3360    Function_Return iResult
  3361  End_Function // ShowPrintControls
  3362
  3363  { MethodType=Property }
  3364  Procedure Set ZoomPreviewWindow Integer iLevel
  3365    Integer iPrintJob iResult
  3366    Get PrintJob To iPrintJob
  3367    Move (PEZoomPreviewWindow(iPrintJob,iLevel)) To iResult
  3368    Send HandlePossibleError
  3369  End_Procedure // Set ZoomPreviewWindow
  3370
  3371  Procedure NextPrintWindowMagnification
  3372    Integer iPrintJob iResult
  3373    Get PrintJob To iPrintJob
  3374    Move (PENextPrintWindowMagnification(iPrintJob)) To iResult
  3375    Send HandlePossibleError
  3376  End_Procedure // NextPrintWindowMagnification
  3377
  3378  // *********************************************************************** //
  3379  // ** Group Management Functions                                        ** //
  3380  // *********************************************************************** //
  3381
  3382  { MethodType=Property }
  3383  Function NGroups Returns Integer
  3384    Integer iPrintJob iResult
  3385    Get PrintJob To iPrintJob
  3386    Move (PEGetNGroups(iPrintJob)) To iResult
  3387    // Crystal 7 fix...
  3388    Move (Low(iResult)) To iResult
  3389    Send HandlePossibleError
  3390    Function_Return iResult
  3391  End_Function // NGroups
  3392
  3393  { MethodType=Property }
  3394  Function GroupField Integer iSectionCode Returns String
  3395    Integer iPrintJob iResult iTextHandle iTextLength
  3396    String sPETextStructure sCondition sDirection sReturn
  3397    Pointer pPETextStructure pCondition pDirection pReturn
  3398    Get PrintJob To iPrintJob
  3399    FillType PETextStructure With 0 To sPETextStructure
  3400    GetAddress Of sPETextStructure To pPETextStructure
  3401    FillType PEInteger With 0 To sCondition
  3402    GetAddress Of sCondition To pCondition
  3403    FillType PEInteger With 0 To sDirection
  3404    GetAddress Of sCondition To pDirection
  3405    Move (PEGetGroupCondition(iPrintJob,iSectionCode,pPETextStructure,pPETextStructure+4,pCondition,pDirection)) To iResult
  3406    Send HandlePossibleError
  3407    GetBuff From sPETextStructure At PETextStructure.textHandle To iTextHandle
  3408    GetBuff From sPETextStructure At PETextStructure.textLength To iTextLength
  3409    If iTextLength Gt 255 Move 255 To iTextLength
  3410    Move (Repeat(Character(0),255)) To sReturn
  3411    GetAddress Of sReturn To pReturn
  3412    Move (PEGetHandleString(iTextHandle,pReturn,iTextLength)) To iResult
  3413    Send HandlePossibleError
  3414    Function_Return (ToOEM(cString(sReturn)))
  3415  End_Function // GroupField
  3416
  3417  { MethodType=Property }
  3418  Function GroupCondition Integer iSectionCode Returns Integer
  3419    Integer iPrintJob iResult
  3420    String sPETextStructure sCondition sDirection
  3421    Pointer pPETextStructure pCondition pDirection
  3422    Get PrintJob To iPrintJob
  3423    FillType PETextStructure With 0 To sPETextStructure
  3424    GetAddress Of sPETextStructure To pPETextStructure
  3425    FillType PEInteger With 0 To sCondition
  3426    GetAddress Of sCondition To pCondition
  3427    FillType PEInteger With 0 To sDirection
  3428    GetAddress Of sCondition To pDirection
  3429    Move (PEGetGroupCondition(iPrintJob,iSectionCode,pPETextStructure,pPETextStructure+4,pCondition,pDirection)) To iResult
  3430    Send HandlePossibleError
  3431    GetBuff From sCondition At PEInteger.integer To iResult
  3432    Function_Return iResult
  3433  End_Function // GroupCondition
  3434
  3435  { MethodType=Property }
  3436  Function GroupSortDirection Integer iSectionCode Returns Integer
  3437    Integer iPrintJob iResult
  3438    String sPETextStructure sCondition sDirection
  3439    Pointer pPETextStructure pCondition pDirection
  3440    Get PrintJob To iPrintJob
  3441    FillType PETextStructure With 0 To sPETextStructure
  3442    GetAddress Of sPETextStructure To pPETextStructure
  3443    FillType PEInteger With 0 To sCondition
  3444    GetAddress Of sCondition To pCondition
  3445    FillType PEInteger With 0 To sDirection
  3446    GetAddress Of sCondition To pDirection
  3447    Move (PEGetGroupCondition(iPrintJob,iSectionCode,pPETextStructure,pPETextStructure+4,pCondition,pDirection)) To iResult
  3448    Send HandlePossibleError
  3449    GetBuff From sDirection At PEInteger.integer To iResult
  3450    Function_Return iResult
  3451  End_Function // GroupSortDirection
  3452
  3453  { MethodType=Property }
  3454  Procedure Set GroupField Integer iSectionCode String sField
  3455    Integer iPrintJob iResult iCondition iSortDirection
  3456    Get PrintJob To iPrintJob
  3457    Move (ToANSI(sField+Character(0))) To sField
  3458    Get GroupCondition iSectionCode To iCondition
  3459    Get GroupSortDirection iSectionCode To iSortDirection
  3460    Move (PESetGroupCondition(iPrintJob,iSectionCode,sField,iCondition,iSortDirection)) To iResult
  3461    Send HandlePossibleError
  3462  End_Procedure // Set GroupField
  3463
  3464  { MethodType=Property }
  3465  Procedure Set GroupCondition Integer iSectionCode Integer iCondition
  3466    Integer iPrintJob iResult iSortDirection
  3467    String sField
  3468    Get PrintJob To iPrintJob
  3469    Get GroupField iSectionCode To sField
  3470    Move (ToANSI(sField+Character(0))) To sField
  3471    Get GroupSortDirection iSectionCode To iSortDirection
  3472    Move (PESetGroupCondition(iPrintJob,iSectionCode,sField,iCondition,iSortDirection)) To iResult
  3473    Send HandlePossibleError
  3474  End_Procedure // Set GroupCondition
  3475
  3476  { MethodType=Property }
  3477  Procedure Set GroupSortDirection Integer iSectionCode Integer iSortDirection
  3478    Integer iPrintJob iResult iCondition
  3479    String sField
  3480    Get PrintJob To iPrintJob
  3481    Get GroupField iSectionCode To sField
  3482    Move (ToANSI(sField+Character(0))) To sField
  3483    Get GroupCondition iSectionCode To iCondition
  3484    Move (PESetGroupCondition(iPrintJob,iSectionCode,sField,iCondition,iSortDirection)) To iResult
  3485    Send HandlePossibleError
  3486  End_Procedure // Set GroupSortDirection
  3487
  3488  // *********************************************************************** //
  3489  // ** Table Management Functions                                        ** //
  3490  // *********************************************************************** //
  3491
  3492  { MethodType=Property }
  3493  Function NTables Returns Integer
  3494    Integer iPrintJob iResult
  3495    Get PrintJob To iPrintJob
  3496    Move (PEGetNTables(iPrintJob)) To iResult
  3497    // Crystal 7 fix...
  3498    Move (Low(iResult)) To iResult
  3499    Send HandlePossibleError
  3500    Function_Return iResult
  3501  End_Function // NTables
  3502
  3503  { MethodType=Property }
  3504  Function NthTableDLLName Integer iTableN Returns String
  3505    Integer iPrintJob iResult
  3506    String sPETableType sReturn
  3507    Pointer pPETableType
  3508    Get PrintJob To iPrintJob
  3509    FillType PETableType With 0 To sPETableType
  3510    Put PETableType_Size To sPETableType At PETableType.StructSize
  3511    GetAddress Of sPETableType To pPETableType
  3512    Move (PEGetNthTableType(iPrintJob,iTableN,pPETableType)) To iResult
  3513    Send HandlePossibleError
  3514    GetBuff_String From sPETableType At PETableType.DLLName To sReturn
  3515    Function_Return (ToOEM(sReturn))
  3516  End_Function // NthTableDLLName
  3517
  3518  { MethodType=Property }
  3519  Function NthTableDescriptiveName Integer iTableN Returns String
  3520    Integer iPrintJob iResult
  3521    String sPETableType sReturn
  3522    Pointer pPETableType
  3523    Get PrintJob To iPrintJob
  3524    FillType PETableType With 0 To sPETableType
  3525    Put PETableType_Size To sPETableType At PETableType.StructSize
  3526    GetAddress Of sPETableType To pPETableType
  3527    Move (PEGetNthTableType(iPrintJob,iTableN,pPETableType)) To iResult
  3528    Send HandlePossibleError
  3529    GetBuff_String From sPETableType At PETableType.DescriptiveName To sReturn
  3530    Function_Return (ToOEM(sReturn))
  3531  End_Function // NthTableDescriptiveName
  3532
  3533  { MethodType=Property }
  3534  Function NthTableDBType Integer iTableN Returns Integer
  3535    Integer iPrintJob iResult
  3536    String sPETableType sReturn
  3537    Pointer pPETableType
  3538    Get PrintJob To iPrintJob
  3539    FillType PETableType With 0 To sPETableType
  3540    Put PETableType_Size To sPETableType At PETableType.StructSize
  3541    GetAddress Of sPETableType To pPETableType
  3542    Move (PEGetNthTableType(iPrintJob,iTableN,pPETableType)) To iResult
  3543    Send HandlePossibleError
  3544    GetBuff From sPETableType At PETableType.DBType To iResult
  3545    Function_Return iResult
  3546  End_Function // NthTableDBType
  3547
  3548  Function NthTableLogOnServerName Integer iTableN Returns String
  3549    Integer iPrintJob iResult
  3550    String sPELogOnInfo sReturn
  3551    Pointer pPELogOnInfo
  3552    Get PrintJob To iPrintJob
  3553    FillType PELogOnInfo With 0 To sPELogOnInfo
  3554    Put PELogOnInfo_Size To sPELogOnInfo At PELogOnInfo.StructSize
  3555    GetAddress Of sPELogOnInfo To pPELogOnInfo
  3556    Move (PEGetNthTableLogOnInfo(iPrintJob,iTableN,pPELogOnInfo)) To iResult
  3557    Send HandlePossibleError
  3558    GetBuff_String From sPELogOnInfo At PELogOnInfo.ServerName To sReturn
  3559    Function_Return (ToOEM(sReturn))
  3560  End_Function // NthTableLogOnServerName
  3561
  3562  Function NthTableLogOnDatabaseName Integer iTableN Returns String
  3563    Integer iPrintJob iResult
  3564    String sPELogOnInfo sReturn
  3565    Pointer pPELogOnInfo
  3566    Get PrintJob To iPrintJob
  3567    FillType PELogOnInfo With 0 To sPELogOnInfo
  3568    Put PELogOnInfo_Size To sPELogOnInfo At PELogOnInfo.StructSize
  3569    GetAddress Of sPELogOnInfo To pPELogOnInfo
  3570    Move (PEGetNthTableLogOnInfo(iPrintJob,iTableN,pPELogOnInfo)) To iResult
  3571    Send HandlePossibleError
  3572    GetBuff_String From sPELogOnInfo At PELogOnInfo.DatabaseName To sReturn
  3573    Function_Return (ToOEM(sReturn))
  3574  End_Function // NthTableLogOnDatabaseName
  3575
  3576  Function NthTableLogOnUserID Integer iTableN Returns String
  3577    Integer iPrintJob iResult
  3578    String sPELogOnInfo sReturn
  3579    Pointer pPELogOnInfo
  3580    Get PrintJob To iPrintJob
  3581    FillType PELogOnInfo With 0 To sPELogOnInfo
  3582    Put PELogOnInfo_Size To sPELogOnInfo At PELogOnInfo.StructSize
  3583    GetAddress Of sPELogOnInfo To pPELogOnInfo
  3584    Move (PEGetNthTableLogOnInfo(iPrintJob,iTableN,pPELogOnInfo)) To iResult
  3585    Send HandlePossibleError
  3586    GetBuff_String From sPELogOnInfo At PELogOnInfo.UserID To sReturn
  3587    Function_Return (ToOEM(sReturn))
  3588  End_Function // NthTableLogOnUserID
  3589
  3590  Function NthTableLogOnPassword Integer iTableN Returns String
  3591    Integer iPrintJob iResult
  3592    String sPELogOnInfo sReturn
  3593    Pointer pPELogOnInfo
  3594    Get PrintJob To iPrintJob
  3595    FillType PELogOnInfo With 0 To sPELogOnInfo
  3596    Put PELogOnInfo_Size To sPELogOnInfo At PELogOnInfo.StructSize
  3597    GetAddress Of sPELogOnInfo To pPELogOnInfo
  3598    Move (PEGetNthTableLogOnInfo(iPrintJob,iTableN,pPELogOnInfo)) To iResult
  3599    Send HandlePossibleError
  3600    GetBuff_String From sPELogOnInfo At PELogOnInfo.Password To sReturn
  3601    Function_Return (ToOEM(sReturn))
  3602  End_Function // NthTableLogOnPassword
  3603
  3604  Procedure Set NthTableLogOnServerName Integer iTableN String sServerName Integer iPropagateAcrossTables
  3605    Integer iPrintJob iResult
  3606    String sPELogOnInfo
  3607    Pointer pPELogOnInfo
  3608    Get PrintJob To iPrintJob
  3609    FillType PELogOnInfo With 0 To sPELogOnInfo
  3610    Put PELogOnInfo_Size To sPELogOnInfo At PELogOnInfo.StructSize
  3611    GetAddress Of sPELogOnInfo To pPELogOnInfo
  3612    Move (PEGetNthTableLogOnInfo(iPrintJob,iTableN,pPELogOnInfo)) To iResult
  3613    Send HandlePossibleError
  3614    Move (ToANSI(sServerName+Character(0))) To sServerName
  3615    Put_String sServerName To sPELogOnInfo At PELogOnInfo.ServerName
  3616    GetAddress Of sPELogOnInfo To pPELogOnInfo
  3617    Move (PESetNthTableLogOnInfo(iPrintJob,iTableN,pPELogOnInfo,iPropagateAcrossTables)) To iResult
  3618    Send HandlePossibleError
  3619  End_Procedure // Set NthTableLogOnServerName
  3620
  3621  Procedure Set NthTableLogOnDatabaseName Integer iTableN String sDatabaseName Integer iPropagateAcrossTables
  3622    Integer iPrintJob iResult
  3623    String sPELogOnInfo
  3624    Pointer pPELogOnInfo
  3625    Get PrintJob To iPrintJob
  3626    FillType PELogOnInfo With 0 To sPELogOnInfo
  3627    Put PELogOnInfo_Size To sPELogOnInfo At PELogOnInfo.StructSize
  3628    GetAddress Of sPELogOnInfo To pPELogOnInfo
  3629    Move (PEGetNthTableLogOnInfo(iPrintJob,iTableN,pPELogOnInfo)) To iResult
  3630    Send HandlePossibleError
  3631    Move (ToANSI(sDatabaseName+Character(0))) To sDatabaseName
  3632    Put_String sDatabaseName To sPELogOnInfo At PELogOnInfo.DatabaseName
  3633    GetAddress Of sPELogOnInfo To pPELogOnInfo
  3634    Move (PESetNthTableLogOnInfo(iPrintJob,iTableN,pPELogOnInfo,iPropagateAcrossTables)) To iResult
  3635    Send HandlePossibleError
  3636  End_Procedure // Set NthTableLogOnDatabaseName
  3637
  3638  Procedure Set NthTableLogOnUserID Integer iTableN String sUserID Integer iPropagateAcrossTables
  3639    Integer iPrintJob iResult
  3640    String sPELogOnInfo
  3641    Pointer pPELogOnInfo
  3642    Get PrintJob To iPrintJob
  3643    FillType PELogOnInfo With 0 To sPELogOnInfo
  3644    Put PELogOnInfo_Size To sPELogOnInfo At PELogOnInfo.StructSize
  3645    GetAddress Of sPELogOnInfo To pPELogOnInfo
  3646    Move (PEGetNthTableLogOnInfo(iPrintJob,iTableN,pPELogOnInfo)) To iResult
  3647    Send HandlePossibleError
  3648    Move (ToANSI(sUserID+Character(0))) To sUserID
  3649    Put_String sUserID To sPELogOnInfo At PELogOnInfo.UserID
  3650    GetAddress Of sPELogOnInfo To pPELogOnInfo
  3651    Move (PESetNthTableLogOnInfo(iPrintJob,iTableN,pPELogOnInfo,iPropagateAcrossTables)) To iResult
  3652    Send HandlePossibleError
  3653  End_Procedure // Set NthTableLogOnUserID
  3654
  3655  Procedure Set NthTableLogOnPassword Integer iTableN String sPassword Integer iPropagateAcrossTables
  3656    Integer iPrintJob iResult
  3657    String sPELogOnInfo
  3658    Pointer pPELogOnInfo
  3659    Get PrintJob To iPrintJob
  3660    FillType PELogOnInfo With 0 To sPELogOnInfo
  3661    Put PELogOnInfo_Size To sPELogOnInfo At PELogOnInfo.StructSize
  3662    GetAddress Of sPELogOnInfo To pPELogOnInfo
  3663    Move (PEGetNthTableLogOnInfo(iPrintJob,iTableN,pPELogOnInfo)) To iResult
  3664    Send HandlePossibleError
  3665    Move (ToANSI(sPassword+Character(0))) To sPassword
  3666    Put_String sPassword To sPELogOnInfo At PELogOnInfo.Password
  3667    GetAddress Of sPELogOnInfo To pPELogOnInfo
  3668    Move (PESetNthTableLogOnInfo(iPrintJob,iTableN,pPELogOnInfo,iPropagateAcrossTables)) To iResult
  3669    Send HandlePossibleError
  3670  End_Procedure // Set NthTableLogOnPassword
  3671
  3672  { MethodType=Property }
  3673  Function NthTableLocation Integer iTableN Returns String
  3674    Integer iPrintJob iResult
  3675    String sPETableLocation sReturn
  3676    Pointer pPETableLocation
  3677    Get PrintJob To iPrintJob
  3678    FillType PETableLocation With 0 To sPETableLocation
  3679    Put PETableLocation_Size To sPETableLocation At PETableLocation.StructSize
  3680    GetAddress Of sPETableLocation To pPETableLocation
  3681    Move (PEGetNthTableLocation(iPrintJob,iTableN,pPETableLocation)) To iResult
  3682    Send HandlePossibleError
  3683    GetBuff_String From sPETableLocation At PETableLocation.Location To sReturn
  3684    Function_Return (ToOEM(sReturn))
  3685  End_Function // NthTableLocation
  3686
  3687  { MethodType=Property }
  3688  Procedure Set NthTableLocation Integer iTableN String sLocation
  3689    Integer iPrintJob iResult
  3690    String sPETableLocation
  3691    Pointer pPETableLocation
  3692    Get PrintJob To iPrintJob
  3693    Move (ToANSI(sLocation+Character(0))) To sLocation
  3694    FillType PETableLocation With 0 To sPETableLocation
  3695    Put PETableLocation_Size To sPETableLocation At PETableLocation.StructSize
  3696    Put_String sLocation To sPETableLocation At PETableLocation.Location
  3697    GetAddress Of sPETableLocation To pPETableLocation
  3698    Move (PESetNthTableLocation(iPrintJob,iTableN,pPETableLocation)) To iResult
  3699    Send HandlePossibleError
  3700  End_Procedure // Set NthTableLocation
  3701
  3702  //*** BW, Chgencged function name from TextNthTableConnectivity
  3703  Function TestNthTableConnectivity Integer iTableN Returns Integer
  3704    Integer iPrintJob iResult
  3705    Get PrintJob To iPrintJob
  3706    Move (PETestNthTableConnectivity(iPrintJob,iTablen)) To iResult
  3707    Send HandlePossibleError
  3708    Function_Return iResult
  3709  End_Function // TestNthTableConnectivity
  3710
  3711  Function NthTableSessionUserID Integer iTableN Returns String
  3712    Integer iPrintJob iResult
  3713    String sPESessionInfo sReturn
  3714    Pointer pPESessionInfo
  3715    Get PrintJob To iPrintJob
  3716    FillType PESessionInfo With 0 To sPESessionInfo
  3717    Put PESessionInfo_Size To sPESessionInfo At PESessionInfo.StructSize
  3718    GetAddress Of sPESessionInfo To pPESessionInfo
  3719    Move (PEGetNthTableSessionInfo(iPrintJob,iTableN,pPESessionInfo)) To iResult
  3720    Send HandlePossibleError
  3721    GetBuff_String From sPESessionInfo At PESessionInfo.UserID To sReturn
  3722    Function_Return (ToOEM(sReturn))
  3723  End_Function // NthTableSessionUserID
  3724
  3725  Function NthTableSessionPassword Integer iTableN Returns String
  3726    Integer iPrintJob iResult
  3727    String sPESessionInfo sReturn
  3728    Pointer pPESessionInfo
  3729    Get PrintJob To iPrintJob
  3730    FillType PESessionInfo With 0 To sPESessionInfo
  3731    Put PESessionInfo_Size To sPESessionInfo At PESessionInfo.StructSize
  3732    GetAddress Of sPESessionInfo To pPESessionInfo
  3733    Move (PEGetNthTableSessionInfo(iPrintJob,iTableN,pPESessionInfo)) To iResult
  3734    Send HandlePossibleError
  3735    GetBuff_String From sPESessionInfo At PESessionInfo.Password To sReturn
  3736    Function_Return (ToOEM(sReturn))
  3737  End_Function // NthTableSessionPassword
  3738
  3739  Function NthTableSessionHandle Integer iTableN Returns Integer
  3740    Integer iPrintJob iResult
  3741    String sPESessionInfo
  3742    Pointer pPESessionInfo
  3743    Get PrintJob To iPrintJob
  3744    FillType PESessionInfo With 0 To sPESessionInfo
  3745    Put PESessionInfo_Size To sPESessionInfo At PESessionInfo.StructSize
  3746    GetAddress Of sPESessionInfo To pPESessionInfo
  3747    Move (PEGetNthTableSessionInfo(iPrintJob,iTableN,pPESessionInfo)) To iResult
  3748    Send HandlePossibleError
  3749    GetBuff From sPESessionInfo At PESessionInfo.SessionHandle To iResult
  3750    Function_Return iResult
  3751  End_Function // NthTableSessionHandle
  3752
  3753  Procedure Set NthTableSessionUserID Integer iTableN String sUserID Integer iPropagateAcrossTables
  3754    Integer iPrintJob iResult
  3755    String sPESessionInfo
  3756    Pointer pPESessionInfo
  3757    Get PrintJob To iPrintJob
  3758    FillType PESessionInfo With 0 To sPESessionInfo
  3759    Put PESessionInfo_Size To sPESessionInfo At PESessionInfo.StructSize
  3760    GetAddress Of sPESessionInfo To pPESessionInfo
  3761    Move (PEGetNthTableSessionInfo(iPrintJob,iTableN,pPESessionInfo)) To iResult
  3762    Send HandlePossibleError
  3763    Move (ToANSI(sUserID+Character(0))) To sUserID
  3764    Put_String sUserID To sPESessionInfo At PESessionInfo.UserID
  3765    GetAddress Of sPESessionInfo To pPESessionInfo
  3766    Move (PESetNthTableSessionInfo(iPrintJob,iTableN,pPESessionInfo,iPropagateAcrossTables)) To iResult
  3767    Send HandlePossibleError
  3768  End_Procedure // Set NthTableSessionUserID
  3769
  3770  Procedure Set NthTableSessionPassword Integer iTableN String sPassword Integer iPropagateAcrossTables
  3771    Integer iPrintJob iResult
  3772    String sPESessionInfo
  3773    Pointer pPESessionInfo
  3774    Get PrintJob To iPrintJob
  3775    FillType PESessionInfo With 0 To sPESessionInfo
  3776    Put PESessionInfo_Size To sPESessionInfo At PESessionInfo.StructSize
  3777    GetAddress Of sPESessionInfo To pPESessionInfo
  3778    Move (PEGetNthTableSessionInfo(iPrintJob,iTableN,pPESessionInfo)) To iResult
  3779    Send HandlePossibleError
  3780    Move (ToANSI(sPassword+Character(0))) To sPassword
  3781    Put_String sPassword To sPESessionInfo At PESessionInfo.Password
  3782    GetAddress Of sPESessionInfo To pPESessionInfo
  3783    Move (PESetNthTableSessionInfo(iPrintJob,iTableN,pPESessionInfo,iPropagateAcrossTables)) To iResult
  3784    Send HandlePossibleError
  3785  End_Procedure // Set NthTableSessionPassword
  3786
  3787  Procedure NthTableSessionHandle Integer iTableN Integer iHandle Integer iPropagateAcrossTables
  3788    Integer iPrintJob iResult
  3789    String sPESessionInfo
  3790    Pointer pPESessionInfo
  3791    Get PrintJob To iPrintJob
  3792    FillType PESessionInfo With 0 To sPESessionInfo
  3793    Put PESessionInfo_Size To sPESessionInfo At PESessionInfo.StructSize
  3794    GetAddress Of sPESessionInfo To pPESessionInfo
  3795    Move (PEGetNthTableSessionInfo(iPrintJob,iTableN,pPESessionInfo)) To iResult
  3796    Send HandlePossibleError
  3797    Put iHandle To sPESessionInfo At PESessionInfo.SessionHandle
  3798    GetAddress Of sPESessionInfo To pPESessionInfo
  3799    Move (PESetNthTableSessionInfo(iPrintJob,iTableN,pPESessionInfo,iPropagateAcrossTables)) To iResult
  3800    Send HandlePossibleError
  3801  End_Procedure // NthTableSessionHandle
  3802
  3803  // *********************************************************************** //
  3804  // ** Graph/Chart Management Functions                                  ** //
  3805  // *********************************************************************** //
  3806
  3807  { MethodType=Property }
  3808  Function GraphRowGroupN Integer iSectionCode Integer iGraphN Returns Integer
  3809    Integer iPrintJob iResult
  3810    String sPEGraphDataInfo
  3811    Pointer pPEGraphDataInfo
  3812    Get PrintJob To iPrintJob
  3813    FillType PEGraphDataInfo With 0 To sPEGraphDataInfo
  3814    Put PEGraphDataInfo_Size To sPEGraphDataInfo At PEGraphDataInfo.StructSize
  3815    GetAddress Of sPEGraphDataInfo To pPEGraphDataInfo
  3816    Move (PEGetGraphData(iPrintJob,iSectionCode,iGraphN,pPEGraphDataInfo)) To iResult
  3817    Send HandlePossibleError
  3818    GetBuff From sPEGraphDataInfo At PEGraphDataInfo.rowGroupN To iResult
  3819    Function_Return iResult
  3820  End_Function // GraphRowGroupN
  3821
  3822  { MethodType=Property }
  3823  Function GraphColGroupN Integer iSectionCode Integer iGraphN Returns Integer
  3824    Integer iPrintJob iResult
  3825    String sPEGraphDataInfo
  3826    Pointer pPEGraphDataInfo
  3827    Get PrintJob To iPrintJob
  3828    FillType PEGraphDataInfo With 0 To sPEGraphDataInfo
  3829    Put PEGraphDataInfo_Size To sPEGraphDataInfo At PEGraphDataInfo.StructSize
  3830    GetAddress Of sPEGraphDataInfo To pPEGraphDataInfo
  3831    Move (PEGetGraphData(iPrintJob,iSectionCode,iGraphN,pPEGraphDataInfo)) To iResult
  3832    Send HandlePossibleError
  3833    GetBuff From sPEGraphDataInfo At PEGraphDataInfo.colGroupN To iResult
  3834    Function_Return iResult
  3835  End_Function // GraphColGroupN
  3836
  3837  { MethodType=Property }
  3838  Function GraphSummarizedFieldN Integer iSectionCode Integer iGraphN Returns Integer
  3839    Integer iPrintJob iResult
  3840    String sPEGraphDataInfo
  3841    Pointer pPEGraphDataInfo
  3842    Get PrintJob To iPrintJob
  3843    FillType PEGraphDataInfo With 0 To sPEGraphDataInfo
  3844    Put PEGraphDataInfo_Size To sPEGraphDataInfo At PEGraphDataInfo.StructSize
  3845    GetAddress Of sPEGraphDataInfo To pPEGraphDataInfo
  3846    Move (PEGetGraphData(iPrintJob,iSectionCode,iGraphN,pPEGraphDataInfo)) To iResult
  3847    Send HandlePossibleError
  3848    GetBuff From sPEGraphDataInfo At PEGraphDataInfo.summarizedFieldN To iResult
  3849    Function_Return iResult
  3850  End_Function // GraphSummarizedFieldN
  3851
  3852  { MethodType=Property }
  3853  Function GraphDirection Integer iSectionCode Integer iGraphN Returns Integer
  3854    Integer iPrintJob iResult
  3855    String sPEGraphDataInfo
  3856    Pointer pPEGraphDataInfo
  3857    Get PrintJob To iPrintJob
  3858    FillType PEGraphDataInfo With 0 To sPEGraphDataInfo
  3859    Put PEGraphDataInfo_Size To sPEGraphDataInfo At PEGraphDataInfo.StructSize
  3860    GetAddress Of sPEGraphDataInfo To pPEGraphDataInfo
  3861    Move (PEGetGraphData(iPrintJob,iSectionCode,iGraphN,pPEGraphDataInfo)) To iResult
  3862    Send HandlePossibleError
  3863    GetBuff From sPEGraphDataInfo At PEGraphDataInfo.graphDirection To iResult
  3864    Function_Return iResult
  3865  End_Function // GraphDirection
  3866
  3867  { MethodType=Property }
  3868  Procedure Set GraphRowGroupN Integer iSectionCode Integer iGraphN Integer iRowGroupN
  3869    Integer iPrintJob iResult
  3870    String sPEGraphDataInfo
  3871    Pointer pPEGraphDataInfo
  3872    Get PrintJob To iPrintJob
  3873    FillType PEGraphDataInfo With 0 To sPEGraphDataInfo
  3874    Put PEGraphDataInfo_Size To sPEGraphDataInfo At PEGraphDataInfo.StructSize
  3875    GetAddress Of sPEGraphDataInfo To pPEGraphDataInfo
  3876    Move (PEGetGraphData(iPrintJob,iSectionCode,iGraphN,pPEGraphDataInfo)) To iResult
  3877    Send HandlePossibleError
  3878    Put iRowGroupN To sPEGraphDataInfo At PEGraphDataInfo.rowGroupN
  3879    GetAddress Of sPEGraphDataInfo To pPEGraphDataInfo
  3880    Move (PESetGraphData(iPrintJob,iSectionCode,iGraphN,pPEGraphDataInfo)) To iResult
  3881    Send HandlePossibleError
  3882  End_Procedure // Set GraphRowGroupN
  3883
  3884  { MethodType=Property }
  3885  Procedure Set GraphColGroupN Integer iSectionCode Integer iGraphN Integer iColGroupN
  3886    Integer iPrintJob iResult
  3887    String sPEGraphDataInfo
  3888    Pointer pPEGraphDataInfo
  3889    Get PrintJob To iPrintJob
  3890    FillType PEGraphDataInfo With 0 To sPEGraphDataInfo
  3891    Put PEGraphDataInfo_Size To sPEGraphDataInfo At PEGraphDataInfo.StructSize
  3892    GetAddress Of sPEGraphDataInfo To pPEGraphDataInfo
  3893    Move (PEGetGraphData(iPrintJob,iSectionCode,iGraphN,pPEGraphDataInfo)) To iResult
  3894    Send HandlePossibleError
  3895    Put iColGroupN To sPEGraphDataInfo At PEGraphDataInfo.colGroupN
  3896    GetAddress Of sPEGraphDataInfo To pPEGraphDataInfo
  3897    Move (PESetGraphData(iPrintJob,iSectionCode,iGraphN,pPEGraphDataInfo)) To iResult
  3898    Send HandlePossibleError
  3899  End_Procedure // Set GraphColGroupN
  3900
  3901  { MethodType=Property }
  3902  Procedure Set GraphSummarizedFieldN Integer iSectionCode Integer iGraphN Integer iSummarizedFieldN
  3903    Integer iPrintJob iResult
  3904    String sPEGraphDataInfo
  3905    Pointer pPEGraphDataInfo
  3906    Get PrintJob To iPrintJob
  3907    FillType PEGraphDataInfo With 0 To sPEGraphDataInfo
  3908    Put PEGraphDataInfo_Size To sPEGraphDataInfo At PEGraphDataInfo.StructSize
  3909    GetAddress Of sPEGraphDataInfo To pPEGraphDataInfo
  3910    Move (PEGetGraphData(iPrintJob,iSectionCode,iGraphN,pPEGraphDataInfo)) To iResult
  3911    Send HandlePossibleError
  3912    Put iSummarizedFieldN To sPEGraphDataInfo At PEGraphDataInfo.summarizedFieldN
  3913    GetAddress Of sPEGraphDataInfo To pPEGraphDataInfo
  3914    Move (PESetGraphData(iPrintJob,iSectionCode,iGraphN,pPEGraphDataInfo)) To iResult
  3915    Send HandlePossibleError
  3916  End_Procedure // Set GraphSummarizedFieldN
  3917
  3918  { MethodType=Property }
  3919  Procedure Set GraphDirection Integer iSectionCode Integer iGraphN Integer iDirection
  3920    Integer iPrintJob iResult
  3921    String sPEGraphDataInfo
  3922    Pointer pPEGraphDataInfo
  3923    Get PrintJob To iPrintJob
  3924    FillType PEGraphDataInfo With 0 To sPEGraphDataInfo
  3925    Put PEGraphDataInfo_Size To sPEGraphDataInfo At PEGraphDataInfo.StructSize
  3926    GetAddress Of sPEGraphDataInfo To pPEGraphDataInfo
  3927    Move (PEGetGraphData(iPrintJob,iSectionCode,iGraphN,pPEGraphDataInfo)) To iResult
  3928    Send HandlePossibleError
  3929    Put iDirection To sPEGraphDataInfo At PEGraphDataInfo.graphDirection
  3930    GetAddress Of sPEGraphDataInfo To pPEGraphDataInfo
  3931    Move (PESetGraphData(iPrintJob,iSectionCode,iGraphN,pPEGraphDataInfo)) To iResult
  3932    Send HandlePossibleError
  3933  End_Procedure // Set GraphDirection
  3934
  3935  { MethodType=Property }
  3936  Function GraphMaxValue Integer iSectionCode Integer iGraphN Returns Real
  3937    Integer iPrintJob iResult
  3938    String sPEGraphOptions
  3939    Pointer pPEGraphOptions
  3940    Real rResult
  3941
  3942    // Initialize rResult for AddressOf
  3943    Move 0.0 To rResult
  3944
  3945    Get PrintJob To iPrintJob
  3946    FillType PEGraphOptions With 0 To sPEGraphOptions
  3947    Put PEGraphOptions_Size To sPEGraphOptions At PEGraphOptions.StructSize
  3948    GetAddress Of sPEGraphOptions To pPEGraphOptions
  3949    Move (PEGetGraphOptions(iPrintJob,iSectionCode,iGraphN,pPEGraphOptions)) To iResult
  3950    Send HandlePossibleError
  3951
  3952    // Get the real (double) from the structure
  3953    Move (CopyMemory(AddressOf(rResult),(pPEGraphOptions+2),8)) To iResult
  3954    //RetrieveField From (AddressOf(sPEGraphOptions)) At PEGraphOptions.graphMaxValue To (AddressOf(rResult))
  3955    Function_Return rResult
  3956  End_Function // GraphMaxValue
  3957
  3958  { MethodType=Property }
  3959  Function GraphMinValue Integer iSectionCode Integer iGraphN Returns Real
  3960    Integer iPrintJob iResult
  3961    String sPEGraphOptions
  3962    Pointer pPEGraphOptions
  3963    Real rResult
  3964
  3965    // Initialize rResult for AddressOf
  3966    Move 0.0 To rResult
  3967
  3968    Get PrintJob To iPrintJob
  3969    FillType PEGraphOptions With 0 To sPEGraphOptions
  3970    Put PEGraphOptions_Size To sPEGraphOptions At PEGraphOptions.StructSize
  3971    GetAddress Of sPEGraphOptions To pPEGraphOptions
  3972    Move (PEGetGraphOptions(iPrintJob,iSectionCode,iGraphN,pPEGraphOptions)) To iResult
  3973    Send HandlePossibleError
  3974
  3975    // Get the real (double) from the structure
  3976    Move (CopyMemory(AddressOf(rResult),(pPEGraphOptions+10),8)) To iResult
  3977    //RetrieveField From (AddressOf(sPEGraphOptions)) At PEGraphOptions.graphMinValue To (AddressOf(rResult))
  3978    Function_Return rResult
  3979  End_Function // GraphMinValue
  3980
  3981  { MethodType=Property }
  3982  Function GraphShowDataValue Integer iSectionCode Integer iGraphN Returns Integer
  3983    Integer iPrintJob iResult
  3984    String sPEGraphOptions
  3985    Pointer pPEGraphOptions
  3986    Get PrintJob To iPrintJob
  3987    FillType PEGraphOptions With 0 To sPEGraphOptions
  3988    Put PEGraphOptions_Size To sPEGraphOptions At PEGraphOptions.StructSize
  3989    GetAddress Of sPEGraphOptions To pPEGraphOptions
  3990    Move (PEGetGraphOptions(iPrintJob,iSectionCode,iGraphN,pPEGraphOptions)) To iResult
  3991    Send HandlePossibleError
  3992    GetBuff From sPEGraphOptions At PEGraphOptions.showDataValue To iResult
  3993    Function_Return iResult
  3994  End_Function // GraphShowDataValue
  3995
  3996  { MethodType=Property }
  3997  Function GraphShowGridLine Integer iSectionCode Integer iGraphN Returns Integer
  3998    Integer iPrintJob iResult
  3999    String sPEGraphOptions
  4000    Pointer pPEGraphOptions
  4001    Get PrintJob To iPrintJob
  4002    FillType PEGraphOptions With 0 To sPEGraphOptions
  4003    Put PEGraphOptions_Size To sPEGraphOptions At PEGraphOptions.StructSize
  4004    GetAddress Of sPEGraphOptions To pPEGraphOptions
  4005    Move (PEGetGraphOptions(iPrintJob,iSectionCode,iGraphN,pPEGraphOptions)) To iResult
  4006    Send HandlePossibleError
  4007    GetBuff From sPEGraphOptions At PEGraphOptions.showGridLine To iResult
  4008    Function_Return iResult
  4009  End_Function // GraphShowGridLine
  4010
  4011  { MethodType=Property }
  4012  Function GraphVerticalBars Integer iSectionCode Integer iGraphN Returns Integer
  4013    Integer iPrintJob iResult
  4014    String sPEGraphOptions
  4015    Pointer pPEGraphOptions
  4016    Get PrintJob To iPrintJob
  4017    FillType PEGraphOptions With 0 To sPEGraphOptions
  4018    Put PEGraphOptions_Size To sPEGraphOptions At PEGraphOptions.StructSize
  4019    GetAddress Of sPEGraphOptions To pPEGraphOptions
  4020    Move (PEGetGraphOptions(iPrintJob,iSectionCode,iGraphN,pPEGraphOptions)) To iResult
  4021    Send HandlePossibleError
  4022    GetBuff From sPEGraphOptions At PEGraphOptions.verticalBars To iResult
  4023    Function_Return iResult
  4024  End_Function // GraphVerticalBars
  4025
  4026  { MethodType=Property }
  4027  Function GraphShowLegend Integer iSectionCode Integer iGraphN Returns Integer
  4028    Integer iPrintJob iResult
  4029    String sPEGraphOptions
  4030    Pointer pPEGraphOptions
  4031    Get PrintJob To iPrintJob
  4032    FillType PEGraphOptions With 0 To sPEGraphOptions
  4033    Put PEGraphOptions_Size To sPEGraphOptions At PEGraphOptions.StructSize
  4034    GetAddress Of sPEGraphOptions To pPEGraphOptions
  4035    Move (PEGetGraphOptions(iPrintJob,iSectionCode,iGraphN,pPEGraphOptions)) To iResult
  4036    Send HandlePossibleError
  4037    GetBuff From sPEGraphOptions At PEGraphOptions.showLegend To iResult
  4038    Function_Return iResult
  4039  End_Function // GraphShowLegend
  4040
  4041  { MethodType=Property }
  4042  Function GraphFontFaceName Integer iSectionCode Integer iGraphN Returns String
  4043    Integer iPrintJob iResult
  4044    String sPEGraphOptions sReturn
  4045    Pointer pPEGraphOptions
  4046    Get PrintJob To iPrintJob
  4047    FillType PEGraphOptions With 0 To sPEGraphOptions
  4048    Put PEGraphOptions_Size To sPEGraphOptions At PEGraphOptions.StructSize
  4049    GetAddress Of sPEGraphOptions To pPEGraphOptions
  4050    Move (PEGetGraphOptions(iPrintJob,iSectionCode,iGraphN,pPEGraphOptions)) To iResult
  4051    Send HandlePossibleError
  4052    GetBuff_String From sPEGraphOptions At PEGraphOptions.fontFaceName To sReturn
  4053    Function_Return (ToOEM(sReturn))
  4054  End_Function // GraphFontFaceName
  4055
  4056  { MethodType=Property }
  4057  Procedure Set GraphMaxValue Integer iSectionCode Integer iGraphN Real rMaxValue
  4058    Integer iPrintJob iResult
  4059    String sPEGraphOptions sDouble
  4060    Pointer pPEGraphOptions
  4061
  4062    // Initialize rMaxValue for AddressOf
  4063    Move rMaxValue To rMaxValue
  4064
  4065    Get PrintJob To iPrintJob
  4066    FillType PEGraphOptions With 0 To sPEGraphOptions
  4067    Put PEGraphOptions_Size To sPEGraphOptions At PEGraphOptions.StructSize
  4068    GetAddress Of sPEGraphOptions To pPEGraphOptions
  4069    Move (PEGetGraphOptions(iPrintJob,iSectionCode,iGraphN,pPEGraphOptions)) To iResult
  4070    Send HandlePossibleError
  4071
  4072    // Copy the double to the structure
  4073    Move (CopyMemory((pPEGraphOptions+2),AddressOf(rMaxValue),8)) To WindowIndex
  4074    //StoreField (AddressOf(rMaxValue)) To (AddressOf(sPEGraphOptions)) At PEGraphOptions.graphMaxValue
  4075    GetAddress Of sPEGraphOptions To pPEGraphOptions
  4076    Move (PESetGraphOptions(iPrintJob,iSectionCode,iGraphN,pPEGraphOptions)) To iResult
  4077    Send HandlePossibleError
  4078  End_Procedure // Set GraphMaxValue
  4079
  4080  { MethodType=Property }
  4081  Procedure Set GraphMinValue Integer iSectionCode Integer iGraphN Real rMinValue
  4082    Integer iPrintJob iResult
  4083    String sPEGraphOptions sDouble
  4084    Pointer pPEGraphOptions
  4085
  4086    // Initialize rMinValue for AddressOf
  4087    Move rMinValue To rMinValue
  4088
  4089    Get PrintJob To iPrintJob
  4090    FillType PEGraphOptions With 0 To sPEGraphOptions
  4091    Put PEGraphOptions_Size To sPEGraphOptions At PEGraphOptions.StructSize
  4092    GetAddress Of sPEGraphOptions To pPEGraphOptions
  4093    Move (PEGetGraphOptions(iPrintJob,iSectionCode,iGraphN,pPEGraphOptions)) To iResult
  4094    Send HandlePossibleError
  4095
  4096    // Copy the double to the structure
  4097    Move (CopyMemory((pPEGraphOptions+10),AddressOf(rMinValue),8)) To WindowIndex
  4098    //StoreField (AddressOf(rMinValue)) To (AddressOf(sPEGraphOptions)) At PEGraphOptions.graphMinValue
  4099    GetAddress Of sPEGraphOptions To pPEGraphOptions
  4100    Move (PESetGraphOptions(iPrintJob,iSectionCode,iGraphN,pPEGraphOptions)) To iResult
  4101    Send HandlePossibleError
  4102  End_Procedure // Set GraphMinValue
  4103
  4104  { MethodType=Property }
  4105  Procedure Set GraphShowDataValue Integer iSectionCode Integer iGraphN Integer iShowDataValue
  4106    Integer iPrintJob iResult
  4107    String sPEGraphOptions
  4108    Pointer pPEGraphOptions
  4109    Get PrintJob To iPrintJob
  4110    FillType PEGraphOptions With 0 To sPEGraphOptions
  4111    Put PEGraphOptions_Size To sPEGraphOptions At PEGraphOptions.StructSize
  4112    GetAddress Of sPEGraphOptions To pPEGraphOptions
  4113    Move (PEGetGraphOptions(iPrintJob,iSectionCode,iGraphN,pPEGraphOptions)) To iResult
  4114    Send HandlePossibleError
  4115    Put iShowDataValue To sPEGraphOptions At PEGraphOptions.showDataValue
  4116    GetAddress Of sPEGraphOptions To pPEGraphOptions
  4117    Move (PESetGraphOptions(iPrintJob,iSectionCode,iGraphN,pPEGraphOptions)) To iResult
  4118    Send HandlePossibleError
  4119  End_Procedure // Set GraphShowDataValue
  4120
  4121  { MethodType=Property }
  4122  Procedure Set GraphShowGridLine Integer iSectionCode Integer iGraphN Integer iShowGridLine
  4123    Integer iPrintJob iResult
  4124    String sPEGraphOptions
  4125    Pointer pPEGraphOptions
  4126    Get PrintJob To iPrintJob
  4127    FillType PEGraphOptions With 0 To sPEGraphOptions
  4128    Put PEGraphOptions_Size To sPEGraphOptions At PEGraphOptions.StructSize
  4129    GetAddress Of sPEGraphOptions To pPEGraphOptions
  4130    Move (PEGetGraphOptions(iPrintJob,iSectionCode,iGraphN,pPEGraphOptions)) To iResult
  4131    Send HandlePossibleError
  4132    Put iShowGridLine To sPEGraphOptions At PEGraphOptions.showGridLine
  4133    GetAddress Of sPEGraphOptions To pPEGraphOptions
  4134    Move (PESetGraphOptions(iPrintJob,iSectionCode,iGraphN,pPEGraphOptions)) To iResult
  4135    Send HandlePossibleError
  4136  End_Procedure // Set GraphShowGridLine
  4137
  4138  { MethodType=Property }
  4139  Procedure Set GraphVerticalBars Integer iSectionCode Integer iGraphN Integer iVerticalBars
  4140    Integer iPrintJob iResult
  4141    String sPEGraphOptions
  4142    Pointer pPEGraphOptions
  4143    Get PrintJob To iPrintJob
  4144    FillType PEGraphOptions With 0 To sPEGraphOptions
  4145    Put PEGraphOptions_Size To sPEGraphOptions At PEGraphOptions.StructSize
  4146    GetAddress Of sPEGraphOptions To pPEGraphOptions
  4147    Move (PEGetGraphOptions(iPrintJob,iSectionCode,iGraphN,pPEGraphOptions)) To iResult
  4148    Send HandlePossibleError
  4149    Put iVerticalBars To sPEGraphOptions At PEGraphOptions.verticalBars
  4150    GetAddress Of sPEGraphOptions To pPEGraphOptions
  4151    Move (PESetGraphOptions(iPrintJob,iSectionCode,iGraphN,pPEGraphOptions)) To iResult
  4152    Send HandlePossibleError
  4153  End_Procedure // Set GraphVerticalBars
  4154
  4155  { MethodType=Property }
  4156  Procedure Set GraphShowLegend Integer iSectionCode Integer iGraphN Integer iShowLegend
  4157    Integer iPrintJob iResult
  4158    String sPEGraphOptions
  4159    Pointer pPEGraphOptions
  4160    Get PrintJob To iPrintJob
  4161    FillType PEGraphOptions With 0 To sPEGraphOptions
  4162    Put PEGraphOptions_Size To sPEGraphOptions At PEGraphOptions.StructSize
  4163    GetAddress Of sPEGraphOptions To pPEGraphOptions
  4164    Move (PEGetGraphOptions(iPrintJob,iSectionCode,iGraphN,pPEGraphOptions)) To iResult
  4165    Send HandlePossibleError
  4166    Put iShowLegend To sPEGraphOptions At PEGraphOptions.showLegend
  4167    GetAddress Of sPEGraphOptions To pPEGraphOptions
  4168    Move (PESetGraphOptions(iPrintJob,iSectionCode,iGraphN,pPEGraphOptions)) To iResult
  4169    Send HandlePossibleError
  4170  End_Procedure // Set GraphShowLegend
  4171
  4172  { MethodType=Property }
  4173  Procedure Set GraphFontFaceName Integer iSectionCode Integer iGraphN String sFontFaceName
  4174    Integer iPrintJob iResult
  4175    String sPEGraphOptions
  4176    Pointer pPEGraphOptions
  4177    Get PrintJob To iPrintJob
  4178    Move (ToANSI(sFontFaceName+Character(0))) To sFontFaceName
  4179    FillType PEGraphOptions With 0 To sPEGraphOptions
  4180    Put PEGraphOptions_Size To sPEGraphOptions At PEGraphOptions.StructSize
  4181    GetAddress Of sPEGraphOptions To pPEGraphOptions
  4182    Move (PEGetGraphOptions(iPrintJob,iSectionCode,iGraphN,pPEGraphOptions)) To iResult
  4183    Send HandlePossibleError
  4184    Put_String sFontFaceName To sPEGraphOptions At PEGraphOptions.fontFaceName
  4185    GetAddress Of sPEGraphOptions To pPEGraphOptions
  4186    Move (PESetGraphOptions(iPrintJob,iSectionCode,iGraphN,pPEGraphOptions)) To iResult
  4187    Send HandlePossibleError
  4188  End_Procedure // Set GraphFontFaceName
  4189
  4190  { MethodType=Property }
  4191  Function GraphTitle Integer iSectionCode Integer iGraphN Returns String
  4192    Integer iPrintJob iResult
  4193    String sPEGraphTextInfo sReturn
  4194    Pointer pPEGraphTextInfo
  4195    Get PrintJob To iPrintJob
  4196    FillType PEGraphTextInfo With 0 To sPEGraphTextInfo
  4197    Put PEGraphTextInfo_Size To sPEGraphTextInfo At PEGraphTextInfo.StructSize
  4198    GetAddress Of sPEGraphTextInfo To pPEGraphTextInfo
  4199    Move (PEGetGraphText(iPrintJob,iSectionCode,iGraphN,pPEGraphTextInfo)) To iResult
  4200    Send HandlePossibleError
  4201    GetBuff_String From sPEGraphTextInfo At PEGraphTextInfo.graphTitle To sReturn
  4202    Function_Return (ToOEM(sReturn))
  4203  End_Function // GraphTitle
  4204
  4205  { MethodType=Property }
  4206  Function GraphSubTitle Integer iSectionCode Integer iGraphN Returns String
  4207    Integer iPrintJob iResult
  4208    String sPEGraphTextInfo sReturn
  4209    Pointer pPEGraphTextInfo
  4210    Get PrintJob To iPrintJob
  4211    FillType PEGraphTextInfo With 0 To sPEGraphTextInfo
  4212    Put PEGraphTextInfo_Size To sPEGraphTextInfo At PEGraphTextInfo.StructSize
  4213    GetAddress Of sPEGraphTextInfo To pPEGraphTextInfo
  4214    Move (PEGetGraphText(iPrintJob,iSectionCode,iGraphN,pPEGraphTextInfo)) To iResult
  4215    Send HandlePossibleError
  4216    GetBuff_String From sPEGraphTextInfo At PEGraphTextInfo.graphSubTitle To sReturn
  4217    Function_Return (ToOEM(sReturn))
  4218  End_Function // GraphSubTitle
  4219
  4220  { MethodType=Property }
  4221  Function GraphFootNote Integer iSectionCode Integer iGraphN Returns String
  4222    Integer iPrintJob iResult
  4223    String sPEGraphTextInfo sReturn
  4224    Pointer pPEGraphTextInfo
  4225    Get PrintJob To iPrintJob
  4226    FillType PEGraphTextInfo With 0 To sPEGraphTextInfo
  4227    Put PEGraphTextInfo_Size To sPEGraphTextInfo At PEGraphTextInfo.StructSize
  4228    GetAddress Of sPEGraphTextInfo To pPEGraphTextInfo
  4229    Move (PEGetGraphText(iPrintJob,iSectionCode,iGraphN,pPEGraphTextInfo)) To iResult
  4230    Send HandlePossibleError
  4231    GetBuff_String From sPEGraphTextInfo At PEGraphTextInfo.graphFootNote To sReturn
  4232    Function_Return (ToOEM(sReturn))
  4233  End_Function // GraphFootNote
  4234
  4235  { MethodType=Property }
  4236  Function GraphGroupsTitle Integer iSectionCode Integer iGraphN Returns String
  4237    Integer iPrintJob iResult
  4238    String sPEGraphTextInfo sReturn
  4239    Pointer pPEGraphTextInfo
  4240    Get PrintJob To iPrintJob
  4241    FillType PEGraphTextInfo With 0 To sPEGraphTextInfo
  4242    Put PEGraphTextInfo_Size To sPEGraphTextInfo At PEGraphTextInfo.StructSize
  4243    GetAddress Of sPEGraphTextInfo To pPEGraphTextInfo
  4244    Move (PEGetGraphText(iPrintJob,iSectionCode,iGraphN,pPEGraphTextInfo)) To iResult
  4245    Send HandlePossibleError
  4246    GetBuff_String From sPEGraphTextInfo At PEGraphTextInfo.graphGroupsTitle To sReturn
  4247    Function_Return (ToOEM(sReturn))
  4248  End_Function // GraphGroupsTitle
  4249
  4250  { MethodType=Property }
  4251  Function GraphSeriesTitle Integer iSectionCode Integer iGraphN Returns String
  4252    Integer iPrintJob iResult
  4253    String sPEGraphTextInfo sReturn
  4254    Pointer pPEGraphTextInfo
  4255    Get PrintJob To iPrintJob
  4256    FillType PEGraphTextInfo With 0 To sPEGraphTextInfo
  4257    Put PEGraphTextInfo_Size To sPEGraphTextInfo At PEGraphTextInfo.StructSize
  4258    GetAddress Of sPEGraphTextInfo To pPEGraphTextInfo
  4259    Move (PEGetGraphText(iPrintJob,iSectionCode,iGraphN,pPEGraphTextInfo)) To iResult
  4260    Send HandlePossibleError
  4261    GetBuff_String From sPEGraphTextInfo At PEGraphTextInfo.graphSeriesTitle To sReturn
  4262    Function_Return (ToOEM(sReturn))
  4263  End_Function // GraphSeriesTitle
  4264
  4265  { MethodType=Property }
  4266  Function GraphXAxisTitle Integer iSectionCode Integer iGraphN Returns String
  4267    Integer iPrintJob iResult
  4268    String sPEGraphTextInfo sReturn
  4269    Pointer pPEGraphTextInfo
  4270    Get PrintJob To iPrintJob
  4271    FillType PEGraphTextInfo With 0 To sPEGraphTextInfo
  4272    Put PEGraphTextInfo_Size To sPEGraphTextInfo At PEGraphTextInfo.StructSize
  4273    GetAddress Of sPEGraphTextInfo To pPEGraphTextInfo
  4274    Move (PEGetGraphText(iPrintJob,iSectionCode,iGraphN,pPEGraphTextInfo)) To iResult
  4275    Send HandlePossibleError
  4276    GetBuff_String From sPEGraphTextInfo At PEGraphTextInfo.graphXAxisTitle To sReturn
  4277    Function_Return (ToOEM(sReturn))
  4278  End_Function // GraphXAxisTitle
  4279
  4280  { MethodType=Property }
  4281  Function GraphYAxisTitle Integer iSectionCode Integer iGraphN Returns String
  4282    Integer iPrintJob iResult
  4283    String sPEGraphTextInfo sReturn
  4284    Pointer pPEGraphTextInfo
  4285    Get PrintJob To iPrintJob
  4286    FillType PEGraphTextInfo With 0 To sPEGraphTextInfo
  4287    Put PEGraphTextInfo_Size To sPEGraphTextInfo At PEGraphTextInfo.StructSize
  4288    GetAddress Of sPEGraphTextInfo To pPEGraphTextInfo
  4289    Move (PEGetGraphText(iPrintJob,iSectionCode,iGraphN,pPEGraphTextInfo)) To iResult
  4290    Send HandlePossibleError
  4291    GetBuff_String From sPEGraphTextInfo At PEGraphTextInfo.graphYAxisTitle To sReturn
  4292    Function_Return (ToOEM(sReturn))
  4293  End_Function // GraphYAxisTitle
  4294
  4295  { MethodType=Property }
  4296  Function GraphZAxisTitle Integer iSectionCode Integer iGraphN Returns String
  4297    Integer iPrintJob iResult
  4298    String sPEGraphTextInfo sReturn
  4299    Pointer pPEGraphTextInfo
  4300    Get PrintJob To iPrintJob
  4301    FillType PEGraphTextInfo With 0 To sPEGraphTextInfo
  4302    Put PEGraphTextInfo_Size To sPEGraphTextInfo At PEGraphTextInfo.StructSize
  4303    GetAddress Of sPEGraphTextInfo To pPEGraphTextInfo
  4304    Move (PEGetGraphText(iPrintJob,iSectionCode,iGraphN,pPEGraphTextInfo)) To iResult
  4305    Send HandlePossibleError
  4306    GetBuff_String From sPEGraphTextInfo At PEGraphTextInfo.graphZAxisTitle To sReturn
  4307    Function_Return (ToOEM(sReturn))
  4308  End_Function // GraphZAxisTitle
  4309
  4310  { MethodType=Property }
  4311  Procedure Set GraphTitle Integer iSectionCode Integer iGraphN String sTitle
  4312    Integer iPrintJob iResult
  4313    String sPEGraphTextInfo
  4314    Pointer pPEGraphTextInfo
  4315    Get PrintJob To iPrintJob
  4316    FillType PEGraphTextInfo With 0 To sPEGraphTextInfo
  4317    Put PEGraphTextInfo_Size To sPEGraphTextInfo At PEGraphTextInfo.StructSize
  4318    GetAddress Of sPEGraphTextInfo To pPEGraphTextInfo
  4319    Move (PEGetGraphText(iPrintJob,iSectionCode,iGraphN,pPEGraphTextInfo)) To iResult
  4320    Send HandlePossibleError
  4321    Move (ToANSI(sTitle+Character(0))) To sTitle
  4322    Put_String sTitle To sPEGraphTextInfo At PEGraphTextInfo.graphTitle
  4323    GetAddress Of sPEGraphTextInfo To pPEGraphTextInfo
  4324    Move (PESetGraphText(iPrintJob,iSectionCode,iGraphN,pPEGraphTextInfo)) To iResult
  4325    Send HandlePossibleError
  4326  End_Procedure // Set GraphTitle
  4327
  4328  { MethodType=Property }
  4329  Procedure Set GraphSubTitle Integer iSectionCode Integer iGraphN String sSubTitle
  4330    Integer iPrintJob iResult
  4331    String sPEGraphTextInfo
  4332    Pointer pPEGraphTextInfo
  4333    Get PrintJob To iPrintJob
  4334    FillType PEGraphTextInfo With 0 To sPEGraphTextInfo
  4335    Put PEGraphTextInfo_Size To sPEGraphTextInfo At PEGraphTextInfo.StructSize
  4336    GetAddress Of sPEGraphTextInfo To pPEGraphTextInfo
  4337    Move (PEGetGraphText(iPrintJob,iSectionCode,iGraphN,pPEGraphTextInfo)) To iResult
  4338    Send HandlePossibleError
  4339    Move (ToANSI(sSubTitle+Character(0))) To sSubTitle
  4340    Put_String sSubTitle To sPEGraphTextInfo At PEGraphTextInfo.graphSubTitle
  4341    GetAddress Of sPEGraphTextInfo To pPEGraphTextInfo
  4342    Move (PESetGraphText(iPrintJob,iSectionCode,iGraphN,pPEGraphTextInfo)) To iResult
  4343    Send HandlePossibleError
  4344  End_Procedure // Set GraphSubTitle
  4345
  4346  { MethodType=Property }
  4347  Procedure Set GraphFootNote Integer iSectionCode Integer iGraphN String sFootNote
  4348    Integer iPrintJob iResult
  4349    String sPEGraphTextInfo
  4350    Pointer pPEGraphTextInfo
  4351    Get PrintJob To iPrintJob
  4352    FillType PEGraphTextInfo With 0 To sPEGraphTextInfo
  4353    Put PEGraphTextInfo_Size To sPEGraphTextInfo At PEGraphTextInfo.StructSize
  4354    GetAddress Of sPEGraphTextInfo To pPEGraphTextInfo
  4355    Move (PEGetGraphText(iPrintJob,iSectionCode,iGraphN,pPEGraphTextInfo)) To iResult
  4356    Send HandlePossibleError
  4357    Move (ToANSI(sFootNote+Character(0))) To sFootNote
  4358    Put_String sFootNote To sPEGraphTextInfo At PEGraphTextInfo.graphFootNote
  4359    GetAddress Of sPEGraphTextInfo To pPEGraphTextInfo
  4360    Move (PESetGraphText(iPrintJob,iSectionCode,iGraphN,pPEGraphTextInfo)) To iResult
  4361    Send HandlePossibleError
  4362  End_Procedure // Set GraphFootNote
  4363
  4364  { MethodType=Property }
  4365  Procedure Set GraphGroupsTitle Integer iSectionCode Integer iGraphN String sGroupsTitle
  4366    Integer iPrintJob iResult
  4367    String sPEGraphTextInfo
  4368    Pointer pPEGraphTextInfo
  4369    Get PrintJob To iPrintJob
  4370    FillType PEGraphTextInfo With 0 To sPEGraphTextInfo
  4371    Put PEGraphTextInfo_Size To sPEGraphTextInfo At PEGraphTextInfo.StructSize
  4372    GetAddress Of sPEGraphTextInfo To pPEGraphTextInfo
  4373    Move (PEGetGraphText(iPrintJob,iSectionCode,iGraphN,pPEGraphTextInfo)) To iResult
  4374    Send HandlePossibleError
  4375    Move (ToANSI(sGroupsTitle+Character(0))) To sGroupsTitle
  4376    Put_String sGroupsTitle To sPEGraphTextInfo At PEGraphTextInfo.graphGroupsTitle
  4377    GetAddress Of sPEGraphTextInfo To pPEGraphTextInfo
  4378    Move (PESetGraphText(iPrintJob,iSectionCode,iGraphN,pPEGraphTextInfo)) To iResult
  4379    Send HandlePossibleError
  4380  End_Procedure // Set GraphGroupsTitle
  4381
  4382  { MethodType=Property }
  4383  Procedure Set GraphSeriesTitle Integer iSectionCode Integer iGraphN String sSeriesTitle
  4384    Integer iPrintJob iResult
  4385    String sPEGraphTextInfo
  4386    Pointer pPEGraphTextInfo
  4387    Get PrintJob To iPrintJob
  4388    FillType PEGraphTextInfo With 0 To sPEGraphTextInfo
  4389    Put PEGraphTextInfo_Size To sPEGraphTextInfo At PEGraphTextInfo.StructSize
  4390    GetAddress Of sPEGraphTextInfo To pPEGraphTextInfo
  4391    Move (PEGetGraphText(iPrintJob,iSectionCode,iGraphN,pPEGraphTextInfo)) To iResult
  4392    Send HandlePossibleError
  4393    Move (ToANSI(sSeriesTitle+Character(0))) To sSeriesTitle
  4394    Put_String sSeriesTitle To sPEGraphTextInfo At PEGraphTextInfo.graphSeriesTitle
  4395    GetAddress Of sPEGraphTextInfo To pPEGraphTextInfo
  4396    Move (PESetGraphText(iPrintJob,iSectionCode,iGraphN,pPEGraphTextInfo)) To iResult
  4397    Send HandlePossibleError
  4398  End_Procedure // Set GraphSeriesTitle
  4399
  4400  { MethodType=Property }
  4401  Procedure Set GraphXAxisTitle Integer iSectionCode Integer iGraphN String sXAxisTitle
  4402    Integer iPrintJob iResult
  4403    String sPEGraphTextInfo
  4404    Pointer pPEGraphTextInfo
  4405    Get PrintJob To iPrintJob
  4406    FillType PEGraphTextInfo With 0 To sPEGraphTextInfo
  4407    Put PEGraphTextInfo_Size To sPEGraphTextInfo At PEGraphTextInfo.StructSize
  4408    GetAddress Of sPEGraphTextInfo To pPEGraphTextInfo
  4409    Move (PEGetGraphText(iPrintJob,iSectionCode,iGraphN,pPEGraphTextInfo)) To iResult
  4410    Send HandlePossibleError
  4411    Move (ToANSI(sXAxisTitle+Character(0))) To sXAxisTitle
  4412    Put_String sXAxisTitle To sPEGraphTextInfo At PEGraphTextInfo.graphXAxisTitle
  4413    GetAddress Of sPEGraphTextInfo To pPEGraphTextInfo
  4414    Move (PESetGraphText(iPrintJob,iSectionCode,iGraphN,pPEGraphTextInfo)) To iResult
  4415    Send HandlePossibleError
  4416  End_Procedure // Set GraphXAxisTitle
  4417
  4418  { MethodType=Property }
  4419  Procedure Set GraphYAxisTitle Integer iSectionCode Integer iGraphN String sYAxisTitle
  4420    Integer iPrintJob iResult
  4421    String sPEGraphTextInfo
  4422    Pointer pPEGraphTextInfo
  4423    Get PrintJob To iPrintJob
  4424    FillType PEGraphTextInfo With 0 To sPEGraphTextInfo
  4425    Put PEGraphTextInfo_Size To sPEGraphTextInfo At PEGraphTextInfo.StructSize
  4426    GetAddress Of sPEGraphTextInfo To pPEGraphTextInfo
  4427    Move (PEGetGraphText(iPrintJob,iSectionCode,iGraphN,pPEGraphTextInfo)) To iResult
  4428    Send HandlePossibleError
  4429    Move (ToANSI(sYAxisTitle+Character(0))) To sYAxisTitle
  4430    Put_String sYAxisTitle To sPEGraphTextInfo At PEGraphTextInfo.graphYAxisTitle
  4431    GetAddress Of sPEGraphTextInfo To pPEGraphTextInfo
  4432    Move (PESetGraphText(iPrintJob,iSectionCode,iGraphN,pPEGraphTextInfo)) To iResult
  4433    Send HandlePossibleError
  4434  End_Procedure // Set GraphYAxisTitle
  4435
  4436  { MethodType=Property }
  4437  Procedure Set GraphZAxisTitle Integer iSectionCode Integer iGraphN String sZAxisTitle
  4438    Integer iPrintJob iResult
  4439    String sPEGraphTextInfo
  4440    Pointer pPEGraphTextInfo
  4441    Get PrintJob To iPrintJob
  4442    FillType PEGraphTextInfo With 0 To sPEGraphTextInfo
  4443    Put PEGraphTextInfo_Size To sPEGraphTextInfo At PEGraphTextInfo.StructSize
  4444    GetAddress Of sPEGraphTextInfo To pPEGraphTextInfo
  4445    Move (PEGetGraphText(iPrintJob,iSectionCode,iGraphN,pPEGraphTextInfo)) To iResult
  4446    Send HandlePossibleError
  4447    Move (ToANSI(sZAxisTitle+Character(0))) To sZAxisTitle
  4448    Put_String sZAxisTitle To sPEGraphTextInfo At PEGraphTextInfo.graphZAxisTitle
  4449    GetAddress Of sPEGraphTextInfo To pPEGraphTextInfo
  4450    Move (PESetGraphText(iPrintJob,iSectionCode,iGraphN,pPEGraphTextInfo)) To iResult
  4451    Send HandlePossibleError
  4452  End_Procedure // Set GraphZAxisTitle
  4453
  4454  { MethodType=Property }
  4455  Function GraphType Integer iSectionCode Integer iGraphN Returns Integer
  4456    Integer iPrintJob iResult
  4457    String sPEInteger
  4458    Pointer pPEInteger
  4459    Get PrintJob To iPrintJob
  4460    FillType PEInteger With 0 To sPEInteger
  4461    GetAddress Of sPEInteger To pPEInteger
  4462    Move (PEGetGraphType(iPrintJob,iSectionCode,iGraphN,pPEInteger)) To iResult
  4463    Send HandlePossibleError
  4464    GetBuff From sPEInteger At PEInteger.integer To iResult
  4465    Function_Return iResult
  4466  End_Function // GraphType
  4467
  4468  { MethodType=Property }
  4469  Procedure Set GraphType Integer iSectionCode Integer iGraphN Integer iGraphType
  4470    Integer iPrintJob iResult
  4471    String sPEInteger
  4472    Pointer pPEInteger
  4473    Get PrintJob To iPrintJob
  4474    Move (Character(iGraphType)) To sPEInteger
  4475    GetAddress Of sPEInteger To pPEInteger
  4476    // It's weird but you must supply a pointer, if you supply an integer you'll get a GPF.
  4477    Move (PESetGraphType(iPrintJob,iSectionCode,iGraphN,pPEInteger)) To iResult
  4478    Send HandlePossibleError
  4479  End_Procedure // Set GraphType
  4480
  4481  // *********************************************************************** //
  4482  // ** Stored Procedure Management Functions                             ** //
  4483  // *********************************************************************** //
  4484
  4485  { MethodType=Property }
  4486  Function NParams Returns Integer
  4487    Integer iPrintJob iResult
  4488    Get PrintJob To iPrintJob
  4489    Move (PEGetNParams(iPrintJob)) To iResult
  4490    Send HandlePossibleError
  4491    Function_Return iResult
  4492  End_Function // NParams
  4493
  4494  { MethodType=Property }
  4495  Function NthParam Integer iParamN Returns String
  4496    Integer iPrintJob iResult iTextHandle iTextLength
  4497    String sPETextStructure sReturn
  4498    Pointer pPETextStructure pReturn
  4499    Get PrintJob To iPrintJob
  4500    FillType PETextStructure With 0 To sPETextStructure
  4501    GetAddress Of sPETextStructure To pPETextStructure
  4502    Move (PEGetNthParam(iPrintJob,iParamN,pPETextStructure,pPETextStructure+4)) To iResult
  4503    Send HandlePossibleError
  4504    GetBuff From sPETextStructure At PETextStructure.textHandle To iTextHandle
  4505    GetBuff From sPETextStructure At PETextStructure.textLength To iTextLength
  4506    If iTextLength Gt 255 Move 255 To iTextLength
  4507    Move (Repeat(Character(0),255)) To sReturn
  4508    GetAddress Of sReturn To pReturn
  4509    Move (PEGetHandleString(iTextHandle,pReturn,iTextLength)) To iResult
  4510    Send HandlePossibleError
  4511    Function_Return (ToOEM(cString(sReturn)))
  4512  End_Function // NthParam
  4513
  4514  { MethodType=Property }
  4515  Procedure Set NthParam Integer iParamN String sParamValue
  4516    Integer iPrintJob iResult
  4517    Get PrintJob To iPrintJob
  4518    Move (ToANSI(sParamValue+Character(0))) To sParamValue
  4519    Move (PESetNthParam(iPrintJob,iParamN,sParamValue)) To iResult
  4520    Send HandlePossibleError
  4521  End_Procedure // Set NthParam
  4522
  4523  // *********************************************************************** //
  4524  // ** Error Management Functions                                        ** //
  4525  // *********************************************************************** //
  4526
  4527  { Visibility=Private }
  4528  Function ErrorCode Returns Integer
  4529    Integer iPrintJob iResult
  4530    Get PrintJob To iPrintJob
  4531    // If the most recent function was called while no print job was open, use 0 for 'iPrintJob'.
  4532    Move (PEGetErrorCode(iPrintJob)) To iResult
  4533    // WinQL probably uses 16 bit integers internally, but sometimes returns garbage in the high
  4534    // order bits. To avoid this problem we will only return the low order bits.
  4535    Function_Return (Low(iResult))
  4536  End_Function // ErrorCode
  4537
  4538  { Visibility=Private }
  4539  Function ErrorText Returns String
  4540    Pointer pPETextStructure pTextHandle pErrorText
  4541    Integer iPrintJob iResult iTextLength
  4542    String sPETextStructure sErrorText
  4543    FillType PETextStructure With 0 To sPETextStructure
  4544    GetAddress Of sPETextStructure To pPETextStructure
  4545    Get PrintJob To iPrintJob
  4546    // If the most recent function was called while no print job was open, use 0 for 'iPrintJob'.
  4547    Move (PEGetErrorText(iPrintJob,pPETextStructure,pPETextStructure+4)) To iResult
  4548    If Not iResult Error DFERR_CRYSTAL_REPORT C_$UnableToGetErrorText
  4549    GetBuff From sPETextStructure At PETextStructure.textHandle To pTextHandle
  4550    GetBuff From sPETextStructure At PETextStructure.textLength To iTextLength
  4551    Move (Repeat(Character(0),iTextLength+1)) To sErrorText
  4552    GetAddress Of sErrorText To pErrorText
  4553    Move (PEGetHandleString(pTextHandle,pErrorText,iTextLength)) To iResult
  4554    If Not iResult Error DFERR_CRYSTAL_REPORT C_$UnableToGetErrorText
  4555    Function_Return (ToOEM(sErrorText))
  4556  End_Function // ErrorText
  4557
  4558  { Visibility=Private }
  4559  Procedure HandlePossibleError
  4560    Integer iError iTrapped
  4561    String sError
  4562    Set FunctionGeneratedError_State To False
  4563    Move (ErrorText(self)) To sError
  4564    Move (ErrorCode(self)) To iError
  4565    If iError Begin
  4566      Get IsTrapped iError To iTrapped
  4567      If iTrapped Error DFERR_CRYSTAL_REPORT sError
  4568      Else Procedure_Return
  4569      Set FunctionGeneratedError_State To True
  4570    End // If iError Begin
  4571  End_Procedure // HandlePossibleError
  4572
  4573  // *********************************************************************** //
  4574  // ** Normal Interface                                                  ** //
  4575  // *********************************************************************** //
  4576
  4577  { MethodType=Property }
  4578  Function Output_Destination Returns Integer
  4579    Integer iDestination iViewId
  4580    Get Private.Output_Destination To iDestination
  4581    If iDestination Eq PRINT_TO_UNDEFINED Begin
  4582      Get Report_View_Id To iViewId
  4583      If iViewId Get Output_Device_Mode Of iViewId To iDestination
  4584      If iDestination Eq PRINT_TO_UNDEFINED Move CRW_PRINT_TO_WINDOW To iDestination
  4585    End // If DevMode Eq PRINT_TO_UNDEFINED
  4586    Function_Return iDestination
  4587  End_Function // Output_Destination
  4588
  4589  { MethodType=Property }
  4590  Procedure Set Output_Destination Integer DevMode
  4591    Set Private.Output_Destination To DevMode
  4592  End_Procedure // Set Output_Destination
  4593
  4594  { MethodType=Property Visibility=Private }
  4595  Function Output_Device_Mode Returns Integer
  4596    Function_Return (Output_Destination(self))
  4597  End_Function // Output_Destination
  4598
  4599  { MethodType=Property }
  4600  Function CurrentDataPath Returns string
  4601    String RptFileDir
  4602    integer iPos bExists
  4603    // ----removed for VDX, uses application object
  4604    //    Get System_Profile_String "ReportDir" To RptFileDir
  4605    //    If (Trim(RptFileDir)="") Begin
  4606    //      If (ghoApplication And psWorkspaceName(phoWorkspace(ghoApplication)) <>"") Begin
  4607    //        Get psDataPath of (phoWorkspace(ghoApplication)) To RptFileDir
  4608    //        Pos ";" In RptFileDir To iPos
  4609    //        If iPos Move (Left(RptFileDir,iPos-1)) To RptFileDir
  4610    //      End // If (ghoApplication And psWorkspaceName(phoWorkspace(ghoApplication) <>"") Begin
  4611
  4612    //      Else If (ghoWorkSpace And CurrentWorkSpaceName(ghoWorkSpace)<>"") Begin
  4613    //        Get CurrentDataPath Of ghoWorkSpace To RptFileDir
  4614    //        Pos ";" In RptFileDir To iPos
  4615    //        If iPos Move (Left(RptFileDir,iPos-1)) To RptFileDir
  4616    //      End // If (ghoWorkSpace And CurrentWorkSpaceName(ghoWorkSpace)<>"") Begin
  4617    //    End // If (Trim(RptFileDir)="") Begin
  4618
  4619    If ghoApplication Begin
  4620       Get ReadString of ghoApplication "" "ReportDir" "" To RptFileDir
  4621       If (Trim(RptFileDir)="") Begin
  4622           Get psDataPath of (phoWorkspace(ghoApplication)) To RptFileDir
  4623           Pos ";" In RptFileDir To iPos
  4624           If iPos Move (Left(RptFileDir,iPos-1)) To RptFileDir
  4625      End // If (Trim(RptFileDir)="")
  4626    End   // If ghoApplication Begin
  4627
  4628
  4629
  4630    Function_Return RptFileDir
  4631  End_Function // CurrentDataPath
  4632
  4633  Function Full_Report_Name String RptName Returns String
  4634    String RptFileDir
  4635    Integer iPos
  4636
  4637    //*** BW Added DirSep logic
  4638    String DirSep
  4639    Move (Sysconf(SYSCONF_DIR_SEPARATOR)) To DirSep
  4640    //If ((RptName contains "\") Or (RptName Contains ":")) Function_Return RptName
  4641    If ((RptName contains DirSep) Or (RptName Contains ":")) Function_Return RptName
  4642    Get CurrentDataPath To RptFileDir
  4643    //*** BW Changed to DirSep logic
  4644    //If ((RptFileDir<>"") And (Right(RptFileDir,1)<>"\")) Move (RptFileDir-"\") To RptFileDir
  4645    If ((RptFileDir<>"") And (Right(RptFileDir,1)<>DirSep)) Move (RptFileDir-DirSep) To RptFileDir
  4646    Move (RptFileDir-RptName) To RptName
  4647    Function_Return RptName
  4648  End_Function // Full_Report_Name
  4649
  4650  { MethodType=Property Visibility=Private }
  4651  Function Table_Count Returns Integer
  4652    Function_Return (NTables(self))
  4653  End_Function // Table_Count
  4654
  4655  { MethodType=Property Visibility=Private Obsolete=True }
  4656  Function Table_Location Integer iTable Returns String
  4657    Function_Return (NthTableLocation(self,iTable))
  4658  End_Function // Table_Location
  4659
  4660  { MethodType=Property Visibility=Private Obsolete=True }
  4661  Procedure Set Table_Location Integer iTable String sLocation
  4662    Set NthTableLocation iTable To sLocation
  4663  End_Procedure // Set Table_Location
  4664
  4665  { Visibility=Private }
  4666  Procedure Show_Locations
  4667    Integer iCount iMax
  4668    String sLocation
  4669    Get NTables To iMax
  4670    Decrement iMax
  4671    For iCount From 0 To iMax
  4672      //*** BW, Changed to NThTableLoaction
  4673      //Send Info_Box ("Location of file"*string(iCount)*"is"*Table_Location(self,iCount))
  4674      Send Info_Box (SFormat(C_$LocationOfFile, iCount, NthTableLocation(self,iCount)))
  4675    Loop // For iCount From 0 To iMax
  4676  End_Procedure // Show_Locations
  4677
  4678  { Visibility=Private }
  4679  Procedure Convert_Locations
  4680    Integer iCount iMax
  4681    String sLocation sPath
  4682
  4683    //*** BW Add dirsep logic
  4684    String DirSep
  4685    Move (Sysconf(SYSCONF_DIR_SEPARATOR)) To DirSep
  4686
  4687    //*** BW, Changed to NTables
  4688    //Get Table_Count To iMax
  4689    Get NTables To iMax
  4690    Decrement iMax
  4691    Get Report_Data_Path To sPath
  4692
  4693    //*** BW Change to DirSep logic
  4694    //If Not (Right(sPath,1)) Eq "\" Move (sPath-"\") To sPath
  4695    If Not (Right(sPath,1)) Eq DirSep Move (sPath-DirSep) To sPath
  4696
  4697    For iCount From 0 To iMax
  4698      //*** BW Changed to NthTableLocation
  4699      //Get Table_Location iCount To sLocation
  4700      Get NthTableLocation iCount To sLocation
  4701      Get Report_Base_File_Name sLocation To sLocation
  4702      //*** BW Changed to NthTableLocation
  4703      //Set Table_Location iCount To (sPath-sLocation)
  4704      Set NthTableLocation iCount To (sPath-sLocation)
  4705    Loop // For iCount From 0 To iMax
  4706  End_Procedure // Convert_Locations
  4707
  4708  Function Report_Base_File_Name String sIn Returns String
  4709    Integer iLen iCnt
  4710
  4711    //*** BW Added dirsep logic
  4712    String DirSep
  4713    Move (Sysconf(SYSCONF_DIR_SEPARATOR)) To DirSep
  4714
  4715    Move (Length(sIn)) to iLen
  4716    Move iLen to iCnt
  4717    While iCnt Gt 0
  4718      //*** BW Changed to DirSep logic
  4719      //If (Mid(sIn,1,iCnt)) Eq "\" Function_Return (Right(sIn,iLen-iCnt))
  4720      If (Mid(sIn,1,iCnt)) Eq DirSep Function_Return (Right(sIn,iLen-iCnt))
  4721      Decrement iCnt
  4722    End // While iCnt Gt 0
  4723    Function_return sIn
  4724  End_Function // Report_Base_File_Name
  4725
  4726  { MethodType=Property }
  4727  Procedure Set Selection_Formula String sFormula
  4728    Set SelectionFormula To sFormula
  4729  End_Procedure // Set Selection_Formula
  4730
  4731  // **JJT**
  4732  Procedure RunCrystalReport
  4733    Integer iDestination iCopies iLeft iTop iWidth iHeight iStyle
  4734    String sDataPath sTitle
  4735    Handle hParent
  4736    If Not (PrintJob(self)) Begin
  4737      Error DFERR_CRYSTAL_REPORT C_$PrintJobNotOpened
  4738      Procedure_Return
  4739    End // If Not (PrintJob(self)) Begin
  4740    Send OnStartPrinting
  4741    Get Report_Data_Path To sDataPath
  4742    If sDataPath Gt "" Send Convert_Locations
  4743    Get Output_Destination To iDestination
  4744    If ((HasSavedData(self)) And (DiscardSavedData_State(self))) Send DiscardSavedData
  4745    If iDestination Eq CRW_PRINT_TO_WINDOW Begin
  4746      Get WindowTitle To sTitle
  4747      If sTitle Eq "" Get ReportTitle To sTitle
  4748      Get WindowLeftCoordinate To iLeft
  4749      Get WindowTopCoordinate To iTop
  4750      Get WindowWidth To iWidth
  4751      Get WindowHeight To iHeight
  4752      Get WindowStyle To iStyle
  4753      Get ParentWindowHandle To hParent
  4754      Send OutputToWindow sTitle iLeft iTop iWidth iHeight iStyle hParent
  4755    End // If iDestination Eq CRW_PRINT_TO_WINDOW
  4756    Else If iDestination Eq CRW_PRINT_TO_PRINTER Begin
  4757      Get Copies To iCopies
  4758      Send OutputToPrinter iCopies
  4759    End // If iDestination Eq CRW_PRINT_TO_PRINTER Begin
  4760    Else If iDestination Eq CRW_PRINT_TO_FILE Send ExportToDisk
  4761    Else If iDestination Eq CRW_PRINT_TO_MAPI Send ExportToMAPI
  4762    Send OnStopPrinting
  4763  End_Procedure // RunCrystalReport
  4764
  4765  { Obsolete=True }
  4766  Procedure DoWinQLReport
  4767    send RunCrystalReport
  4768  End_Procedure // DoWinQLReport
  4769
  4770  // ** UPS **
  4771  { Visibility=Private Obsolete=True }
  4772  Procedure Print_Report String sReportName
  4773    String sReport
  4774    If Num_Arguments Ge 1 Move sReportName To sReport
  4775    If sReport Eq "" Get Report_Name To sReport
  4776    If sReport Ne "" Begin
  4777      Send OpenReport sReport
  4778      If (Not(PreviewWindow_Id(self))) Begin
  4779        Send DoWinQLReport
  4780        Send CloseReport
  4781      End // If (Not(PreviewWindow_Id(self))) Begin
  4782    End // If sReport Ne "" Begin
  4783  End_Procedure // Print_Report
  4784
  4785  // **JJT**
  4786  { MethodType=Event  NoDoc=True }
  4787  Procedure Destroy_Object
  4788    Send CloseReport        // close job if needed
  4789    Send ClosePrintEngine   // close engine if needed
  4790    Forward Send Destroy_Object
  4791  End_Procedure // Destroy_Object
  4792
  4793  { Visibility=Private Obsolete=True }
  4794  Procedure Calling_All_Reports Integer iObject Integer iMessage
  4795    Integer iCurrentObject
  4796    Move self To iCurrentObject
  4797    Send iMessage To iObject iCurrentObject
  4798  End_Procedure // Calling_All_Reports
  4799
  4800  { Visibility=Private Obsolete=True }
  4801  Procedure Initialize_All_Reports Integer iObject Integer iMessage
  4802    Set Report_View_Id To iObject
  4803    Send Calling_All_Reports iObject iMessage
  4804  End_Procedure // Initialize_All_Reports
  4805
  4806  // **JJT**
  4807  Procedure Run_Report String sReportName // Optional name can be passed
  4808    Integer iObject iResult iDestination
  4809    String sReport
  4810    Handle hWindow
  4811    If Num_Arguments Ge 1 Move sReportName To sReport
  4812    If sReport Eq "" Get Report_Name To sReport
  4813    If sReport Ne "" Begin
  4814      // Added for ReportOutput... support
  4815      If (PreviewWindow_Id(self)) Begin
  4816        Get WinQLReport_Id Of (PreviewWindow_Id(self)) To iObject
  4817        If (PrintJob(iObject)) Begin
  4818          Get WindowHandle Of iObject To hWindow
  4819          If hWindow Send CloseWindow To iObject
  4820        End // If (PrintJob(self)) Begin
  4821        Set WinQLReport_Id Of (PreviewWindow_Id(self)) To self
  4822      End // If (PreviewWindow(self)) Begin
  4823      // Default behaviour...
  4824      Send OpenReport sReport
  4825      Get Output_Destination To iDestination
  4826      If ((Not(PreviewWindow_Id(self))) Or (iDestination Ne CRW_PRINT_TO_WINDOW)) Begin
  4827        Send DoWinQLReport
  4828        Send CloseReport
  4829      End // If ((Not(PreviewWindow_Id(self))) Or (iDestination Ne CRW_PRINT_TO_WINDOW)) Begin
  4830    End // If sReport Ne "" Begin
  4831  End_Procedure // Run_Report
  4832
  4833  // **JJT**
  4834  Procedure OpenReport String sReportName // Optional name can be passed
  4835    String sReport
  4836    Integer iDestination
  4837    Send OpenPrintEngine // this will only open if needed
  4838    Send CloseReport // this will only close if job is open
  4839    If Num_Arguments Ge 1 Move sReportName To sReport
  4840    If sReport Eq "" Get Report_Name To sReport
  4841    If sReport Ne "" Begin
  4842      Get Full_Report_Name sReport To sReport
  4843      Send OpenPrintJob sReport
  4844      Send OnInitializeReport
  4845      If (PreviewWindow_Id(self)) Begin
  4846        Get Output_Destination To iDestination
  4847        If iDestination Eq CRW_PRINT_TO_WINDOW ;
  4848          Send ShowReport To (PreviewWindow_Id(self))
  4849      End // If (PreviewWindow_Id(self)) Begin
  4850    End // If sReport Ne "" Begin
  4851  End_Procedure // OpenReport
  4852
  4853  // **JJT**
  4854  Procedure CloseReport
  4855    If (PrintJob(self)) Begin
  4856      Send OnDeInitializeReport
  4857      Send ClosePrintJob
  4858    End // If (PrintJob(self)) Begin
  4859  End_Procedure // CloseReport
  4860
  4861  // *********************************************************************** //
  4862  // ** Advanced Interface                                                ** //
  4863  // *********************************************************************** //
  4864
  4865  // Alternative for 'Copies' property
  4866
  4867  // *********************************************************************** //
  4868  // ** Open close engine messages                                        ** //
  4869  // *********************************************************************** //
  4870
  4871  // **JJT**
  4872  Procedure OpenPrintEngine
  4873    // If this object already uses the engine no action is taken.
  4874    If Not (UsesEngine(self)) Begin
  4875      If WinQL_Report_Initialized Eq 0 Send OpenEngine
  4876      Increment WinQL_Report_Initialized
  4877      Set UsesEngine To True
  4878    End // If Not (UsesEngine(self)) Begin
  4879  End_Procedure // OpenPrintEngine
  4880
  4881  // **JJT**
  4882  Procedure ClosePrintEngine
  4883    // If this object doensn't use the engine no action is taken.
  4884    If (UsesEngine(self)) Begin
  4885      Decrement WinQL_Report_Initialized
  4886      If WinQL_Report_Initialized Eq 0 Send CloseEngine
  4887      Set UsesEngine To False
  4888    End // If (UsesEngine(self)) Begin
  4889  End_Procedure // ClosePrintEngine
  4890
  4891  Function CrystalString String sVal Returns String
  4892    Function_Return ('"'+sVal+'"')
  4893  End_Function // CrystalString
  4894
  4895  Function CrystalInteger Integer iVal Returns String
  4896    Function_Return (String(iVal))
  4897  End_Function // CrystalInteger
  4898
  4899  Function CrystalNumber Number nVal Returns String
  4900    Integer iDecimalSeparator
  4901    String sFormattedNumber
  4902    // Crystal requires a string with a decimal point for numeric separator
  4903    Get_Attribute DF_DECIMAL_SEPARATOR To iDecimalSeparator
  4904    Move (string(nVal)) To sFormattedNumber
  4905    Move (Replace (Character (iDecimalSeparator), sFormattedNumber, ".")) To sFormattedNumber
  4906    Function_Return sFormattedNumber
  4907  End_Function // CrystalNumber
  4908
  4909  Function CrystalDate Date dVal Returns String
  4910    Integer iYearLen iYearPos iMonthPos iDayPos iFormat
  4911    String sVal
  4912    Move (String(dVal)) To sVal
  4913    If (Length(sVal)) Gt 8 Move 4 To iYearLen
  4914    Else Move 2 To iYearLen
  4915    Get_Date_Format To iFormat
  4916    If iFormat Eq DF_DATE_MILITARY Begin
  4917      Move 1 To iYearPos
  4918      If iYearLen Eq 4 Begin
  4919        Move 6 To iMonthPos
  4920        Move 9 To iDayPos
  4921      End // If iYearLen Eq 4 Begin
  4922      Else Begin
  4923        Move 4 To iMonthPos
  4924        Move 7 To iDayPos
  4925      End // Else Begin
  4926    End // If iFormat Eq DF_DATE_MILITARY Begin
  4927    Else Begin
  4928      Move 7 To iYearPos
  4929      If iFormat Eq DF_DATE_USA Begin
  4930        Move 1 To iMonthPos
  4931        Move 4 To iDayPos
  4932      End // If iFormat Eq DF_DATE_USA Begin
  4933      Else Begin
  4934        Move 4 To iMonthPos
  4935        Move 1 To iDayPos
  4936      End // Else Begin
  4937    End // Else Begin
  4938    Function_Return ("Date" +" ("+Mid(sVal,iYearLen,iYearPos)+", "+Mid(sVal,2,iMonthPos)+", "+Mid(sVal,2,iDayPos)+")")
  4939  End_Function // CrystalDate
  4940End_Class // CrystalReport
  4941
  4942Function WinQL_String GLOBAL String sVal Returns String
  4943  Function_Return ('"'+sVal+'"')
  4944End_Function // WinQL_String
  4945
  4946Function WinQL_Integer GLOBAL  Integer iVal Returns String
  4947  Function_Return (String(iVal))
  4948End_Function // WinQL_Integer
  4949
  4950Function WinQL_Number GLOBAL  Number nVal Returns String
  4951  Function_Return (String(nVal))
  4952End_Function // WinQL_Number
  4953
  4954Function WinQL_Date  GLOBAL Date dVal Returns String
  4955  Integer iYearLen iYearPos iMonthPos iDayPos iFormat
  4956  String sVal
  4957  Move (String(dVal)) To sVal
  4958  If (Length(sVal)) Gt 8 Move 4 To iYearLen
  4959  Else Move 2 To iYearLen
  4960  Get_Date_Format To iFormat
  4961  If iFormat Eq DF_DATE_MILITARY Begin
  4962    Move 1 To iYearPos
  4963    If iYearLen Eq 4 Begin
  4964      Move 6 To iMonthPos
  4965      Move 9 To iDayPos
  4966    End // If iYearLen Eq 4 Begin
  4967    Else Begin
  4968      Move 4 To iMonthPos
  4969      Move 7 To iDayPos
  4970    End // Else Begin
  4971  End // If iFormat Eq DF_DATE_MILITARY Begin
  4972  Else Begin
  4973    Move 7 To iYearPos
  4974    If iFormat Eq DF_DATE_USA Begin
  4975      Move 1 To iMonthPos
  4976      Move 4 To iDayPos
  4977    End // If iFormat Eq DF_DATE_USA Begin
  4978    Else Begin
  4979      Move 4 To iMonthPos
  4980      Move 1 To iDayPos
  4981    End // Else Begin
  4982  End // Else Begin
  4983  Function_Return ("Date ("+Mid(sVal,iYearLen,iYearPos)+", "+Mid(sVal,2,iMonthPos)+", "+Mid(sVal,2,iDayPos)+")")
  4984End_Function // WinQL_Date
  4985
  4986