Skip to Content
author's profile photo Former Member
Former Member

Additional columns when exporting to excel using Visual Studio 2010 with Crystal Reports 13.0.2000.0

Hello,

I know that this is a highly covered topic. I have read through many posts on the topic.

The issue we are having is that we are getting additional columns when exporting the report to excel via our application (c# - windows)

Manually exporting the report to excel in Visual Studio (Report Preview) works correctly when choosing the 'Column Width based on objects in the : details' option.

We use Visual Studio (10.0.40219.1 SP1) as our report designer.

When exporting from the application there are additional columns added.

The application that is written in C# and exports reports to excel (and other Formats).

The application processes through a table of reports that is independently generated and exports/emails reports in excel.

Here is the snippet of the code we use to export to excel:

//export by destination type for reports with data

switch (eftFile)

{

case ExportFormatType.Excel:

ExcelFormatOptions CrFormatExcelTypeOptions = new ExcelFormatOptions();

EmailOptions.SourceFileName = sSourceFileName + ".xls";

EmailOptions.AttachmentFileName = sAttachemntFileName + ".xls";

CrDiskFileDestinationOptions.DiskFileName = EmailOptions.SourceFileName;

CrExportOptions = cryRpt.ExportOptions;

CrExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;

CrExportOptions.ExportFormatType = eftFile;

CrExportOptions.DestinationOptions = CrDiskFileDestinationOptions;

CrFormatExcelTypeOptions.ExcelUseConstantColumnWidth = false;

CrFormatExcelTypeOptions.ExcelAreaType = AreaSectionKind.Detail;

CrExportOptions.FormatOptions = CrFormatExcelTypeOptions;

hasRecords = HasRecords(reader, cryRpt);

if (hasRecords)

{

cryRpt.Export();

SendEMail(reader);

}

Basically the code just sets up a name for the report, excel format options and exports it to excel (if it has data ). The output is then emailed.

Using the above code, the report exports to with additional columns.

All the reports go against a MS SQL Server 2005 database, with the majority using Stored Procedures as the datasource.

Any help would be greatly appreciated.

Thanks,

Bill

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Best Answer
    Posted on Sep 12, 2016 at 09:27 PM

    13.0.2000.0 is the assembly version, it never changes. In Programs and Features what service pack are you using?

    SP 17 is available and SP 18 in a few weeks.

    PS - search All of SAP on exporting to Excel, there are guide lines to follow when using this format.

    Don

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.