仓酷云

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 516|回复: 7
打印 上一主题 下一主题

[学习教程] ASP.NET教程之Asp.net 水晶报表之打印和导特别式

[复制链接]
莫相离 该用户已被删除
跳转到指定楼层
楼主
发表于 2015-1-16 22:37:10 | 显示全部楼层 回帖奖励 |倒序浏览 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
什么叫数据库怎么样?什么意思?你想单学数据库。(其实变成是我问的)asp.net|打印|水晶报表  在ASP.NET中水晶报表没有象在WindowsForm中那样供应报表的导出和打印功效,必要我们本人下手增加代码来把持,上面给个DEMO:

  导出:
myReportReportDoc=newmyReport();//表表的称号
privatevoidbtnExport_Click(objectsender,System.EventArgse)
{
CrystalDecisions.Shared.DiskFileDestinationOptionsDiskOpts=newCrystalDecisions.Shared.DiskFileDestinationOptions();
ReportDoc.ExportOptions.ExportDestinationType=CrystalDecisions.Shared.ExportDestinationType.DiskFile;
switch(DropDownList1.SelectedItem.Text)
{
case"RichText(RTF)":
 ReportDoc.ExportOptions.ExportFormatType=CrystalDecisions.Shared.ExportFormatType.RichText;
 DiskOpts.DiskFileName="d:demo.rtf";
break;
case"PortableDocument(PDF)":
 ReportDoc.ExportOptions.ExportFormatType=CrystalDecisions.Shared.ExportFormatType.PortableDocFormat;
 DiskOpts.DiskFileName="d:demo.pdf";
break;
case"MSWord(DOC)":
 ReportDoc.ExportOptions.ExportFormatType=CrystalDecisions.Shared.ExportFormatType.WordForWindows;
 DiskOpts.DiskFileName="d:demo.doc";
break;
case"MSExcel(XLS)":
 ReportDoc.ExportOptions.ExportFormatType=CrystalDecisions.Shared.ExportFormatType.Excel;
 DiskOpts.DiskFileName="d:demo.xls";
break;
default:
break;
}
ReportDoc.ExportOptions.DestinationOptions=DiskOpts;
 ReportDoc.Export();
}

  打印:
privatevoidbtnPrint_Click(objectsender,System.EventArgse)
{
stringstrPrinterName;//指定打印机称号
strPrinterName=@"CanonBubble-JetBJC-210SP";
PageMarginsmargins;//设置打印页边距
margins=ReportDoc.PrintOptions.PageMargins;
margins.bottomMargin=250;
margins.leftMargin=350;
margins.rightMargin=350;
margins.topMargin=450;
ReportDoc.PrintOptions.ApplyPageMargins(margins);
ReportDoc.PrintOptions.PrinterName=strPrinterName;//使用打印机称号
//打印报表.startPageN和endPageN
//参数设置为0暗示打印一切页。
ReportDoc.PrintToPrinter(1,false,0,0);
}在经过全球个人PC市场占有90%的微软对asp.net不断优化与整合后,asp.net与微软自身平台的动用上更加的高效,加上asp.net在应用上非常容易上手,相信asp.net仍会是最多客户选用的脚本语言,并会在未来几年继续领跑。
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|仓酷云 鄂ICP备14007578号-2

GMT+8, 2024-6-12 19:06

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表