SAP Knowledge Base Article - Public

2400236 - Export to Excel Columns misaligned when exporting from a CR for VS .NET application compared to CR Designer

Symptom

I have a customer who exports a crystal report from the .NET Viewer to Excel.  

When excel file is opened some columns are misaligned.

If the report is exported with the CR Designer then it's fine.

Environment

  • Crystal Reports for Visual Studio SP 14
  • Crystal Reports Designer 20xx

Reproducing the Issue

Please see attachement for duplication steps.  I have also attached my code in a plain text file. This only goes wrong when exporting via the api

Resolution

The report has No Printer checked on and Dissociate unchecked.

Setting the report to use a Specific generic Printer and checking on Dissociate allows the Formatting Engine to use a real printer properties to locate each cell.

The cause is there is a differecne between Windows GDI.dll and GDIPlus.dll

When No Printer is selected CR Designer uses GDI.dll to format the objects.

In a .NET application the .NET FRamework uses GDIPlus.dll to do the formatting.

Due to platform differences this can cause the output to be slightly off and can show up as mis-alligned cells.

Solution is to always select a Printer and check on Dissociate so it does not require that printer but will use that printer Family properties.

If using Custom Papers sizes do the same, always use the specific printer or family of printers.

Keywords

GDI, GDIPlus, .NET, CR for VS, printer formatting , KBA , BI-DEV-NET , BI Software Development Kits (SDKs) - .NET or Other , Problem

Product

SAP Crystal Reports, developer version for Microsoft Visual Studio