Automatically Printing Crystal Reports in ASP.NET
This server-based method is documented in the Visual Studio help files. Open the Help Index, and enter PrintToPrinter in the "Look for:" box. The syntax for this method is:
Report.PrintToPrinter(<copies as int>, <collated as True/False>, <startpage as int>, <endpage as int>)
'Collated' in this context has nothing to do with database collation. Some advanced printers (like copier/printers) will sort each document into its own shelf. Not every printer supports this functionality, so check the printer dialog before setting to true. To print the entire report, set startpage and endpage each to 0.
An example in use might look like
MyReport.PrintToPrinter(1,False,0,0)
One limitation of this method is that a printer name must be specified. You can set the default printer at design time in the report, and you can change the printer name at run time by setting the ReportDocument.PrintOptions.PrinterName property (the PrintOptions are also where you can assign page margins, portrait/landscape, etc.). Keep in mind that this method prints from the server itself, not from the client machine. This means that any printer you wish to use must be accessible from the server. You cannot print to a client's desktop printer using this method unless that printer is shared on the network and mapped to the server.
If your LAN has networked printers, you can make some guesses as to which printer to assign as the default in each report. For instance, if the Accounting Department has a departmental printer, that would be a good choice to use for the default in an accounting report. You can provide users the option to choose a networked printer by enumerating the printers mapped to the server and populating a drop-down list. The PrinterSettings.InstalledPrinters property returns a collection of installed printers, and can be bound to a DropDownList as below.
相关文档:
配置ASP.NET平台时遇到的“访问IIS元数据库失败”
(2007-05-18 09:20:08)
标签:
asp
分类:技术随笔
实习也结束了,最近终于有时间正式地搞毕业设计了……
课题是关于搭建一个基于ASP.NET网站框架的,当然配置开发平台是第一步,装上IIS后,在本地访问.aspx页面时总出现如下报错信息:
访 ......
一、认识Web.config文件
Web.config文件是一个XML文本文件,它用来储存 ASP.NET Web 应用程序的配置信息(如最常用的设置ASP.NET Web 应用程序的身份验证方式),它可以出现在应用程序的每一个目录中。当你通过VB.NET新建一个Web应用程序后,默认情况下会在根目录自动创建一个默认的
Web.config文件,包括默认的配置设置 ......
用VS开发ASP.NET网站程序的时候,会将类或Web Services放在特殊的文件夹中,凡是放在这些特殊的文件夹中(App_Themes除外)的程序或内容只允许应用程序访问,对于网页的Request则不予响应(无法读取).
文件夹 &nbs ......
在做asp.net的Web开发的时候,我们经常会遇到一次性上传多个文件的需求。通常我们的解决方法是固定放多个上传文件框,这样的解决办法显然是不合理的,因为一次上传多个,就意味着数量不确定。因此我们就要让这些文件上传框动态添加,下面我以我做的一个图库管理中的上传图片的功能为例
先看效果:
打开的初始界面:
默认 ......