Use WebBrowser Control 1. WebBrowser control (partial printing can be achieved through Style settings) & lt; objectID & amp; #39; WebBrowser & amp; #39; WIDTH0HEIGHT0CLASSID & amp; #39; CLSID: 8856F961-340A-11D0-A96B-00C04FD705A2 &
Use the WebBrowser Control
1. WebBrowser control (partial printing can be achieved through Style setting)
2. WebBrowder Control Method
1. Print
WebBrowser1.ExecWB (6, 1 );
2. Print settings
WebBrowser1.ExecWB (8, 1 );
3. Print and preview
WebBrowser1.ExecWB (7,1 );
3. Print the header and footer settings
Var hkey_root, hkey_path, hkey_key
Hkey_root = "HKEY_CURRENT_USER"
Hkey_path = "\ Software \ Microsoft \ Internet Explorer \ PageSetup \\"
1. Clear the header and footer
Try {
Var RegWsh = new ActiveXObject ("WScript. Shell ")
Hkey_key = "header"
RegWsh. RegWrite (hkey_root + hkey_path + hkey_key ,"")
Hkey_key = "footer"
RegWsh. RegWrite (hkey_root + hkey_path + hkey_key ,"")
} Catch (e ){}
2. Set the header and footer www.2cto.com
Try {
Var RegWsh = new ActiveXObject ("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 ")
} Catch (e ){}
4. Page Printing
Since printing prints the entire page, if you only need to print the data table, we will hide the part that we do not want to print.
1,
// Hide all layers other than the specified id
Function setdivhidden (id ){
Var divs = document. getElementsByTagName ("DIV ");
For (var I = 0; I {
If (divs. item (I). id! = Id)
Divs. item (I). style. display = "none ";
}
}
2,
// Print page settings
Function printsetup (){
WebBrowser.exe cwb (8, 1 );
}
3. // print the Page Preview
Function printpreview (){
WebBrowser.exe cwb (7,1 );
}
4. Print
Function printit (){
If (confirm ('Are you sure you want to print? '))
WebBrowser.exe cwb (6, 1)
}
5. HTML page elements
From Core_Star's column