Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Exporting to PDF, Word or Excel
Message
General information
Forum:
ASP.NET
Category:
Reporting
Title:
Exporting to PDF, Word or Excel
Miscellaneous
Thread ID:
00975347
Message ID:
00975347
Views:
76
I am having some trouble exporting my report to PDF, Word or Excel. Well acctually the exporting process runs just fine but after the file has been exported an exception is thrown. Below is the method and I added a try-catch block to show where the exception is thrown
private void ExportReport(ReportDocument paraReport,string paraOutput, string paraFile)
{
	switch(paraOutput) 
	{
		case "PDF":
			paraReport.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat ,paraFile);
			break;
		case "WORD":
			paraReport.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.WordForWindows ,paraFile);
			break;
		case "EXCEL":
			paraReport.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.Excel ,paraFile);
			break;
	}
	try
	{
		paraReport.Export();
	}
	catch (CrystalDecisions.CrystalReports.Engine.InvalidArgumentException iaEx)
	{
		System.Windows.Forms.MessageBox.Show("CrystalDecisions.CrystalReports.Engine.InvalidArgumentException was caught again but I bet the file is still there!\n"+iaEx.ToString());
	}
}
The files are written to disk and all seems to be well but the thrown exception is a little annoying. Any thoughts?

Einar

PS. I am using CR.NET if that makes a difference.
Semper ubi sub ubi.
Next
Reply
Map
View

Click here to load this message in the networking platform