This article mainly introduces how to print, print, preview, and print settings in JavaScript. For more information, see WebBrowser, which is a built-in browser control of IE. You do not need to download it.
I. WebBrowser Control
Ii. WebBrowder control method // print
WebBrowser1.ExecWB (6, 1 );
// Print settings
WebBrowser1.ExecWB (8, 1 );
// Print and preview
WebBrowser1.ExecWB (7,1 );
There are other usage examples of this component:
WebBrowser. ExecWB () Open Web. ExecWB () Close all existing IE Windows and open a new window Web. ExecWB)
Save Web pages. ExecWB (6, 1) print Web. ExecWB (7, 1) print preview Web. ExecWB (8, 1)
Print page settings Web. ExecWB (10, 1)
View page properties Web. ExecWB)
It seems to be undo. To be confirmed, Web. ExecWB (17,1)
Select all Web. ExecWB () to refresh Web. ExecWB)
When the form is closed, no prompt is displayed, but printing will print the entire page. The page will display everything. Sometimes we only need to print the data table, now we have to write a style:
Hide the part that you do not want to print: style content:
Then you can use the style:
No printing required
The Code is as follows:
The Code is as follows: