0
votes

I'm working on a ASP.Net web application in Visual Studio 2010. I'm working on a report designed in SAP Crystal Reports for VS2010.

I'm able to export the report to PDF and Word formats, but when I try to export it in Excel format, the Visual Studio debug just stops, and the response is never returned.

I'm using Crystal Reports for Visual Studio 2010, and the report in question has a simple subreport (nothing but a single label) in Section 1 (Report Header).

using (TestReport report = new TestReport()) // TestReport inherits ReportClass
{
    TestDataSet data = this.GetData();
    report.SetDataSource(data);
    return report.ExportToStream(ExportFormatType.Excel);
}

The report.ExportToStream(ExportFormatType.Excel); fails and the debug just stops. If I remove the subreport it works OK, but otherwise it fails.

1

1 Answers

0
votes

I managed to fix it by replacing the output format enum value from to Excel to ExcelWorkbook...

Code:

using (TestReport report = new TestReport()) // TestReport inherits ReportClass
{
    TestDataSet data = this.GetData();
    report.SetDataSource(data);
    return report.ExportToStream(ExportFormatType.ExcelWorkbook);
}