Crystal Report not opening in a new page

  • Thread starter Thread starter Guest
  • Start date Start date
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);
 
Hi John,

If you mean to popup a window to show excel, you should have another page to
show excel. And in export page, have javascript code to popup that page (put
tempfilename in query string).

HTH

Elton Wang
 
Back
Top