Click here to Skip to main content
15,884,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am trying to open crystal report in ms-word but without saving it.

My code is working fine but it's asking to save the file. Here is my code

CrystalReportViewer1.ReportSource = rptDoc;<br />
                ReportDocument crystalReport = new ReportDocument(); <br />
                crystalReport.Load(Server.MapPath(ReportName)); <br />
                crystalReport.SetDataSource(dt); <br />
                CrystalReportViewer1.ReportSource = crystalReport;    crystalReport.ExportToHttpResponse(CrystalDecisions.Shared.ExportFormatType.WordForWindows, Response, true, "");
Posted

1 solution

The third parameter of the ExportToHttpResponse is called asAttachment. The documentation says:

Indicates whether or not the report will be exported as an attachment of the response.

If you pass true, the user will be asked to save the file. If you pass false, the file will usually be opened without saving.
C#
crystalReport.ExportToHttpResponse(CrystalDecisions.Shared.ExportFormatType.WordForWindows, Response, false, "");
 
Share this answer
 
Comments
Member 10371622 13-Oct-15 10:32am    
Hi @Rechard Deeming
Thanks for your reply, I have tried your solution but still the same result :(

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900