ActiveReports for .NET 3 Online Help Request technical support
Excel Export Troubleshooting
User Guide > Troubleshooting > Troubleshooting Exports > Excel Export Troubleshooting

Glossary Item Box

Symptoms: The "Specified Cast Is Not Valid" exception fires.

Cause: There is a mix of old and new dlls in the references.

Solution:

  1. Remove all ActiveReports for .NET 3.0 references from the project.
  2. Add the ActiveReports for .NET 3.0 references necessary to your project, making sure to use only references to assemblies from the latest build installed on your machine.

Symptoms: Extra columns are showing up in the Excel export.

Cause: Controls don't have the same Top and Height properties. When the Excel export runs, it divides the report into rows and columns based on the borders of the controls, much like a grid. Controls that are not aligned across the report cause the Excel export to produce more columns to accommodate them.

Solution: To remedy the situation, set as many controls with the same Left property values and the same Top property values as you can, aligning them as if they were in a grid. This reduces the number of columns exported. Also, setting the RemoveVerticalSpace or UseCellMerging property to True, or setting the MinColumnWidth property equal to the width of the narrowest cell may help.


Symptoms: Extremely long reports don't export to Excel.

Cause: The maximum number of rows which can be exported to MS Excel version 8.0 or 9.0 is 65,536, while older versions of Excel (4.0, 5.0 and 7.0) had a limit of 16,384 rows.

Here are other specifications for Excel version 9.0 which may affect your export:

Solution: Use the Export(document,filePath,pageRange) or Export(document,outputStream,pageRange) method to export ranges of pages into separate Excel documents.


Symptoms: When using a memory stream, the Excel export sporadically fails.

Cause: Internet Explorer requires a "content-disposition" header in the response.

Solution: Use code like the following before creating the export.

Response.ContentType = "application/x-msexcel";
Response.AddHeader("content-disposition","attachment; filename=MyXLS.XLS");
Response.AddHeader("content-disposition","inline; filename=MyXLS.xls");


Symptoms: The exported Excel file does not look exactly like the original report.

Cause: The Excel export is not WYSIWYG. It does not support the following items:

Solution: Try to avoid using the above items in reports which will be exported to HTML.

©2009. All Rights Reserved.