Showing results for 
Search instead for 
Did you mean: 

Crystal Reports XI and SAP Crystal Reports 2013

0 Kudos

I'm developing Windows-services for different customers, creating several reports automatically. These reports (rpt-files) had been created with CR9 and CR XI.

Now one customer wants to have an export of "XLSX". So I think to switch to SAP Crystal Report 2013.

Now our questions: is it possible to have CrystalReportXIRev2SP3 and CRforVS_13_0_22 in parallel installed?

Are the "old" reports (*.rpt-files) campatibel with CR2013?

Where I can find an API of CrystalReport 2013? What is the implementierung for getting the Export of XLSX? What is the correct "CRExportFormatType" (crEFTExcel???)?

These are the installations of my computer:
Operating system: Windows 10 Pro
IDE: Microsoft Visual Studio 2010, Version 10.0.40219.1 SP1Rel
Microsoft .NET Framework 4.7.02558 SP1Rel

Thanks in advance

Stefan Grasse (VAB GmbH)

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Hi Stefan,

Go here to get CR for VS:

And samples as other reference materials.

Yes, you need the full version of 3.5 Framework and above, let MS keep it up to date. We can work with 4.7 as well, 3.5 is just the minimum required now.

Doc was created in 2014, stall all valid and kept up to date, editing doesn't change the creation date but it is up to date.

You can enable any export format now in the viewer:

// set up the format export types:
int myFOpts = (int)(
    CrystalDecisions.Shared.ViewerExportFormats.RptFormat |
    CrystalDecisions.Shared.ViewerExportFormats.PdfFormat |
    CrystalDecisions.Shared.ViewerExportFormats.RptrFormat |
    CrystalDecisions.Shared.ViewerExportFormats.XLSXFormat |
    CrystalDecisions.Shared.ViewerExportFormats.CsvFormat |
    CrystalDecisions.Shared.ViewerExportFormats.EditableRtfFormat |
    CrystalDecisions.Shared.ViewerExportFormats.ExcelRecordFormat |
    CrystalDecisions.Shared.ViewerExportFormats.RtfFormat |
    CrystalDecisions.Shared.ViewerExportFormats.WordFormat |
    CrystalDecisions.Shared.ViewerExportFormats.XmlFormat |
    CrystalDecisions.Shared.ViewerExportFormats.ExcelFormat |
//CrystalDecisions.Shared.ViewerExportFormats.NoFormat); // no exports allowed
//int myFOpts = (int)(CrystalDecisions.Shared.ViewerExportFormats.AllFormats);

crystalReportViewer1.AllowedExportFormats = myFOpts;

Try this to export:

if (ExportTypeSelected == "crReportExportFormatXLSX")
#region XLSX
    // This works do not alter
    // this gets the report name and sets the export name to be the same less the extension
    string outputFileName = "";
    string MyRptName = rpt.FileName.ToString();
    outputFileName = MyRptName.Substring(9, rpt.FileName.Length - 9);
    outputFileName = outputFileName.Substring(0, (outputFileName.Length - 3)) + "xlsx";

        if (File.Exists(outputFileName))

        CrystalDecisions.ReportAppServer.ReportDefModel.DataOnlyExcelExportFormatOptions RASXLXSExportOpts = new DataOnlyExcelExportFormatOptions();
        RASXLXSExportOpts = (DataOnlyExcelExportFormatOptions)rptClientDoc.get_SavedExportOptions(CrReportExportFormatEnum.crReportExportFormatXLSX);

        //textBox1 = "Excel - BaseAreaGroupNumber:       " + RASXLXSExportOpts.BaseAreaGroupNumber.ToString() + "\n";
        //textBox1 += "Excel - BaseAreaType:              " + RASXLXSExportOpts.BaseAreaType.ToString() + "\n";
        //textBox1 += "Excel - ConstantColWidth: " + RASXLXSExportOpts.ConstantColWidth.ToString() + "\n";
        //textBox1 += "Excel - ExportImages:          " + RASXLXSExportOpts.ExportImages.ToString() + "\n";
        //textBox1 += "Excel - ExportObjectFormatting:     " + RASXLXSExportOpts.ExportObjectFormatting.ToString() + "\n";
        //textBox1 += "Excel - ExportPageHeaderAndFooter:           " + RASXLXSExportOpts.ExportPageHeaderAndFooter.ToString() + "\n";
        //textBox1 += "Excel - MaintainColumnAlignment:             " + RASXLXSExportOpts.MaintainColumnAlignment.ToString() + "\n";
        //textBox1 += "Excel - MaintainRelativeObjectPosition:          " + RASXLXSExportOpts.MaintainRelativeObjectPosition.ToString() + "\n";
        //textBox1 += "Excel - ShowGroupOutlines:   " + RASXLXSExportOpts.ShowGroupOutlines.ToString() + "\n";
        //textBox1 += "Excel - SimplifyPageHeaders:             " + RASXLXSExportOpts.SimplifyPageHeaders.ToString() + "\n";
        //textBox1 += "Excel - UseConstantColWidth:       " + RASXLXSExportOpts.UseConstantColWidth.ToString() + "\n";
        //textBox1 += "Excel - UseWorksheetFunctionsForSummaries:       " + RASXLXSExportOpts.UseWorksheetFunctionsForSummaries.ToString() + "\n";

        // Set them now:
        //RasXLSExpOpts.BaseAreaType = CrAreaSectionKindEnum.crAreaSectionKindPageHeader;
        //RasXLSExpOpts.UseConstantColWidth = false;
        //RasXLSExpOpts.ShowGridlines = false;
        //RasXLSExpOpts.StartPageNumber = 3;
        //RasXLSExpOpts.EndPageNumber = 10;

        // Save the udpated info
        //rptClientDoc.set_SavedExportOptions(CrReportExportFormatEnum.crReportExportFormatXLSX, RASXLXSExportOpts);

        CrystalDecisions.ReportAppServer.ReportDefModel.ExportOptions exportOpts1 = new CrystalDecisions.ReportAppServer.ReportDefModel.ExportOptions();
        exportOpts1.ExportFormatType = CrReportExportFormatEnum.crReportExportFormatXLSX; 
        exportOpts1.FormatOptions = RASXLXSExportOpts;
        RASXLXSExportOpts.ConstantColWidth = Convert.ToInt32(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.ExcelExportFormatOptions ExpXLXSOpts= new ExcelExportFormatOptions();
        //ExpXLXSOpts.ConstantColWidth = 45;
        //ExpXLXSOpts.ConvertDatesToStrings = true;

        exportOpts1.ExportOptionsEx = null;

        // And Export
        rptClientDoc.PrintOutputController.ExportEx(exportOpts1).Save(outputFileName, true);
        MessageBox.Show("Export to Excel XLXS Completed", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
    catch (Exception ex)
        btnSQLStatement.Text = "ERROR: " + ex.Message;
#endregion XLSX

You will need to test and play with the code, not sure what I was testing at the time I wrote this...


Answers (1)

Answers (1)

0 Kudos

Hi Stefan,

As of CR 2008 the RDC is no longer available to be used in an Application, so I hope your Service is using .NET?

As of CR 2011 we no longer ship the .net SDK with the installer, you get it from here now:

And please read the info for SP 21, it may no longer work with your Service so you will need to test it.

Yes you can have R2 and CR for VS installed on the same PC, not sure if they will work together though as you did not provide much info.

We always recommend upgrading CR Designer and reports to be the same version, you'll have to test them all to verify this.


0 Kudos

Hello Don,

thanks for your reply.

Yes, the Service uses .NET. It is written in C++.

You write in your link (you give above), that CR for VS still needs .NET version 3.5: is it enough to select "Turn Windows feature on or off" (as you described) or do I have to install this version (as described in

In your section "related documents", when I follow "all reference material...for CR for VS" the "API Reference in compiled HTML" is of 2014, so unfortunately not for newest version of CR13! Where I can find the newest API for CR2013 including all ExportFormatTypes?

The reason why I want to switch to CR2013 is to export to Excel (2007) programmatically. So, what is the ExportFormatType for XLSX?

Thanks in advance