    UCRPE: TCrpe Crystal Reports Delphi Components Unit 
  Version: 1.8.14
Copyright: Crystal Services, Inc. All Rights Reserved
   Author: John Murphy
      CIS: 72623,2075
    Email: jmurphy@shore.net
    Time : 20:47 EST 11/25/95


Important Changes:

	UserPrinterSetup has changed from a Boolean to a class.
        Code change would be to change any 
	Crpe1.UserPrinterSetup := True; to Crpe1.UserPrinterSetup.Enabled := True;
   
	See the help file for more information on UserPrinterSetup.


Installation - Component

Requirements:

		Crystal Reports Standard or Professional Versions 4.0 and greater

FILES:		UCRPE.DCU	The TCrpe component unit
		UCRPE.DCR	The TCrpe resource file
		UCRPE.HDX	The TCrpe help index file
		UCRPE.HLP	The TCrpe help file
		UCRPE.KWF	The TCrpe keywords file
		UEDABT.DFM	The TCrpe about dialog box form file
		DEMO.ZIP	The Demo applications source, data and reports
		READMEXX.TXT    This file

1) Copy all the files to a directory of your choosing.

2) To install the TCpre component press Options, Install Components, from the Delphi Main
Menu. From the Install Compoents Dialog Box press Add then Browse Files of 
type unit (*.DCU) and select the UCRPE.DCU file.

Note: Make sure the directory that you copied UCRPE.DCU into is included in the
search path.

Press OK and wait until Delphi has rebuilt the component library.  A Printer icon should
appear on the Data Access page of the Component pallett.

Installation - Help File

1) Copy UCRPE.KWF to your \DELPHI\HELP directory.
2) Copy UCRPE.HLP to your \DELPHI\BIN  directory.
3) Run \DELPHI\HELP\HELPINST.EXE (HelpInst in the Delphi Group from program manager)
   Open the \DELPHI\BIN\DELPHI.HDX
   Select Keywords, Add KeyWord file then select UCRPE.KWF
   File Save
   Within the Delphi IDE you should have help on TCrpe properties when
   you press F1 on an TCrpe property.


Version 1.08 - Whats New

     The TCrpe component (UCRPE.DCU) now incorporates dynamic linking.

     Propery Editor for the Margin Properties.

     UserPrinterSetup is now an object. (see help)

     Any of the array properties can be cleared by assigning EmptyStr
     (the empty string) to the first string. (see help)

Version 1.07 - Whats New

     Added Event: OnExecute (called prior to Printing the report)

     Fixed/Changed: Connect Property - accept lowercase connect tokens

     Added to FPrintFileType and assoc.: QuatroPro 5.0 export, Excel 5.0

     Fixed:         PrinterCopies Property s/b same as CopiesToPrinter.

     Added RunTime Read/Write properties 
	            SectionFont
                    SectionFormat
                    SectionLineHeight
                    SectionMinHeight
                    UserPrinterSetup  

     Added RunTime Property WindowControls


Version 1.06 - Whats New

        TCrpe Demo with source

        Added Design-Time Properties:
           DetailCopies
	   PrintFileUseRptNumberFmt
           PrintFileUseRptDateFmt

        Added field Error to ECrpeEngine exceptions

        Changed/Fixed:
           Exceptions handlers get ErrorNumber from engine first.

           Functions may return false, yet no error has occured.
           Now if any function call returns false, ErrorNo must be non-zero,
           only then does an exception get raised.

           Array Properties: Initialize when Job Opened and Clear when Job is closed,
                             the current job is closed in response to a  change in the
                             ReportName property and in the destructor.

           Added Run-Time Read/Write properties:
              PrintDate
              PrintMonth
              PrintYear
              StoredProcParm[]
              ZoomPreviewWindow
              PrintControls

           Added Run-Time Read Only Properties
                 RecordsPrinted
                 RecordsSelected
                 ReportDisplayPage
                 ReportLatestPage
                 ReportStartPage
                 PrintEnded
                 Status
                 Focused

           Added Run-Time Methods 
                 CloseWindow
                 ShowNextPage
                 ShowFirstPage
                 ShowPreviousPage
                 ShowLastPage
                 PrintWindow(const bWait : Boolean);
                 ExportPrintWindow(const bMail, const bWait : Boolean)
                 SetFocus
                 ReportWindowHandle : hWnd

           Consolodated all DCUs (External Decs, Editors and Utility) into UCRPE.DCU
                 Note: Leaves Link-Time (resource) Dependencies only.


--------------------------------------------------------------------------------------------
PLEASE READ! TCrpe 1.05 has some signifigant changes in data types and enumerated values. See the notes
below.

Added 1.05 	Execute Method
		
		Crpe1.Execute may be used in place of Crpe1.Action := 1


Property Changes in 1.05

	Destination Property:
	
		Destination enumerated values have changed from
 		(Window, Printer, FileOut ...)	to   (toWindow, toPrinter, toFile, ...)
	
		Many people have tried to use the TPrinterDialog to query the user for a
 		Printer	at run-time. This code snippet shows how you get the selected
		printer from the PrinterSetupDialog from the user and pass the information 		into an instance of TCrpe.
		Note also the Delphi's Printer variable, this is the main reason that
 		the Destination properties have changed.


implementation

uses Printers;

{$R *.DFM}

{ Push button to get and set the selected printer }
procedure TForm1.btnPrinterClick(Sender: TObject);
var
   lpPrinter, lpDriver, lpPort : PChar;
   hMode                       : THandle;
begin
   try
      lpPrinter := StrAlloc(255);
      lpDriver := StrAlloc(255);
      lpPort := StrAlloc(255);
      PrinterSetupDialog1.Execute;
      Printer.GetPrinter(lpPrinter, lpDriver, lpPort, hMode);
      Crpe1.PrinterName := StrPas(lpPrinter);
      Crpe1.PrinterDriver := StrPas(lpDriver);
      Crpe1.PrinterPort := StrPas(lpPort);
   finally
      StrDispose(lpPrinter);
      StrDispose(lpDriver);
      StrDispose(lpPort);
   end; { Protected Block }
end;


Fixed 1.05

	Cleanup when ECrpeError(ECRPE_REPORT_NOTFOUND) is raised.
	SQLQuery, was not being sent to Engine correctly.
	SetPrintOptions to initialize structSize

Changed 1.05

	

	SelectionFormula and GroupSelectionFormula have changed from type string to type
	TCrpeString. Many users asked for this one, you know can have selection formulars
	much greater in length than the string limit of 255.

        class TCrpeString descends from TStringList


	The following is now legal in 1.05 and greater:

	DESIGN-TIME
		TCrpeStrings get the string list property editor.

	RUN-TIME
		Crpe1.SelectionFormula.Assign(AnotherTCrpeString);

		Crpe1.SelectionFormula.LoadFromFile ( 'FOO.TXT' );

		Crpe1.SelectionFormula[ 0 ] := '{DBFILE.Field}=0';
		Crpe1.SelectionFormula[ 1 ] := ' and {DBFILE.Field2}=1';

		However, the following would raise an exception:

		Crpe1.SelectionFormula[ 0 ] := '{DBFILE.Field}=0';
		Crpe1.SelectionFormula[ 2 ] := ' and {DBFILE.Field2}=1';

Changed 1.05

	MarginProperties Now Default to PE_SM_DEFAULT 32768, this will prevent the margins which are
	defined in the report from being set to 0s. 

	Type FWindowBorderStyle to TFormBorderStyle
	Type FWindowState to TWindowState

-----------------------------------------------------------------------------------------------------------
Fixed 1.04	      DataFiles[] property Subscript Error generated in error.

Added 1.04            Properties:
                         Run-Time:
                          GraphData[n], GraphOptions[n], GraphText[n], GraphType[n]
                      Will document these in the next rev of the help file.


                      Version 1.03 has 51 properties exposed to the Crystal Reports CRPE.DLL
                      print engine. 41 are available from the Object Inspector, 10 run-time.

                      It should also be noted that the following exceptions may be raised:

                         ECrpeError  ( base class, all TCrpe errors descend from ECrpeError)
                         ECrpeEngine ( any error returning from the print engine, note that when
                                       this exception is raised, you can evaluate the run-time
                                       read-only properties of LastErrorNumber and LastErrorString.
                         ECrpeConnect ( error from the connect string parser )
                         ECrpeSubscript ( returned from invalid references to the array properties )

 
             NOTE:    Version 1.03 checks for the version number of CRPE.DLL and will raise
                      an exception when an version other than 4.0 of CRPE.DLL is found.
                      There will be a version 3 compatible component available soon, the 
                      interface and the name will probably be the same so nobody will have
                      to change any code. Any comments on this let me know.

Fixed 1.03            Fixed GPF with DataObjects on same form.
                      Fixed SelectionFormula, GroupSelectionFormula

Added 1.03
                      Help: Refer to pg 78-80 of the Delphi Component Writers Guide for 
                            instructions on linking in the TCrpe help ('ucrpe.hlp'). Please
                            excuse the fact that the help file is rather sparten and it is
                            only up to the functionality of version 1.02 of the TCrpe component.
                            I would also like to thank Curtis White for creating the help file.

                      Destination: Formats Added 
                                   Records, TabSeparated, Ascii, Dif, Csv, CharacterSeparated,
                                   TabSeparatedText, CrystalReportRPT, Excel2, Excel3, Excel4,
                                   LotusWK1, LotusWK3, LotusWKS, RTF, WordForDOS,
                                   WordForWindows, WordPerfect
 
                      NOTE: That the Crystal equivalent to Records is Record and Ascii appears is Text
                            I wanted to change the names due to the fact that Record and Text are key
                            words in Pascal.

                      Properties:  FPrintFileName,
                                   FPrintFileCharSepQuote
                                   PrintFileCharSeparator
                                   EMailCCList            
                                   EMailMessage
                                   EMailSubject
                                   EMailToList
                                   EMailVIMBCCList
                                   FEMailVIMBCCList

                        run-time:
                                   LastErrorNumber
                                   LastErrorString


Added 1.02
   Object Inspector:

       MDIChild           : Boolean

       SQLQuery           : TStringList (multiple lines no line can exceed 255 char, max 32K)

                            The crystal print engine will allow changes in the order by and
                            the where sections of the statement. The select and from                                    sections must be identical to the reports SQL statement.


   Run-time:
       Three new array properties

       SortFields[n]      : array of strings read/write, with SortFields[0] being the                                   outermost.

          format
                '-,+{TABLE.FIELD}' 
          notes
                - Descending + Ascending + Default

       GroupSortFields[n] : array of strings read/write, with GroupSortFields[0] being the
                            outermost.
          format
                '+ Max ({orders.Amount}, {orders.Customer})'

                
       GroupCondition[n]  : array of strings read/write, with GroupCondition[0] being the
                            outermost.
          format 
                'GROUP1;{ERROR TABLE.ERROR CODE};ANYCHANGE;D';

                GROUPn      Group Number 1..n
                Field       Name of the field that triggers a grouping
                Condition   Condition that triggers the grouping (see table)
                Sort Order  (A Ascending, D Descending)

                   Date Fields

                      Daily		DAILY
                      Bi-Weekly		BIWEEKLY
                      Semi-Monthly	SEMIMONTHLY
                      Monthly		MONTHLY
                      Semi-Annually	SEMIANNUALLY
                      Annually		ANNUALLY

		  Boolean Fields

                      To Yes		TOYES
                      To No             TONO
                      Every Yes         EVERYYES
                      Every No          EVERYNO
                      Next Yes          NEXTYES
                      Next No           NEXTNO

                  All other data types
                                        ANYCHANGE

Added 1.01
   Object Inspector:

       Connect : string

       format 
       DSN = name;UID = userID;PWD = password;DSQ = database qualifier

       For Logging on to SQL Server or local paradox tables

       DSN is the server name.
       UID is the user name.
       PWD is the password.
       DSQ is the database name.


   Run-Time:
       UserName : string  for Ms Access Databases only
       Password : string  for Ms Access Databases only



----

This component is still being developed as a Delphi replacement to the Crystal.VBX
custom control I hope to make it functionally equivalent, to date I have 
only tested it with dbase, foxpro, paradox, access tables using Crystal Reports
Version 4.0 reports. The SQL stuff has been tested with ODBC using foxpro tables.
The connect property has been tested with paradox password protected tables.

All the properties are active and you can set most of them at design-time. 

To install the component in Delphi choose: Options, Install Components, Add
then Add the unit uCrpe.dcu. Press OK. You want to ensure that the units that
UCRPE.DCU uses are also in your library path.

The Component will be added to your Data Access page on the Delphi palette.

There are three run-time properties:

	Datafiles[]	Run-time, read, write, not expandable.

	You can use this Property to change the location of the tables at runtime,
        the tables must appear in the same order in which they are defined in the
	report.

	e.g.
        report definition:
                D:\GL\ACCT\TABLE1.DBF
                D:\GL\ACCT\TABLE2.DBF

	Delphi code:
		Crpe1.Datafiles[0] := 'C:\GLAPP\DATA\TABLE1.DBF';
		Crpe1.Datafiles[1] := 'C:\GLAPP\DATA\TABLE1.DBF';

	Formulas[]      Run-time, read, write, not expandable

	You can change your report formulas at run-time with the formula property array.
	The order is not significant, use the formula name.

        e.g.
	report definition:
		BeginDate	Formula Text: Today
		EndDate			       : Today

	Delphi code:
 		Crpe1[0] := 'EndDate="' + sBeginDate + '"';
		Crpe1[1] := 'BeginDate="' + sEndDate + '"';


	Action		Run-time

	Set this to 1 to run the report. Button Click event etc.

	Delphi code:
		Crpe1.Action := 1;


This is an initial build of this component, I needed it for a project that I am working
on, I will update as it matures.

/jbm
