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: