| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
ActiveX for printing problems with WebForms
Hello, if you are having problems to manipulate page settings and printing options look at the code above
Paste this object at your HTML <body> content, do not change it. Code:
<OBJECT ID="WebBrowser1" style="display:none" CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"> </OBJECT> now, to control it you should create a script like this above Code:
<script language="JavaScript">
function printPage
{
WebBrowser1.ExecWB(6,1,null,null);
}
function previewPage
{
WebBrowser1.ExecWB(7,1,null,null);
}
function configurePage
{
WebBrowser1.ExecWB(8,1,null,null);
}
</script>
try this code: Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Object Test</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript">
function PreviewPage()
{
WebBrowser1.ExecWB(7,1,null,null);
}
</script>
</head>
<body onLoad="PreviewPage()">
<OBJECT ID="WebBrowser1" style="display:none" CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2">
</OBJECT>
</body>
</html>
note: This code doesn't work for other browsers than Internet Explorer. Last edited by Shadow Wizard : July 23rd, 2005 at 01:53 PM. Reason: added [code] tags around code - please do it yourself next. |
|
#2
|
||||
|
||||
|
nice, thanks.
|
|
#3
|
|||
|
|||
|
Another add-ins to the original code...
Well i was testing the code i posted and discovered some functionalities of the ExecWB function
Code:
// Calls the 'Open' function of the 'File' menu in the browser. WebBrowser1.ExecWB(1,1,null,null) // Calls the 'New' function of the 'File' menu in the browser. WebBrowser1.ExecWB(2,1,null,null) // Calls the 'Save' function of the 'File' menu in the browser. WebBrowser1.ExecWB(3,1,null,null) // Calls the 'Save As' function of the 'File' menu in the browser. WebBrowser1.ExecWB(4,1,null,null) // Calls the 'Save Copy As' function of the 'File' menu in the browser. WebBrowser1.ExecWB(5,1,null,null) // Calls the 'Print' function of the 'File' menu in the browser. WebBrowser1.ExecWB(6,1,null,null) // Calls the 'Preview' function of the 'File' menu in the browser. WebBrowser1.ExecWB(7,1,null,null) // Calls the 'Page Setup' function of the 'File' menu in the browser. WebBrowser1.ExecWB(8,1,null,null) // Calls the 'Spell' function of the 'Tools' menu in the browser. WebBrowser1.ExecWB(9,1,null,null) // Calls the 'Properties' function of the 'File' menu in the browser. WebBrowser1.ExecWB(10,1,null,null) // Calls the 'Cut' function of the 'Edit' menu in the browser. WebBrowser1.ExecWB(11,1,null,null) // Calls the 'Copy' function of the 'Edit' menu in the browser. WebBrowser1.ExecWB(12,1,null,null) // Calls the 'Paste' function of the 'Edit' menu in the browser. WebBrowser1.ExecWB(13,1,null,null) // Calls the 'Paste Especial' function of the 'Edit' menu in the browser. WebBrowser1.ExecWB(14,1,null,null) // Calls the 'Undo' function of the 'Edit' menu in the browser. WebBrowser1.ExecWB(15,1,null,null) // Calls the 'Redo' function of the 'Edit' menu in the browser. WebBrowser1.ExecWB(16,1,null,null) // Calls the 'Select All' function of the 'Edit' menu in the browser. WebBrowser1.ExecWB(17,1,null,null) // Calls the 'Clear Selection' function of the 'Edit' menu in the browser. WebBrowser1.ExecWB(18,1,null,null) // Calls the 'Zoom' function of the 'View' menu in the browser. WebBrowser1.ExecWB(19,1,null,null) // Calls the 'Refresh' function of the browser. WebBrowser1.ExecWB(22,1,null,null) // Calls the 'Stop' function of the browser. WebBrowser1.ExecWB(23,1,null,null) // Calls the 'Find' function of the browser. WebBrowser1.ExecWB(32,1,null,null) Thats all for now... |
![]() |
| Viewing: ASP Free Forums > Programming > Code Bank > Object for printing problems with WebForms |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|