Skip to Content
0
Former Member
Apr 08, 2010 at 04:46 PM

exporting dataset from crystal to excel

39 Views

Hi, We are trying to resolev an issue which failed to do when exporting dataset from crystal to excel. This used to work. The report was build on .NET Framework 1.1/Visual Studio 2003. Any help would be appreciated. thank you

Here is the code that use to export dataset from crystal to excel. Also, You can uninstall and reinstall crystal report on test server(s3w06410.devfg.rbc.com).

RelationshipDetailsReport rptComp;

rptComp = (RelationshipDetailsReport) Session["CompReport"];

// string strExportFile = DataManager.Outgoing_FileDirectory + "/CompRelAcct.xls"; //Server.MapPath(".")

string fileName = getFileName("CompRelAcct.xls");

string strExportFile = excelFileFirectory + fileName;

rptComp.ExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;

rptComp.ExportOptions.ExportFormatType = ExportFormatType.Excel;

ExcelFormatOptions ObjExcelOption = new ExcelFormatOptions();

ObjExcelOption.ExcelUseConstantColumnWidth = false;

rptComp.ExportOptions.FormatOptions = ObjExcelOption;

DiskFileDestinationOptions objDiskOpt = new DiskFileDestinationOptions();

objDiskOpt.DiskFileName = strExportFile;

rptComp.ExportOptions.DestinationOptions = objDiskOpt;

rptComp.Export();

CopyFile(fileName);

string excelFile = "./ExcelArchive/" + fileName;

Response.Redirect(excelFile);