Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Strange Issue with using ExportToHttpResponse for exporting to Excel


We are working with BO XI R2 with .Net 2.0.

We are using ExportToHttpResponse method to export the Crystal Report to pdf/excel and directly opening the export in a browser window.

Code being used is as follows :

For pdf : rd.ExportToHttpResponse(ExportFormatType.PortableDocFormat, oResponse, false, Name);

For Excel : rd.ExportToHttpResponse(ExportFormatType.Excel, oResponse, false, Name);

where 'rd' is ReportDocument instance.

The strange issue here is that for pdf output this works as desired and the exported report is directly opened in the browser window. However when it comes to Excel ; it does not open the exported file in the browser window and gives a prompt to open/save file. Even if the 'asAttachment' parameter of ExportToHttpResponse method is set to false it still is sending the exported file as an attachment to the browser and not opening it directly (as it is happening in the case of a pdf export )

Do we need to set the Response.ContentType to excel ; if yes then why it is working in case of pdf.

Can any one please advise about this strange issue .


Vinayak Vidhate

Former Member

Hi, Vinayak;

How a document is handled is determined by Windows' settings, not your program.

- Open Windows Explorer, and go to the Tools menu, and choose Folder Options

- Go to the File Types tab

- Go to the entry for XLS Microsoft Excel Spreadsheet

- Click the Advanced button

- In the Actions window, select Open, and uncheck the "confirm open after download" option.

You should now not be prompted to save the file, and it should open automatically.

Best Regards,


0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question