我想将Crystal报表导出到excel,但是当导出时,一些excel列被合并。当我尝试使用带有导出选项的设计器导出为Excel 8.0时,它看起来不错。 .Net上有什么参数可用于将Crystal Report导出到某些excel版本?
ExportOptions exportOpts = new ExportOptions();
ExcelFormatOptions excelFormatOpts = new ExcelFormatOptions ();
DiskFileDestinationOptions diskOpts = new DiskFileDestinationOptions();
exportOpts = Report.ExportOptions;
excelFormatOpts.ExcelUseConstantColumnWidth = true;
exportOpts.ExportFormatType = ExportFormatType.Excel;
exportOpts.FormatOptions = excelFormatOpts;
exportOpts.ExportDestinationType = ExportDestinationType.DiskFile;
diskOpts.DiskFileName = fileName;
exportOpts.DestinationOptions = diskOpts;
Report.Export ();
我可以添加任何选项来设置Excel版本吗?
答案 0 :(得分:1)
您可以使用ExcelRecord代替Excel,因为Excel仅导出具有设计的报告
ExportOptions exp = new ExportOptions();
DiskFileDestinationOptions dis = new DiskFileDestinationOptions();
ExcelFormatOptions exexl = new ExcelFormatOptions();
dis.DiskFileName = filename;
exp = report.ExportOptions;
exp.ExportDestinationType = ExportDestinationType.DiskFile;
exp.ExportFormatType = ExportFormatType.ExcelRecord;
exp.ExportFormatOptions = exexl;
exp.ExportDestinationOptions = dis;
report.Export();