It is believed that people who have used them in a way may encounter such a problem, how is it convenient, and beautifully implemented. If you print a browser's print menu, some useless things on the web will be hit on the report, such as the application menu, etc. Because selecting the print menu printing web page will print all the contents of the web page, if your application has a division, the print content will include the contents of each frame, and your actual content is just some of them. Therefore, there are many applications that can only be put in the print function in the background. What should we do in this case? In fact, there can be a variety of ways to implement web printing.
One way is to use a professional print tool such as Crystal Reports. Friends who have used Visual Studio 5.0 must remember this tool, but the version is only 4. a few times. The latest version of the current version has reached 9, and nearly several version of the crystal report supports Web printing. The easiest way is to make a template with a crystal report, and then use the ASP band parameter to call the created template. After generating a report on the web page, the crystal report can be printed directly, or it can be stored as other comparison files such as an Excel file. Using crystal reports can make very beautiful style, the key to your development capabilities of crystal reports, but because the price of crystal reports is high, only when the project is very profitable.
The second method is to purchase a third-party online print control, and the cost is cheaper than the crystal statement, but the effect performance is benevolent.
The third method is to utilize style sheets and JavaScript custom functions. Through the style sheet and JavaScript, the web page print is achieved, and the effect is also possible. There is an instance here, please see. Below is the print function implementation detailed:
Function dp () {
IF (Window.print)
{
Var div1 = document.all.div1.innerhtml;
Var div2 = document.all.div2.innerhtml;
// ******************************************************** *****
// Div1, Div2 is the area in printing
/ / According to what you want to print, use it from the original display page
//
// Wait for the marking, how many items to print?
// ******************************************************** ***** VAR CSS = '