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

Working with subreports

Your application can have much of the same control over subreports that it has over primary reports. The only exceptions are:

you can not open or close a print job while a subreport is open, and

you can only work with report sections that are actually in the subreport.

For example, subreports do not have page header sections like primary reports do, so you can not do anything with a subreport that requires a page header section.

Most Crystal Report Engine functions require a print job handle as a parameter. When you supply the handle to a primary report, the functions act on the primary report. When you supply the handle to a subreport, the functions act on the subreport. Getting the handle requires a number of steps.

Opening the primary report

You must first open the primary report using the PEOpenPrintJob, Volume 2, Chapter 1 function. When you do this, the program returns a handle to the primary report.

Retrieving an interim subreport handle

You must then identify the subreport you want to open, using the PEGetNSubreportsInSection, Volume 2, Chapter 1, and PEGetNthSubreportInSection, Volume 2, Chapter 1, functions to do this. When you run the PEGetNthSubreportInSection function, the Crystal Report Engine returns an interim, double-word handle to the subreport you specified.

Retrieving the subreport name

Once you have the handle, use the PEGetSubreportInfo, Volume 2, Chapter 1 function to retrieve the name of the subreport. When you run this function, the double-word handle is passed as the subreportHandle argument. The program retrieves the subreport name as the name member of the PESubreportInfo, Volume 2, Chapter 1 structure.

Opening the subreport and retrieving the job handle

Now that you have the name of the subreport (the name you assigned the subreport when you created it in Seagate Crystal Reports), use the PEOpenSubreport, Volume 2, Chapter 1 function to open the subreport. When using this function, you pass the name (or pointer to the name, depending on your development tool) as the subreportName argument. The program then opens the specified subreport and returns a job handle.

Running other Crystal Report Engine functions

Once you have the job handle, you can run any of the other Crystal Report Engine functions with the subreport, passing the subreport job handle as the printJob argument.

Crystal Report Engine

93

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