SAP Knowledge Base Article - Public

1559329 - How to export a report to MS Excel with or without gridlines using the Crystal Reports .NET SDK?

Symptom

  • Custom .NET Windows or web application using the Crystal Reports .NET SDK
  • Export a report to Microsoft Excel format, ExportFormatType.Excel.
  • Turn on/off gridelines for the Excel file.

Environment

  • Crystal Reports 2008
  • Crystal Reports XI R2
  • Crystal Reports XI R1
  • Crystal Reports for Visual Studio 2010
  • Crystal Reports Basic for Visual Studio 2008
  • Crystal Reports for Visual Studio 2005
  • Crystal Reports for Visual Studio 2003

Reproducing the Issue

The Show gridlines option is availble in the Excel Format Options dialog when exporting from the Crystal Reports designer.

excel show gridlines.png

Cause

  • It isn't possible to modify the gridlines for the Excel format using the Crystal Reports .NET SDK.
  • This is because the CrystalDecisions.Shared.ExcelFormatOptions class doesn't expose a property to control the Excel gridlines.
  • Resolution

    • You need to use the Report Application Server (RAS) .NET SDK to modify the ExcelExportFormatOptions.ShowGridlines property.
    • The RAS .NET SDK is accessible through the Crystal Reports .NET SDK by getting a handle on the ReportDocument.ReportClientDocument property.
    • The RAS .NET SDK is not accessible in all versions of Crystal Reports.

    Available

    • Crystal Reports for Visual Studio 2010
    • Crystal Reports 2008
    • Crystal Reports XI R2

    Not Available

    • Crystal Reports XI R1
    • Crystal Reports 10
    • Crystal Reports 9
    • Crystal Reports Basic for Visual Studio 2008
    • Crystal Reports for Visual Studio 2005
    • Crystal Reports for Visual Studio 2003

    Keywords

    KBA , BI-DEV-NET , BI Software Development Kits (SDKs) - .NET or Other , How To

    Product

    Crystal Reports 2008 V1 ; SAP Crystal Reports 10.0 ; SAP Crystal Reports 9.0 ; SAP Crystal Reports XI ; SAP Crystal Reports XI R2 ; SAP Crystal Reports, developer version for Microsoft Visual Studio ; SAP Crystal Reports, version for Visual Studio .NET 2005 ; SAP Crystal Reports, version for Visual Studio .NET 2008 ; SAP Crystal Reports, version for Visual Studio .NET 9.1