ASP.NET 調用印表機控制項的方法 IEWebBrowser這個組件

來源:互聯網
上載者:User

我對IEWebBrowser這個組件的execWB方法整理了一下﹐希望對大家有所協助。
1. <object id="WebBrowser" width=0 height=0 classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></object>
2. 調用方法。
WebBrowser.ExecWB nCmdID, nCmdExecOpt, [pvaIn], [pvaOut]
3. 參數說明。
(a).nCmdID
OLECMDID_OPEN = 1,
OLECMDID_NEW = 2,
OLECMDID_SAVE = 3,
OLECMDID_SAVEAS = 4,
OLECMDID_SAVECOPYAS = 5,
OLECMDID_PRINT = 6,
OLECMDID_PRINTPREVIEW = 7,
OLECMDID_PAGESETUP = 8,
OLECMDID_SPELL = 9,
OLECMDID_PROPERTIES = 10,
OLECMDID_CUT = 11,
OLECMDID_COPY = 12,
OLECMDID_PASTE = 13,
OLECMDID_PASTESPECIAL = 14,
OLECMDID_UNDO = 15,
OLECMDID_REDO = 16,
OLECMDID_SELECTALL = 17,
OLECMDID_CLEARSELECTION = 18,
OLECMDID_ZOOM = 19,
OLECMDID_GETZOOMRANGE = 20
OLECMDID_UPDATECOMMANDS = 21
OLECMDID_REFRESH = 22
OLECMDID_STOP = 23
OLECMDID_HIDETOOLBARS = 24
OLECMDID_SETPROGRESSMAX = 25
OLECMDID_SETPROGRESSPOS = 26
OLECMDID_SETPROGRESSTEXT = 27
OLECMDID_SETTITLE = 28
OLECMDID_SETDOWNLOADSTATE = 29
OLECMDID_STOPDOWNLOAD = 30
上面的關鍵詞都可以在瀏覽器的菜單裡面找到對應的選項﹐大家一看就明白的﹗
(b).nCmdExecOpt
OLECMDEXECOPT_DODEFAULT = 0,
OLECMDEXECOPT_PROMPTUSER = 1,
LECMDEXECOPT_DONTPROMPTUSER = 2,
OLECMDEXECOPT_SHOWHELP = 3
對於這個參數﹐一般來說﹐選1就可以了。

這是調用IE的”另存新檔”功能的樣本﹕

<object id="WebBrowser" width=0 height=0 classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></object>
<A href="javascript:WebBrowser.ExecWB(4,1);">Save-儲存</A>

OBJECT classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2" height=0 id=WebBrowser width=0></OBJECT>
<table><tr><td>
<input name=Button onClick=document.all.WebBrowser.ExecWB(1,1) type=button value=開啟>
</td></tr>
<tr><td><input name=Button onClick=document.all.WebBrowser.ExecWB(2,1)
<tr><td><input name=Button onClick=document.all.WebBrowser.ExecWB(4,1) type=button value=另存新檔></td></tr>
<tr><td><input name=Button onClick=document.all.WebBrowser.ExecWB(10,1) type=button value=屬性></td></tr>
<tr><td><input name=Button onClick=document.all.WebBrowser.ExecWB(6,1) type=button value=列印></td></tr>
<tr><td><input name=Button onClick=document.all.WebBrowser.ExecWB(6,6) type=button value=列印>不會彈出印表機視窗</td></tr>
<tr><td><input name=Button onClick=document.all.WebBrowser.ExecWB(7,1) type=button value=預覽列印 ></td></tr>
<tr><td><input name=Button onClick=document.all.WebBrowser.ExecWB(8,1) type=button value=版面設定></td></tr>
<tr><td><input name=Button onClick=document.all.WebBrowser.ExecWB(10,1) type=button value=查看頁面屬性></td></tr>
<tr><td><input name=Button onClick=document.all.WebBrowser.ExecWB(15,1) type=button value=撤銷></td></tr>
<tr><td><input name=Button onClick=document.all.WebBrowser.ExecWB(17,1) type=button value=全選></td></tr>
<tr><td><input name=Button onClick=document.all.WebBrowser.ExecWB(22,1) type=button value=重新整理></td></tr>
<tr><td><input name=Button onClick=document.all.WebBrowser.ExecWB(45,1) type=button value=關閉表單無提示></td></tr>
<tr><td><input type=button value=重新整理 name=refresh onclick="window.location.reload()">
</td></tr>

IEWebBrowser
1.開啟

<input name="Button" onClick="document.all.WebBrowser.ExecWB(1,1)"
type="button" value="開啟">
<OBJECT classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2" height="0"
id="WebBrowser" width="0"></OBJECT>

2.另存新檔

<input name="Button" onClick="document.all.WebBrowser.ExecWB(4,1)"
type="button" value="另存新檔">
<OBJECT classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2" height="0"
id="WebBrowser" width="0"></OBJECT>

3.屬性

<input name="Button" onClick="document.all.WebBrowser.ExecWB(10,1)"
type="button" value="屬性">
<OBJECT classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2" height="0"
id="WebBrowser" width="0"></OBJECT>

4.列印

<input name="Button" onClick="document.all.WebBrowser.ExecWB(6,1)"
type="button" value="列印">
<OBJECT classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2" height="0"
id="WebBrowser" width="0"></OBJECT>

5.版面設定

<input name="Button" onClick="document.all.WebBrowser.ExecWB(8,1)"
type="button" value="版面設定">
<OBJECT classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2" height="0"
id="WebBrowser" width="0"></OBJECT>

6.重新整理

<input type="button" value="重新整理" name="refresh" onclick="window.location.reload()">

7.匯入收藏

<input type="button" name="Button" value="匯入收藏夾"
onClick="window.external.ImportExportFavorites(true,);">

8.匯出收藏

<input type="button" name="Button" value="匯出收藏夾"
onClick="window.external.ImportExportFavorites(false,);">

9.加入收藏

<input name="Button" onclick="window.external.AddFavorite(location.href, document.title)"
type="button" value="加入收藏夾">

10.整理收藏夾

<input name="Submit" onclick="window.external.ShowBrowserUI(OrganizeFavorites, null)"
type="button" value="整理收藏夾">

11.查看源檔案

<input name="Button" onclick=window.location = "view-source:" + window.location.href
type=button" value="查看源檔案">

12.語言設定

<input name="Button" onclick="window.external.ShowBrowserUI(LanguageDialog, null)"
type="button" value="語言設定">

13.前進

<input name="Submit" onclick="history.go(1);" type="submit" value="前進">

14.後退

<input name="Submit" onclick="history.go(-1);" type="submit" value="後退">

或者

<input name="Submit" onclick="history.back();" type="submit" value="後退">

IEWebBrowser組件的execWB方法整理:

1. <object id="WebBrowser" width="0" height="0"
classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></object>

2.調用方法

WebBrowser.ExecWB(nCmdID, nCmdExecOpt)

3.參數說明

nCmdID:(其關鍵詞都可以在瀏覽器的菜單裡面找到對應的選項)
OLECMDID_OPEN = 1 //開啟
OLECMDID_NEW = 2 //建立
OLECMDID_SAVE = 3 //儲存
OLECMDID_SAVEAS = 4 //另存新檔
OLECMDID_SAVECOPYAS = 5 //
OLECMDID_PRINT = 6 //列印
OLECMDID_PRINTPREVIEW = 7 //預覽列印
OLECMDID_PAGESETUP = 8 //版面設定
OLECMDID_SPELL = 9 //
OLECMDID_PROPERTIES = 10 //屬性
OLECMDID_CUT = 11 //剪下
OLECMDID_COPY = 12 //複製
OLECMDID_PASTE = 13 //粘貼
OLECMDID_PASTESPECIAL = 14 //
OLECMDID_UNDO = 15 //
OLECMDID_REDO = 16 //
OLECMDID_SELECTALL = 17 //全選
OLECMDID_CLEARSELECTION = 18 //
OLECMDID_ZOOM = 19 //
OLECMDID_GETZOOMRANGE = 20 //
OLECMDID_UPDATECOMMANDS = 21 //
OLECMDID_REFRESH = 22 //重新整理
OLECMDID_STOP = 23 //停止
OLECMDID_HIDETOOLBARS = 24 //隱藏工具列
OLECMDID_SETPROGRESSMAX = 25 //
OLECMDID_SETPROGRESSPOS = 26 //
OLECMDID_SETPROGRESSTEXT = 27 //
OLECMDID_SETTITLE = 28 //
OLECMDID_SETDOWNLOADSTATE = 29 //
OLECMDID_STOPDOWNLOAD = 30 //

nCmdExecOpt:(此參數一般情況選1即可)

OLECMDEXECOPT_DODEFAULT = 0 //
OLECMDEXECOPT_PROMPTUSER = 1 //
LECMDEXECOPT_DONTPROMPTUSER = 2 //
OLECMDEXECOPT_SHOWHELP = 3

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.