如何直接在ms-word中打开水晶报表而不保存在asp.net中 [英] How to open crystal report directly in ms-word without saving it in asp.net
本文介绍了如何直接在ms-word中打开水晶报表而不保存在asp.net中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试以ms-word打开水晶报告但不保存它。
我的代码工作正常,但它要求保存文件。这是我的代码
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,);
解决方案
<的第三个参数code> ExportToHttpResponse 被称为asAttachment
。文档说:
表示是否将报告导出为响应的附件。
如果传递true
,将要求用户保存文件。如果你传递false
,通常会打开文件而不保存。
crystalReport.ExportToHttpResponse(CrystalDecisions.Shared .ExportFormatType.WordForWindows,Response, false , 跨度>);
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, "");
解决方案
The third parameter of theExportToHttpResponse
is calledasAttachment
. The documentation says:
Indicates whether or not the report will be exported as an attachment of the response.
If you passtrue
, the user will be asked to save the file. If you passfalse
, the file will usually be opened without saving.
crystalReport.ExportToHttpResponse(CrystalDecisions.Shared.ExportFormatType.WordForWindows, Response, false, "");
这篇关于如何直接在ms-word中打开水晶报表而不保存在asp.net中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文