導航:首頁 > 文件教程 > com控制項教程

com控制項教程

發布時間:2025-03-28 21:34:31

⑴ c如何注冊activex控制項

如何注冊ocx控制項

注冊ocx控制項的方法步驟如下:

1.雙擊滑鼠左鍵打開c盤。

2.打開「窗口」。如果計算機是32位系統,請將comdlg32.ocx文件移動到system32文件夾中。如果計算機是64位的,請將其移動到sysWOW64文件夾中。

3.按住鍵盤上的「winr」開始運行。如果計算機是32位,請輸入以下字元,然後單擊「確定」。

4.如果計算機是64位,請輸入以下字元,然後單擊「確定」。通過以上步驟可以注冊ocx控制項。

win7旗艦版activex控制項怎麼安裝?

win7旗艦版activex控制項安裝方法:

1.WindowsVista中ActiveX控制項其它非常簡單,點擊「開始」→「控制面板」→「程序」,點擊「打開或關閉Windows功能」。打開或關閉Windows功能,

2.在「Windows功能」窗口下,選中「ActiveX安裝程序服務」的復選框。點擊「確定」按鈕。ActiveX安裝程序服務;

3.Windows會配置該功能,配置後即可使用。

如何使用C#開發「類ActiveX組件」?

1C#開發技術_使用C#開發ActiveX控制項20.0.0.0.ActiveX控制項以前也叫做OLE控制項或OCX控制項,它是一些軟體組件或對象,可以將其插入到WEB網頁或其它應用程序中。

使用A.

筆記本怎麼設置瀏覽器允許使用activex?

設置瀏覽器允許使用activex方法

1、首先打開開瀏覽器,在窗口的右上角點擊設置圖標,在展開的菜單中點擊「Internet選項」按鈕。

2、在打開的窗口中點擊頂部導航條上的「安全」按鈕。

3、在安全界面中點擊下方的「自定義級別」按鈕打開自定義級別設置界面。

4、最後在自定義級別設置界面中將「運行ActiveX控制項和插件」選擇為「啟用」,然後點擊「確定」按鈕,即可設置瀏覽器允許使用activex

怎麼啟用ActiveX控制項?

在360瀏覽器的Internet屬性界面中可以啟用activex控制項,具體操作請參照以下步驟。

1、首先在電腦上打開360瀏覽器,點擊界面右上角的菜單按鈕。

3、在Internet屬性裡面找到「安全」選項卡裡面的「自定義級別」,進行點擊。

4、接著把三個ActiveX選項啟用,點擊確定。

5、點擊確定按鈕後,會彈出一個警告窗口,直接點擊是。

6、然後返回屬性設置主界面,點擊確定。完成以上設置後,即可在360瀏覽器中啟用activex控制項。

如何添加ActiveX控制項?

解決方法如下:

1、瀏覽器禁用安裝Activex插件:解決的方法就是要把瀏覽器禁用的Activex插件設置為允許,首先打開瀏覽器,然後選擇菜單欄上工具選項;

2、選擇工具選項之後,選擇下拉菜單的Internet選項;

3、打開Internet選項之後,切換到安全選項卡,然後選擇安全選項卡下的自定義級別;

4、單擊自定義級別之後打開安全設置窗口,將重置為一欄的安全級別設置為安全級-中,然後勾選下載已簽名的Activex控制項一欄的啟用,再勾選運行Activex控制項和插件一欄的啟用,把該控制項和插件給啟用上來,然後單擊確定按鈕;

5、設置完成之後單擊確定按鈕,關閉瀏覽器,然後重新啟用瀏覽器。拓展資料:ActiveX控制項是用於互聯網的很小的程序,有時稱為插件程序。它們會允許播放動畫,或幫助執行任務,如在MicrosoftUpdate安裝安全更新,因此可以增強您的瀏覽體驗。ActiveX是Microsoft對於一系列策略性面向對象程序技術和工具的稱呼,其中主要的技術是組件對象模型(COM)。在有目錄和其它支持的網路中,COM變成了分布式COM(DCOM)。在創建包括ActiveX程序時,主要的工作就是組件,一個可以自足的在ActiveX網路(Windows,Mac,Linux)中任意運行的程序。這個組件就是ActiveX控制項。ActiveX是Microsoft為抗衡SunMicrosystems的java技術而提出的,此控制項的功能和javaapplet功能類似。Windows操作系統中以OCX結尾的文件,OCX代表"對象鏈接與嵌入控制項"(OLE),這個技術是Microsoft提出的程序技術,用於處理桌面文件的混合使用。COM的概念已經取代OLE的一部分,Microsoft也使用ActiveX控制項代表組件對象。

⑵ Java調用com組件操作word使用總結

一 准備工作

先了解一下概念 JACOB 就是 JAVA Bridge的縮寫 提供自動化的訪問的功能 也是通過JNI功能訪問windows平台下的組件或者win 系統庫的 這是一個開始於 年的開源項目的成果 有很多使用者對該項目進行了修改 做出了自己的貢獻

Jacob下載地址 ?group_id= &package_id=

我在這里下載了Jacob 和jacob 的版本兩個版本

這里下載的是目前最新的Jacob 的Release版

另外java操作word方式還有(個人認為通過jacob最好 自己可以擴展 網上除poi之外幾乎全是java 技術實現的):

( ):Apache POI Java API To Access Microsoft Format Files();對word處理不夠強處理Excel功能可以 但是全是通過java完成的 不需 要組件支持;

( ):java word 是一個在java程序中調用 MS Office Word 文檔的組件(類庫) 該組件提供了一組簡單的介面 以便java程序調用他的服務操作Word 文檔 (好象也是用的java 技術);

( )web開發語言操作word的功能最好還是用第三方的控制項 看看這個SOAOFFICE 還可以使用js 寫VBA呢

二 安裝Jacob

Jacob的安裝非常的簡單 我們解開下載的jacob_ zip 在文件夾中找到jacob dll和jacob jar兩個文件 如果是 Jacob 則是jacob x dll( 位 機和jacob x dll( 位)和 jacob jar兩個文件 Jacob dll直接放到系統的system 文件夾下就行了 連注冊都不用的(或者拷貝到jdk或者jre的bin目 錄下也行 當前測試文件所在的目錄也行 就是只要在java library path中就可以) 而jacob jar設置到classpath中去就 可以了 或者在IDE開發環境的工程中設置擴展庫也一樣的 我是這樣使用的將jacob x dll或復制 到%Tomcat %in目錄下將jacob jar復制到%Tomcot %Sharelib目錄下 我使用過程中感覺放到這里是一個最終解決 辦法 當你放哪都有問題的時候 我這樣用之後再沒有出過因為系統不一樣出現的各種各樣的問題 當然你作的是web的項目

注意使用jacob一寫要安裝word 我裝的word 如果是操作word 就不用jacob了(好像這方面的API)

對jacob dll幾種配置方法 (網上看到)

: :

把jacob dll文件 復制到 windowssystem 目錄下 (注 我用的時候這個方法不能運行)

把jacob dll放入 Javajdk _ jrein目錄下 把jacob jar放入 Javajdk _ jrelibext目錄下 可以正常運行

把jacob dll放入 glcsrc目錄下 把jacob jar放入WEB INFlib目錄下 也是可以正常運行

三 使用(以下是我改寫的一個word操作類 希望有興趣的朋友完善 記得發給我一份)

//注意java操作word關鍵是定位操作對象;

import jacob activeX ActiveXComponent;

import Dispatch;

import Variant;

/**

* jacob操作MSword類

* @author

*/

public class WordBean {

// word文檔

private Dispatch doc;

// word運行程序對象

private ActiveXComponent word;

// 所有word文檔集合

private Dispatch documents;

// 選定的范圍或插入點

private Dispatch selection;

private boolean saveOnExit = true;

public WordBean()throws Exception{

if (word == null) {

word = new ActiveXComponent( Word Application );

word setProperty( Visible new Variant(false)); //不可見打開word

word setProperty( AutomationSecurity new Variant( )); //禁用宏

}

if (documents == null)

documents = word getProperty( Documents ) toDispatch();

}

/**

* 設置退出時參數

*

* @param saveOnExit

* boolean true 退出時保存文件 false 退出時不保存文件

*/

public void setSaveOnExit(boolean saveOnExit) {

this saveOnExit = saveOnExit;

}

/**

* 創建一個新的word文檔

*

*/

public void createNewDocument() {

doc = Dispatch call(documents Add ) toDispatch();

selection = Dispatch get(word Selection ) toDispatch();

}

/**

* 打開一個已存在的文檔

*

* @param docPath

*/

public void openDocument(String docPath) {

closeDocument();

doc = Dispatch call(documents Open docPath) toDispatch();

selection = Dispatch get(word Selection ) toDispatch();

}

/**

*只讀 打開一個保護文檔

* @param docPath 文件全名

* @param pwd 密碼

*/

public void openDocumentOnlyRead(String docPath String pwd)throws Exception {

closeDocument();

// doc = Dispatch invoke(documents Open Dispatch Method

// new Object[]{docPath new Variant(false) new Variant(true) new Variant(true) pwd}

// new int[ ]) toDispatch();//打開word文件

doc = Dispatch callN(documents Open new Object[]{docPath new Variant(false)

new Variant(true) new Variant(true) pwd new Variant(false)}) toDispatch();

selection = Dispatch get(word Selection ) toDispatch();

}

public void openDocument(String docPath String pwd)throws Exception {

closeDocument();

doc = Dispatch callN(documents Open new Object[]{docPath new Variant(false)

new Variant(false) new Variant(true) pwd}) toDispatch();

selection = Dispatch get(word Selection ) toDispatch();

}

/**

* 把選定的內容或插入點向上移動

*

* @param pos

* 移動的距離

*/

public void moveUp(int pos) {

if (selection == null)

selection = Dispatch get(word Selection ) toDispatch();

for (int i = ; i < pos; i++)

Dispatch call(selection MoveUp );

}

/**

* 把選定的內容或者插入點向下移動

*

* @param pos

* 移動的距離

*/

public void moveDown(int pos) {

if (selection == null)

selection = Dispatch get(word Selection ) toDispatch();

for (int i = ; i < pos; i++)

Dispatch call(selection MoveDown );

}

/**

* 把選定的內容或者插入點向左移動

*

* @param pos

* 移動的距離

*/

public void moveLeft(int pos) {

if (selection == null)

selection = Dispatch get(word Selection ) toDispatch();

for (int i = ; i < pos; i++) {

Dispatch call(selection MoveLeft );

}

}

/**

* 把選定的內容或者插入點向右移動

*

* @param pos

* 移動的距離

*/

public void moveRight(int pos) {

if (selection == null)

selection = Dispatch get(word Selection ) toDispatch();

for (int i = ; i < pos; i++)

Dispatch call(selection MoveRight );

}

/**

* 把插入點移動到文件首位置

*

*/

public void moveStart() {

if (selection == null)

selection = Dispatch get(word Selection ) toDispatch();

Dispatch call(selection HomeKey new Variant( ));

}

/**

* 從選定內容或插入點開始查找文本

*

* @param toFindText

* 要查找的文本

* @return boolean true 查找到並選中該文本 false 未查找到文本

*/

@SuppressWarnings( static access )

public boolean find(String toFindText) {

if (toFindText == null || toFindText equals( ))

return false;

// 從selection所在位置開始查詢

Dispatch find = word call(selection Find ) toDispatch();

// 設置要查找的內容

Dispatch put(find Text toFindText);

// 向前查找

Dispatch put(find Forward True );

// 設置格式

Dispatch put(find Format True );

// 大小寫匹配

Dispatch put(find MatchCase True );

// 全字匹配

Dispatch put(find MatchWholeWord True );

// 查找並選中

return Dispatch call(find Execute ) getBoolean();

}

/**

* 把選定選定內容設定為替換文本

*

* @param toFindText

* 查找字元串

* @param newText

* 要替換的內容

* @return

*/

public boolean replaceText(String toFindText String newText) {

if (!find(toFindText))

return false;

Dispatch put(selection Text newText);

return true;

}

/**

* 全局替換文本

*

* @param toFindText

* 查找字元串

* @param newText

* 要替換的內容

*/

public void replaceAllText(String toFindText String newText) {

while (find(toFindText)) {

Dispatch put(selection Text newText);

Dispatch call(selection MoveRight );

}

}

/**

* 在當前插入點插入字元串

*

* @param newText

* 要插入的新字元串

*/

public void insertText(String newText) {

Dispatch put(selection Text newText);

}

/**

*

* @param toFindText

* 要查找的字元串

* @param imagePath

* 圖片路徑

* @return

*/

public boolean replaceImage(String toFindText String imagePath) {

if (!find(toFindText))

return false;

Dispatch call(Dispatch get(selection InLineShapes ) toDispatch()

AddPicture imagePath);

return true;

}

/**

* 全局替換圖片

*

* @param toFindText

* 查找字元串

* @param imagePath

* 圖片路徑

*/

public void replaceAllImage(String toFindText String imagePath) {

while (find(toFindText)) {

Dispatch call(Dispatch get(selection InLineShapes ) toDispatch()

AddPicture imagePath);

Dispatch call(selection MoveRight );

}

}

/**

* 在當前插入點插入圖片

*

* @param imagePath

* 圖片路徑

*/

public void insertImage(String imagePath) {

Dispatch call(Dispatch get(selection InLineShapes ) toDispatch()

AddPicture imagePath);

}

/**

* 合並單元格

*

* @param tableIndex

* @param fstCellRowIdx

* @param fstCellColIdx

* @param secCellRowIdx

* @param secCellColIdx

*/

public void mergeCell(int tableIndex int fstCellRowIdx int fstCellColIdx

int secCellRowIdx int secCellColIdx) {

// 所有表格

Dispatch tables = Dispatch get(doc Tables ) toDispatch();

// 要填充的表格

Dispatch table = Dispatch call(tables Item new Variant(tableIndex))

toDispatch();

Dispatch fstCell = Dispatch call(table Cell

new Variant(fstCellRowIdx) new Variant(fstCellColIdx))

toDispatch();

Dispatch secCell = Dispatch call(table Cell

new Variant(secCellRowIdx) new Variant(secCellColIdx))

toDispatch();

Dispatch call(fstCell Merge secCell);

}

/**

* 在指定的單元格里填寫數據

*

* @param tableIndex

* @param cellRowIdx

* @param cellColIdx

* @param txt

*/

public void putTxtToCell(int tableIndex int cellRowIdx int cellColIdx

String txt) {

// 所有表格

Dispatch tables = Dispatch get(doc Tables ) toDispatch();

// 要填充的表格

Dispatch table = Dispatch call(tables Item new Variant(tableIndex))

toDispatch();

Dispatch cell = Dispatch call(table Cell new Variant(cellRowIdx)

new Variant(cellColIdx)) toDispatch();

Dispatch call(cell Select );

Dispatch put(selection Text txt);

}

/**

* 獲得指定的單元格里數據

*

* @param tableIndex

* @param cellRowIdx

* @param cellColIdx

* @return

*/

public String getTxtFromCell(int tableIndex int cellRowIdx int cellColIdx) {

// 所有表格

Dispatch tables = Dispatch get(doc Tables ) toDispatch();

// 要填充的表格

Dispatch table = Dispatch call(tables Item new Variant(tableIndex))

toDispatch();

Dispatch cell = Dispatch call(table Cell new Variant(cellRowIdx)

new Variant(cellColIdx)) toDispatch();

Dispatch call(cell Select );

String ret = ;

ret = Dispatch get(selection Text ) toString();

ret = ret substring( ret length() ); //去掉最後的回車符;

return ret;

}

/**

* 在當前文檔拷貝剪貼板數據

* @param pos

*/

public void pasteExcelSheet(String pos) {

moveStart();

if (this find(pos)) {

Dispatch textRange = Dispatch get(selection Range ) toDispatch();

Dispatch call(textRange Paste );

}

}

/**

* 在當前文檔指定的位置拷貝表格

*

* @param pos

* 當前文檔指定的位置

* @param tableIndex

* 被拷貝的表格在word文檔中所處的位置

*/

public void Table(String pos int tableIndex) {

// 所有表格

Dispatch tables = Dispatch get(doc Tables ) toDispatch();

// 要填充的表格

Dispatch table = Dispatch call(tables Item new Variant(tableIndex))

toDispatch();

Dispatch range = Dispatch get(table Range ) toDispatch();

Dispatch call(range Copy );

if (this find(pos)) {

Dispatch textRange = Dispatch get(selection Range ) toDispatch();

Dispatch call(textRange Paste );

}

}

/**

* 在當前文檔指定的位置拷貝來自另一個文檔中的表格

*

* @param anotherDocPath

* 另一個文檔的磁碟路徑

* @param tableIndex

* 被拷貝的表格在另一格文檔中的位置

* @param pos

* 當前文檔指定的位置

*/

public void TableFromAnotherDoc(String anotherDocPath int tableIndex

String pos) {

Dispatch doc = null;

try {

doc = Dispatch call(documents Open anotherDocPath)

toDispatch();

// 所有表格

Dispatch tables = Dispatch get(doc Tables ) toDispatch();

// 要填充的表格

Dispatch table = Dispatch call(tables Item

new Variant(tableIndex)) toDispatch();

Dispatch range = Dispatch get(table Range ) toDispatch();

Dispatch call(range Copy );

if (this find(pos)) {

Dispatch textRange = Dispatch get(selection Range )

toDispatch();

Dispatch call(textRange Paste );

}

} catch (Exception e) {

e printStackTrace();

} finally {

if (doc != null) {

Dispatch call(doc Close new Variant(saveOnExit));

doc = null;

}

lishixin/Article/program/Java/hx/201311/26342

閱讀全文

與com控制項教程相關的資料

熱點內容
linuxforin文件 瀏覽:706
蘋果數據線哪個是打鐵線 瀏覽:309
jsp頁面列印表格 瀏覽:492
chsize頭文件 瀏覽:208
eclipsec工程文件怎麼打開 瀏覽:904
六軸加工中心用什麼編程軟體 瀏覽:411
興義網站建設多少錢 瀏覽:720
stl格式文件變tap 瀏覽:226
如何不沉迷網路游戲 瀏覽:891
qq收藏的文件在哪 瀏覽:594
更換支付寶郵箱賬號密碼 瀏覽:288
蘋果手機怎麼沒4g網路設置密碼 瀏覽:716
華為e1750客戶端升級軟體 瀏覽:631
47e7bre升級 瀏覽:510
各種版本的童話 瀏覽:840
一鍵隱藏程序軟體 瀏覽:781
android代碼添加動畫 瀏覽:134
word簡體繁體 瀏覽:988
qq離線傳文件用的協議 瀏覽:225
wife顯示無法連接網路怎麼辦 瀏覽:599

友情鏈接