cancel
Showing results for 
Search instead for 
Did you mean: 

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

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

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

Former Member
0 Kudos

Don,

I am using 13.0.14.1720.

If you could point me to any code examples showing the excel export by details, that would be extremely helpful.

Thanks,

Bill

0 Kudos

SP 17 is available now.

Search this way:


Use Export to excel

Answers (0)