Web|web Print believe that the B/s way to do the application of the people may encounter such a problem, how to easily and beautifully realize the report print. If you use the browser's print menu to print, you will put some useless things on the page on the report, such as the Application menu. Because selecting a print menu to print a Web page will print out all the content in the page, and if your application has a split frame, the printed content will include the contents of each frame, and what you actually want is only part of it. So there are many applications can only put the printing function in the background to complete. What should we do in the light of this situation? In fact, there are many ways to achieve the Web page printing function.
One way is to use professional printing tools, such as Crystal Reports (Crystal Report). Friends with Visual Studio 5.0 certainly remember this tool, but the version was only 4. Now the latest version has reached 9, nearly several versions of the Crystal Report Support Web printing. The simplest way is to use the Crystal Report to make a good template, and then use the ASP with parameters to call the production template can be. Crystal Report When you generate a report on a Web page, you can print it directly, or you can dump it as a different comparison through a file such as an Excel file. Use Crystal Report can make a very beautiful style, the key in your Crystal Report development ability, but because the Crystal report price is high, only when the project is very profitable to buy.
The second way is to buy a third party's online print control, the cost is cheaper than the Crystal report, but the effect of how the performance of the beholder.
The third approach is to use style sheets and JavaScript custom functions to implement. Through the style sheet and JavaScript, the implementation of Web page printing, the effect is also OK. Here is an example to invite you to take a look. The following is a detailed print function implementation:
!--//.noprint defines noprint, class= "noprint" is added to the following areas where no printing is required, and window.print () is ignored when you print the-->
All right, all right, now all you have to do is call the DP function, if you design the button that implements the call on the same page, call it directly; if you use the frame method and the button that implements the call is on another page, the Window.focus () command is added to the first line of the DP function. Otherwise, only pages with buttons are printed.
The fourth approach, implementation is a tricky approach. The same is done by calling Window.print (), just creating a Web page of what you want to print, and the Print button on another frame. Assuming that the report page is on the mainframe, the button is on the Topframe, the button calls the Printreports () function, and the Printreports () function is the following to achieve the print job.
function printreports ()//topframe functions in Web pages
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.