G
Guest
Help me please,
I'm creating an excel crystal report.
The problem is that it is opening in the browser instead of in its own page.
I have done this many times and it had worked just fine.
I think the problem is that this project is in a frameset.
Could that be causing the problem?
Any help would be appreciated.
A code snippet follows:
ReportDocument crpt = new ReportDocument();
crpt.SetDataSource(ds);
ExcelFormatOptions excelFormatOpts = new ExcelFormatOptions();
excelFormatOpts.ExcelTabHasColumnHeadings = true;
excelFormatOpts.ExcelUseConstantColumnWidth = false;
crpt.ExportOptions.FormatOptions = excelFormatOpts;
string tempfilename =
System.Configuration.ConfigurationSettings.AppSettings["TempDir"] +
Session.SessionID.ToString() + ".xsl";
crDiskFileDestinationOptions.DiskFileName = tempfilename;
crpt.ExportOptions.DestinationOptions = crDiskFileDestinationOptions;
crpt.ExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
crpt.ExportOptions.ExportFormatType = ExportFormatType.Excel;
crpt.Export();
Response.ClearContent();
Response.ClearHeaders();
Response.ContentType = "application/vnd.ms-excel";
Response.WriteFile(tempfilename);
Response.Flush();
Response.Close();
System.IO.File.Delete(tempfilename);
I'm creating an excel crystal report.
The problem is that it is opening in the browser instead of in its own page.
I have done this many times and it had worked just fine.
I think the problem is that this project is in a frameset.
Could that be causing the problem?
Any help would be appreciated.
A code snippet follows:
ReportDocument crpt = new ReportDocument();
crpt.SetDataSource(ds);
ExcelFormatOptions excelFormatOpts = new ExcelFormatOptions();
excelFormatOpts.ExcelTabHasColumnHeadings = true;
excelFormatOpts.ExcelUseConstantColumnWidth = false;
crpt.ExportOptions.FormatOptions = excelFormatOpts;
string tempfilename =
System.Configuration.ConfigurationSettings.AppSettings["TempDir"] +
Session.SessionID.ToString() + ".xsl";
crDiskFileDestinationOptions.DiskFileName = tempfilename;
crpt.ExportOptions.DestinationOptions = crDiskFileDestinationOptions;
crpt.ExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
crpt.ExportOptions.ExportFormatType = ExportFormatType.Excel;
crpt.Export();
Response.ClearContent();
Response.ClearHeaders();
Response.ContentType = "application/vnd.ms-excel";
Response.WriteFile(tempfilename);
Response.Flush();
Response.Close();
System.IO.File.Delete(tempfilename);