Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
191
Добавлен:
11.05.2015
Размер:
4.96 Mб
Скачать

PrintReport

PrintReport triggers the printing of the report.

Syntax

[form.]Report.PrintReport

For example:

Result% = CrystalReport1.PrintReport

«Prints the specified report.»

Remarks

PrintReport returns a result code, 0 if the call is successful, an error code in the 20XXX range if it fails.

You can also print a report using the Action, Page 178. If something goes wrong, however, you get a runtime error that will terminate your application. For this reason, you will need to set up an error handler.

NOTE: If you are currently using the VBX control in your application, you will not be able to print individual subreports.

Availability

Runtime

Related Report Engine Functions

PEStartPrintJob, Volume 2, Chapter 1

ReplaceSelectionFormula

ReplaceSelectionFormula overrides the selection formula from the current report with the string that is passed.

Syntax

[form.]Report.ReplaceSelectionFormula [(SelectionFormulaString$)]

For example:

CrystalReport1.ReplaceSelectionFormula (“{Company.State}='CA'”)

«Uses “{Company.State}='CA'” as the selection formula for the report.»

Crystal ActiveX Control Reference

274

Remarks

This method DOES NOT use the string in SelectionFormula, Page 241, and DOES conflict with setting the property. You can not set the SelectionFormula, Page 241, property and call ReplaceSelectionFormula in the same code sequence. A Visual Basic error condition will be raised in such a case.

Availability

Runtime only

Reset

Reset resets the value of all properties (except DataSource, Page 183) to their default values.

Syntax

[form.]Report.Reset

For example:

CrystalReport1.Reset

«Returns all properties (except DataSource) for CrystalReport1 to their default values.»

RetrieveDataFiles

RetrieveDatafiles retrieves all “table” locations from the current report, populates DataFiles, Page 182, and returns the number of “tables” in the report.

Syntax

[form.]Report.RetrieveDatafiles

For example:

NumberofDatafiles% = CrystalReport1.RetrieveDatafiles

«Populates the DataFiles property with the table locations from CrystalReport1.»

Remarks

This method can only be called AFTER ReportFileName, Page 233, has been set.

Availability

Runtime only

Crystal ActiveX Control Reference

275

RetrieveLogonInfo

RetrieveLogonInfo retrieves logon information (except for the password) for all “tables” in the current report, populates LogOnInfo, Page 205, and returns the number of “tables” in the report.

Syntax

[form.]Report.RetrieveLogonInfo

For example:

NumberofTables% = CrystalReport1.RetrieveLogonInfo

«Retrieves the logon information for all the tables in CrystalReport1.»

Remarks

This method can only be called AFTER the ReportFileName, Page 233, has been set. This method DOES NOT use the string in the Connect property and DOES conflict with setting the property. You can not set the Connect property and call RetrieveLogonInfo in the same code sequence. A Visual Basic error condition will be raised in this case.

Availability

Runtime only

RetrieveSQLQuery

RetrieveSQLQuery retrieves the SQL Query from the current report and populates SQLQuery, Page 244.

Syntax

[form.]Report.RetrieveSQLQuery

For example:

CrystalReport1.RetrieveSQLQuery

«Retrieves the SQL query from CrystalReport1.»

Remarks

This method can only be called AFTER ReportFileName, Page 233, has been set.

Availability

Runtime only

Crystal ActiveX Control Reference

276

RetrieveStoredProcParams

RetrieveStoredProcParams retrieves all stored procedure parameters from the current report, populates StoredProcParam, Page 246, and returns the number of parameters.

Syntax

[form.]Report.RetrieveStoredProcParams

For example:

NumberofParams% = CrystalReport1.RetrieveStoredProcParams

«Retrieves the stored procedure parameters from CrystalReport1.»

Remarks

This method can only be called AFTER ReportFileName, Page 233, has been set.

Availability

Runtime only

SpecifyDataSourceField

SpecifyDataSourceField enables you to specify the columns that appear, their order, and their width for reports that are automatically generated from a Data control. If you call this function one or more times, only the columns indicated by the calls will appear in the report. You must call this function one time for each column you are setting.

Syntax

[form.]Report.SpecifyDataSourceField ColumnNum%, ColumnName$, ColumnWidth%

For example:

CrystalReport1.SpecifyDataSourceField (0, “Year Born”, 10)

CrystalReport1.SpecifyDataSourceField (1, “Au_ID”, 20)

«If the data control was pointing to the Authors table in the Biblio sample, the code results in a report where the first column is year born and the second column is author_id.»

Crystal ActiveX Control Reference

277

Соседние файлы в папке crystal