久久国产成人av_抖音国产毛片_a片网站免费观看_A片无码播放手机在线观看,色五月在线观看,亚洲精品m在线观看,女人自慰的免费网址,悠悠在线观看精品视频,一级日本片免费的,亚洲精品久,国产精品成人久久久久久久

分享

webBrowser加載Word,,以及保存

 新新一族2080 2018-02-13

------------------------------------------------------打開文檔-------------------------------------------------------------------                 

 

 

                        string strmubanPath = @'d:/muban.doc';//得到模板位置
                       
                        string strkongbaiPath = strPath + @'/kongbai.doc';//得到要編輯的文檔位置
                        
                        Object refmissing = System.Reflection.Missing.Value;
                        object oDocument = null;

 

                        webBrowser2.Navigate(strmubanPath);//, ref   refmissing, ref   refmissing, ref   refmissing, ref   refmissing);
                        webBrowser1.Navigate(strkongbaiPath);

 

-------------------------------------------------------保存文檔---------------------------------------------------------------------------

需要添加引用 Interop.Word.dll

 

            object axWebBrowser; //定義web瀏覽器
            object oApplication;//

 

            axWebBrowser = this.webBrowser1.ActiveXInstance;
            oApplication = axWebBrowser.GetType().InvokeMember('Document', System.Reflection.BindingFlags.GetProperty, null, axWebBrowser, null);//通過(guò)反射,,獲得word應(yīng)用程序?qū)嵗?br>            Word.Document doc = (Word.Document)oApplication;

 

            Word.ApplicationClass word1;
            word1 = doc.Application as Word.ApplicationClass;
            word1.ActiveDocument.Save();

 

PS:如果webBrowser1不在當(dāng)前選中的窗體中,,或者不在當(dāng)前選項(xiàng)卡中,好像保存無(wú)效,。

----------------------------------------------------------清空文檔---------------------------------------------------------------

 

             //該方法好像并沒(méi)有真正的釋放Word進(jìn)程,,文件依然被占用,目前還沒(méi)有找到好的解決辦法,。      
            webBrowser1.Navigate('about:blank');
            webBrowser2.Navigate('about:blank');

 

----------------------------------------------------------在office 2007中打開---------------------------------------------------------------

    //如果裝的是office 2007的話,,用webBrowser打開Word文件時(shí),不會(huì)在webBrowser中打開,,而是直接打開了Word程序,,解決辦法是修改注冊(cè)表選項(xiàng),將以下內(nèi)容保存到記事本中,,存為reg格式的文件運(yùn)行即可

 

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE/SOFTWARE/Classes/Word.Document.8]'BrowserFlags'=dword:80000024

 

[HKEY_LOCAL_MACHINE/SOFTWARE/Classes/Word.RTF.8]'BrowserFlags'=dword:80000024

 

[HKEY_LOCAL_MACHINE/SOFTWARE/Classes/Word.Document.12]'BrowserFlags'=dword:80000024

 

[HKEY_LOCAL_MACHINE/SOFTWARE/Classes/Word.DocumentMacroEnabled.12]'BrowserFlags'=dword:80000024

 

[HKEY_LOCAL_MACHINE/SOFTWARE/Classes/Excel.Sheet.8]'BrowserFlags'=dword:80000A00

 

[HKEY_LOCAL_MACHINE/SOFTWARE/Classes/Excel.Sheet.12]'BrowserFlags'=dword:80000A00

 

[HKEY_LOCAL_MACHINE/SOFTWARE/Classes/Excel.SheetMacroEnabled.12]'BrowserFlags'=dword:80000A00

 

[HKEY_LOCAL_MACHINE/SOFTWARE/Classes/Excel.SheetBinaryMacroEnabled.12]'BrowserFlags'=dword:80000A00

 

[HKEY_LOCAL_MACHINE/SOFTWARE/Classes/PowerPoint.Show.8]'BrowserFlags'=dword:800000A0

 

[HKEY_LOCAL_MACHINE/SOFTWARE/Classes/PowerPoint.Show.12]'BrowserFlags'=dword:800000A0

 

[HKEY_LOCAL_MACHINE/SOFTWARE/Classes/PowerPoint.ShowMacroEnabled.12]'BrowserFlags'=dword:800000A0

 

[HKEY_LOCAL_MACHINE/SOFTWARE/Classes/PowerPoint.SlideShow.8]'BrowserFlags'=dword:800000A0

 

[HKEY_LOCAL_MACHINE/SOFTWARE/Classes/PowerPoint.SlideShow.12]'BrowserFlags'=dword:800000A0

 

[HKEY_LOCAL_MACHINE/SOFTWARE/Classes/PowerPoint.SlideShowMacroEnabled.12]'BrowserFlags'=dword:800000A0

    本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,,所有內(nèi)容均由用戶發(fā)布,,不代表本站觀點(diǎn),。請(qǐng)注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購(gòu)買等信息,,謹(jǐn)防詐騙,。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊一鍵舉報(bào),。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評(píng)論

    發(fā)表

    請(qǐng)遵守用戶 評(píng)論公約

    類似文章 更多