web下vs2008+crystal report 不预览直接打印
2009-12-03 09:27
288 查看
下载了一个PrintControl.cab(vs2008用的)
然后在webconfig中设置:
代码
protected void Page_Load(object sender, EventArgs e)
{
//if (!IsPostBack)
//{
//}
//本来是想写在IsPostBack里面的,但这样写就提示您请求的报表需要更多信息... 所以只好写在外面 ,原因是打印的时候还要重新绑定水晶报表。
BindCRV();
}
void BindCRV
{
CrystalDecisions.Web.CrystalReportSource crs = new CrystalDecisions.Web.CrystalReportSource();
PrintDocument prtdoc = new PrintDocument();
string strDefaultPrinter = prtdoc.PrinterSettings.PrinterName;
try
{
crs.ReportDocument.Load(reportpath);
crs.ReportDocument.SetDataSource(ds.Tables[0]);
crs.DataBind();
CrystalReportViewer1.ReportSource = crs;
CrystalReportViewer1.DataBind();
}
catch (Exception ex)
{
//UnCommon.ShoMessage(ex.Message, false, this);
// WSBG.UnCommon.ExecuteScript("alert('" + ex.Message + "')", this);
}
finally
{
crs.Dispose();
GC.Collect();
}
}
终于大功公成,不预览直接打印
然后在webconfig中设置:
代码
protected void Page_Load(object sender, EventArgs e)
{
//if (!IsPostBack)
//{
//}
//本来是想写在IsPostBack里面的,但这样写就提示您请求的报表需要更多信息... 所以只好写在外面 ,原因是打印的时候还要重新绑定水晶报表。
BindCRV();
}
void BindCRV
{
CrystalDecisions.Web.CrystalReportSource crs = new CrystalDecisions.Web.CrystalReportSource();
PrintDocument prtdoc = new PrintDocument();
string strDefaultPrinter = prtdoc.PrinterSettings.PrinterName;
try
{
crs.ReportDocument.Load(reportpath);
crs.ReportDocument.SetDataSource(ds.Tables[0]);
crs.DataBind();
CrystalReportViewer1.ReportSource = crs;
CrystalReportViewer1.DataBind();
}
catch (Exception ex)
{
//UnCommon.ShoMessage(ex.Message, false, this);
// WSBG.UnCommon.ExecuteScript("alert('" + ex.Message + "')", this);
}
finally
{
crs.Dispose();
GC.Collect();
}
}
终于大功公成,不预览直接打印
相关文章推荐
- 编写web打印程序,实现打印预览,直接打印 ,页面设置 ,关闭
- web下vs2008+crystal report 不预览直接打印
- 基于Metronic的Bootstrap开发框架经验总结(9)--实现Web页面内容的打印预览和保存操作
- 利用IE浏览器直接实现WEB打印
- FastReport ASP.Net开发Web报表时直接打印的问题
- 在web服务器上,有些pdf, 怎么让用户在页面上点击一个按钮,就直接打印?
- 在web html页面中,打印、预览当前页面
- 直接打印水晶报表Crystal Report到打印机 - Web模式
- WEB水晶报表直接打印
- 也谈WEB打印(二):简单的分析一下IE的打印原理并实现简单的打印和预览
- 也谈WEB打印(五):在IE的打印预览窗口中定义自己的用户接口
- Smart Form不弹出假脱机设置界面直接打印预览
- web生成pdf后的直接打印,隐藏iframe
- WEB页面打印--打印指定区域,页面预览,页面设置
- web打印控件支持票据套打时,底图仅在打印预览时显示,不输出到打印机(ReYoPrint)
- javascript结合WebBrowser实现打印预览、直接打印、页
- Web下实现打印、打印预览、打印设置、导出到Excel
- WinForm中 如何直接调用Excel的打印预览功能,但不显示Excel文件
- WEB页面同时实现两种打印(下载Excel,页面直接打印)
- WEB水晶报表直接打印