Skip to Content
Former Member
Sep 09, 2009 at 08:44 PM

Using VB and the SDK to export a report into Excel format


I am using VB and the SDK to export a Crytal Report.

Here is the code I am attempting to use:

Dim rd As New CrystalDecisions.CrystalReports.Engine.ReportDocument()


Dim rcd As ISCDReportClientDocument = rd.ReportClientDocument

Dim myBytes As ByteArray

If strExpType = "14" Then ' word format

myBytes = rcd.PrintOutputController.Export(CrReportExportFormatEnum.crReportExportFormatMSWord)

ElseIf strExpType = "30" Or strExpType = "27" Then ' excel format

myBytes = rcd.PrintOutputController.Export(CrReportExportFormatEnum.crReportExportFormatMSExcel)

Else ' PDF Format

myBytes = rcd.PrintOutputController.Export(CrReportExportFormatEnum.crReportExportFormatPDF)

End If

When I set the strExpType to 14, I successfullly create a MS Word document. When I set the StrExpType to 1, I successfully create a PDF.

However, when I set the strExpType to 30 (or 27), I end up with an empty ByteArray.

I have not been able to capture an error message, I just get an empty ByteArray.

Is there a trick to getting an export to Excel format to work?