Hi, Thanks for taking the time and reading.
I had to update an old report that was made in CrystalReports. I copied the rpt files and pasted them into a csharp solution in VS 2010.
The report structure is of a Main report and 6 subreports. I have to run this Main report many times and feed it a different integer as a parameter.
I can preview the report in report viewer perfectly. When i try to export the main report into a pdf format
i get an exception. I have tried a few different formats and it spews the same error.
Oddly enough the export sometimes works if the report i am previewing has the "Save data in the report" check box checked. My guess is that this is cached. Also when i run just the subreports through my application, it works.
Things i have tried:
I installed: CRRuntime_64bit_13_0_13
I installed: CRforVS_13_0_13
Took a look at the Procmon and i could not find an access denied error
Event Viewer has no detail.
Changed Registry values of ConnectionDirectoryPath and ReportDirectoryPath to "c:\"
Code:
if (!Directory.Exists(filePath))
{
Directory.CreateDirectory(filePath);
}
string fileName = filePath + string.Format(GlobalVaraiables.FILE_SAVE_NAME, i);
cryRpt.SetParameterValue(GlobalVaraiables.FUND_DATA_KEY_PARAMETER, i.ToString());
cryRpt.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, fileName);
Error message:
System.Runtime.InteropServices.COMException (0x80004005): The system cannot find the path specified.
at CrystalDecisions.ReportAppServer.Controllers.ReportSourceClass.Export(ExportOptions pExportOptions, RequestContext pRequestContext)
at CrystalDecisions.ReportSource.EromReportSourceBase.ExportToStream(ExportRequestContext reqContext)
at CrystalDecisions.CrystalReports.Engine.FormatEngine.ExportToStream(ExportRequestContext reqContext)
at CrystalDecisions.CrystalReports.Engine.FormatEngine.Export(ExportRequestContext reqContext)
at CrystalDecisions.CrystalReports.Engine.ReportDocument.ExportToDisk(ExportFormatType formatType, String fileName)
at FundDataPDFSaver.SaveReport.GenerateReports(List`1 l) in C:\Users\user.name.here\Documents\Visual Studio 2010\Projects\FundDataToPDF\FundDataPDFSaver\SaveReport.cs:line 74
System Details:
Windows 7 Enterprise N 64 bit
ServicePack 1
IDE:
Visual studio 2010 .Net framework 4
Application is set to run as "Any CPU"
CrystalReports :
dll's: C:\Program Files (x86)\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Common\SAP BusinessObjects Enterprise XI 4.0\win32_x86\dotnet\CrystalDecisions.CrystalReports.Engine.dll
C:\Program Files (x86)\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Common\SAP BusinessObjects Enterprise XI 4.0\win32_x86\dotnet\CrystalDecisions.ReportSource.dll
C:\Program Files (x86)\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Common\SAP BusinessObjects Enterprise XI 4.0\win32_x86\dotnet\CrystalDecisions.Shared.dll
Thanks for your help