When using the following statement, it is best to Try {} catch (e) {} to use IE with more than 5.5
The following content has been tested on IE6 7 and has a problem with the OK FF test.
Note: The following method calls are in IE6 and can be enclosed by brackets. IE7 cannot contain parentheses.
It is best not to enclose brackets for convenience.
- WebBrowser. ExecWB () Open
- WebBrowser. ExecWB () Close all existing IE Windows and open a new window
- WebBrowser. ExecWB () Save the webpage
- WebBrowser. ExecWB (6, 1) print
- WebBrowser. ExecWB (7,1) print preview
- WebBrowser. ExecWB (8, 1) print page settings
- WebBrowser. ExecWB (10, 1) view page properties
- WebBrowser. ExecWB () seems to be undo, to be confirmed
- Select All WebBrowser. ExecWB (17,1)
- WebBrowser. ExecWB (22, 1) Refresh
- WebBrowser. ExecWB () Close form no prompt
The last WebBrowser. ExecWB () can effectively solve the problem in IE7
WebBrowser. ExecWB () the window. close () method becomes invalid when print preview is executed and the result is returned to the original window.
- <Style media = "print" type = "text/css">
- . Noprint {display: none ;}
- . PageNext {page-break-after: always ;}
- </Style>
Then, add "class =" Noprint "to the page element that you do not want to print. This will not appear in print or print preview.
Add <div class = "PageNext> </div> to the page.
- <Div class = "PageNext">
- The first page of the printed content
- </Div>
- <Div class = "PageNext">
- The second page of the printed content
- </Div>
- <Div class = "pagenext">
- The third page of the printed content
- </Div>
For preview, run the following code:
This can be written when you open preview or print in a temporary window.
- Webbrowser. execwb (7,1 );
- Window. Opener = NULL;
- Window. Close ();
For A4 paper, 920 is used for horizontal and 640 is used for vertical la S.
- 1. Automatic line feed:
- <Style type = "text/CSS">
- . Autonewline
- {
- Word-break: Break-all;/* required */
- }
- </Style>
- <Table>
- <Tr>
- <TD class = "autonewline"> automatic newline automatic newline, automatic newline, automatic newline </TD>
- </Tr>
- </Table>
- 2. Do not wrap:
- <Style type = "text/CSS">
- . Nonewline
- {
- Word-break: Keep-all;/* required */
- }
- </Style>
- <Table>
- <Tr>
- <TD class = "nonewline"> no line breaks, no line breaks </TD>
- </Tr>
- </Table>
The settings of the header and footer are all written in vsscript by google. However, I have learned vb, so I can understand it. However, this does not affect your use. below is the code
- <Script language = "VBScript">
- Dim hkey_root, hkey_path, hkey_key
- Hkey_root = "HKEY_CURRENT_USER"
- Hkey_path = "/software/Microsoft/Internet Explorer/pagesetup"
- '// Set the page header and footer to be blank
- Function pagesetup_null ()
- On Error resume next
- Set regwsh = Createobject ("wscript. Shell ")
- Hkey_key = "/Header"
- Regwsh. regwrite hkey_root + hkey_path + hkey_key ,""
- Hkey_key = "/footer"
- RegWsh. RegWrite hkey_root + hkey_path + hkey_key ,""
- End function
- '// Set the page header and footer to the default value.
- Function pagesetup_default ()
- On error resume next
- Set RegWsh = CreateObject ("WScript. Shell ")
- Hkey_key = "/header"
- RegWsh. RegWrite hkey_root + hkey_path + hkey_key, "& w & B page number, & p/& P"
- Hkey_key = "/footer"
- RegWsh. RegWrite hkey_root + hkey_path + hkey_key, "& u & B & d"
- End function
- </Script>
Header and footer parameters usage window title & w
Webpage address (URL) & u
Short Date Format (specified by "region Settings" in "Control Panel") & d
Long Date Format (specified by "region Settings" in "Control Panel") & D
Current page number & p
Total number of pages & P
Right-aligned text (followed by & B) & B
Text Center (between & B) & B