cancel
Showing results for 
Search instead for 
Did you mean: 

Reportclientdocument.close or report.close

jorg_neeb
Participant
0 Kudos

Hi Community,

I have a question about the two Close methods of the ras sdk.

I am using the following code to Close a printed or exported Report:

reportClientDocument.Close();

reportClientDocument = null;

report.Close();

report.Dispose();

the Report.close gets an error (an external component has raised a condition).

I am not sure if I Need to use all of the Statements. It seems that the reportclientdocument.close also Closes the Report and thats why the Report.close or the Report.dispose() gets error.

Does anybody know if the reportClientDocument.close implements the Report.close? I thougth that I have to use the Report.dispose() to release the unused objects.

Thanks for your help.

Regards

joerg

Accepted Solutions (1)

Accepted Solutions (1)

former_member183750
Active Contributor
0 Kudos

Hi Jorg

it just depends on how you define your objects. If they are dfined as reportClientDocument, then use

reportClientDocument.Close();

reportClientDocument = null;

If they are defined as report, use

report.Close();

report.Dispose();

- Ludek

Senior Support Engineer AGS Product Support, Global Support Center Canada

Follow us on Twitter

jorg_neeb
Participant
0 Kudos

Hi Ludek,

thanks to you and Don for the answer.

I use the following code to open the Report:

_report = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
_report.Load(_reportFilename);
_reportClientDocument = _report.ReportClientDocument;

And now I use this code to Close and destroy the objects. With this code I get no exception.

_reportClientDocument = null;
_report.Close();
_report.Dispose();

Thanks to you both.

regards

joerg



Answers (1)

Answers (1)

0 Kudos

Hi Joerg,

Since you are using the ReportDocument to open the report and then casting that report object to the ReportClientDocument they are virtually the same object.

So simply closing the ReportDocument is all that is required. The RAS Engine will close and dispose its reference to the report object.

Don