Skip to Content
0
May 31, 2018 at 10:15 AM

Crystal Reports 13: How to export to XLSX

1199 Views Last edit Jun 08, 2018 at 01:01 PM 2 rev

Hello SAP-Crystal Reports Support Team,

I still try to export data to XLSX format. My (C++) program runs as a service and exports only to disk files (mainly PDF).

My installation is as follows:

Operating system: Windows 10 Pro
IDE: Microsoft Visual Studio 2010, Version 10.0.40219.1 SP1Rel
Microsoft .NET Framework 4.7.02558 SP1Rel

SAP Crystal Reports, version for Microsoft Visual Studio, Version 13.0.22.2668

My code snippet looks like this:

#using <System.dll>

#using <CrystalDecisions.ReportSource.dll>
#using <CrystalDecisions.CrystalReports.Engine.dll>
#using <CrystalDecisions.Shared.dll>
#using <CrystalDecisions.ReportAppServer.ReportDefModel.dll>

using namespace CrystalDecisions::Shared;
using namespace CrystalDecisions::ReportSource;
using namespace CrystalDecisions::CrystalReports::Engine;
using namespace CrystalDecisions::ReportAppServer::ReportDefModel;

...

bool CVerarbCR::ExportSrv(...)

{

...

CrystalDecisions::ReportAppServer::ReportDefModel::ReportDocument^ RASrptDoc = gcnew CrystalDecisions::ReportAppServer::ReportDefModel::ReportDocument();
CrystalDecisions::ReportAppServer::ReportDefModel::DataOnlyExcelExportFormatOptions^ RASXLXSExportOpts =
gcnew CrystalDecisions::ReportAppServer::ReportDefModel::DataOnlyExcelExportFormatOptions();
RASXLXSExportOpts = (DataOnlyExcelExportFormatOptions^)RASrptDoc->get_SavedExportOptions(CrystalDecisions::ReportAppServer::ReportDefModel::CrReportExportFormatEnum::crReportExportFormatXLSX);
RASXLXSExportOpts->ConstantColWidth = 36.6;
RASXLXSExportOpts->ExportObjectFormatting = true;
RASXLXSExportOpts->ExportImages = false;
RASXLXSExportOpts->UseWorksheetFunctionsForSummaries = false;
RASXLXSExportOpts->MaintainRelativeObjectPosition = true;
RASXLXSExportOpts->MaintainColumnAlignment = true;
RASXLXSExportOpts->ExportPageHeaderAndFooter = false;
RASXLXSExportOpts->SimplifyPageHeaders = true;
RASXLXSExportOpts->ShowGroupOutlines = false;

CrystalDecisions::ReportAppServer::ReportDefModel::ExportOptions^ exportOpts1 = gcnew CrystalDecisions::ReportAppServer::ReportDefModel::ExportOptions();
exportOpts1->ExportFormatType = CrystalDecisions::ReportAppServer::ReportDefModel::CrReportExportFormatEnum::crReportExportFormatXLSX;
exportOpts1->FormatOptions = RASXLXSExportOpts;

RASrptDoc->PrintOutputController.ExportEx(exportOpts1).Save(strReportPathAndName, true);

...

I get errors here:

get_SavedExportOptions is no element of

CrystalDecisions::ReportAppServer::ReportDefModel::ReportDocument

PrintOutputController is no element of

CrystalDecisions::ReportAppServer::ReportDefModel::ReportDocument

Where I can find an API for ReportAppServer? Note that the link help.sap.com/businessobject/product_guides/sapCRVS2010/en/rasnet10_api_en.zip is not valid anymore!

Thanks in advance

Stefan Grasse (VAB GmbH)