on 09-12-2016 5:37 PM
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.