private void axWbDoCView_NavigateComplete2(object sender, AxSHDocVw.DWebBrowserEvents2_NavigateComplete2Event e) { if (axWbDoCView2.LocationName != "about:blank") { try { Object o = e.pDisp; oDocument = o.GetType().InvokeMember("Document", BindingFlags.GetProperty, null, o, null); Object oApplication = o.GetType().InvokeMember("Application", BindingFlags.GetProperty, null, oDocument, null); Object oName = o.GetType().InvokeMember("Name", BindingFlags.GetProperty, null, oApplication, null); Object refmissing = System.Reflection.Missing.Value; axWbDoCView2.ExecWB(SHDocVw.OLECMDID.OLECMDID_HIDETOOLBARS, SHDocVw.OLECMDEXECOPT.OLECMDEXECOPT_DONTPROMPTUSER, ref refmissing, ref refmissing); wordApp2 = (Word.Application)oApplication; Word.Document doc = oDocument as Word.Document; wordApp2.ActiveDocument.Background.Visible = Microsoft.Office.Core.MsoTriState.msoFalse; wordApp2.ActiveWindow.DisplayRulers = false; //wordApp2.ActiveWindow.View.ShowBookmarks = true; //书签显示 LiuQi 2012-05-22 //wordApp2.ActiveDocument.ActiveWindow.DisplayRulers = true;//标尺显示 LiuQi 2012-09-03 //wordApp2.ActiveDocument.ActiveWindow.DisplayVerticalRuler = true;//标尺显示 LiuQi 2012-09-03 wordApp2.ActiveWindow.View.ShowRevisionsAndComments = false; //参照时不显示痕迹 LiuQi 2012-07-03 wordApp2.ActiveWindow.View.RevisionsView = Word.WdRevisionsView.wdRevisionsViewFinal; //参照时不显示痕迹 LiuQi 2012-07-03 // axWbDoCView2.Capture = false; } catch (Exception ex) { Globals.logAdapter.Record("EX925511256759", ex.Message + ">>" + ex.ToString(), true); } } }
private void axWebBrowser1_NavigateComplete2(object sender, AxSHDocVw.DWebBrowserEvents2_NavigateComplete2Event e) { Object o = e.pDisp; Object oDocument = o.GetType().InvokeMember("Document", System.Reflection.BindingFlags.GetProperty, null, o, null); Object oApplication = o.GetType().InvokeMember("Application", System.Reflection.BindingFlags.GetProperty, null, oDocument, null); excelApp = (Excel.Application)oApplication; }
private void webDescription_NavigateComplete2(object sender, AxSHDocVw.DWebBrowserEvents2_NavigateComplete2Event e) { string sampleName = ((AxSHDocVw.AxWebBrowser)sender).LocationName; if (sampleName != "sample") { tvSampleList.SelectedNode = NodeByName(tvSampleList.Nodes[0], sampleName); } }
private void dummyBrowser_NavigateComplete2(object sender, AxSHDocVw.DWebBrowserEvents2_NavigateComplete2Event e) { if (!doubleCountCheck) { BrowserShow.browserOpen((string)e.uRL); // ここでブラウザオープン抑制 doubleCountCheck = true; } else { doubleCountCheck = false; } }
private void StoreIEDocObject(object sender, AxSHDocVw.DWebBrowserEvents2_NavigateComplete2Event e) { ////////// // Keep a ref to the doc object ////////// this._documentObject = (IPersistStreamInit)this._webBrowser.Document; ////////// // Tell the user to load xml ////////// //((mshtml.IHTMLDocument2)this._documentObject).body.innerHTML // = "<Font face='arial' color='red' size=4>Please open an xml document</Font>"; }
public void axWebBrowser1_NavigateComplete2(object sender, AxSHDocVw.DWebBrowserEvents2_NavigateComplete2Event e) { //Note: You can use the reference to the document object to // automate the document server. Object o = e.pDisp; oDocument = o.GetType().InvokeMember("Document", BindingFlags.GetProperty, null, o, null); Object oApplication = o.GetType().InvokeMember("Application", BindingFlags.GetProperty, null, oDocument, null); Object oName = o.GetType().InvokeMember("Name", BindingFlags.GetProperty, null, oApplication, null); MessageBox.Show("File opened by: " + oName.ToString()); }
private void axWebBrowser2_NavigateComplete2(object sender, AxSHDocVw.DWebBrowserEvents2_NavigateComplete2Event e) { /// return; object o = e.pDisp; oWebBrowser = e.pDisp; try { Object oDocument = o.GetType().InvokeMember("Document", BindingFlags.GetProperty, null, o, null); Object oApplication = o.GetType().InvokeMember("Application", BindingFlags.GetProperty, null, oDocument, null); Excel.Application eApp = (Excel.Application)oApplication; eApp.UserControl = true; //Inputexcel(eApp); //textexcel(); #region 方法2 //Object refmissing = System.Reflection.Missing.Value; //object[] args = new object[4]; //args[0] = SHDocVw.OLECMDID.OLECMDID_HIDETOOLBARS; //args[1] = SHDocVw.OLECMDEXECOPT.OLECMDEXECOPT_DONTPROMPTUSER; //args[2] = refmissing; //args[3] = refmissing; //object axWebBrowser = this.webBrowser1.ActiveXInstance; //axWebBrowser.GetType().InvokeMember("ExecWB", // BindingFlags.InvokeMethod, null, axWebBrowser, args); //object Application = axWebBrowser.GetType().InvokeMember("Document", // BindingFlags.GetProperty, null, axWebBrowser, null); //Excel.Workbook wbb = (Excel.Workbook)oApplication; //Excel.ApplicationClass excel = wbb.Application as Excel.ApplicationClass; //Excel.Workbook wb = excel.Workbooks[1]; //Excel.Worksheet ws = wb.Worksheets[1] as Excel.Worksheet; //ws.Cells.Font.Name = "Verdana"; //ws.Cells.Font.Size = 14; //ws.Cells.Font.Bold = true; //Excel.Range range = ws.Cells; //Excel.Range oCell = range[10, 10] as Excel.Range; //oCell.Value2 = "你好"; #endregion #region inster tx //object objBooks = eApp.GetType().InvokeMember("Workbooks", BindingFlags.GetProperty, null, eApp, null); ////添加一个新的Workbook //object objBook = objBooks.GetType().InvokeMember("Add", BindingFlags.InvokeMethod, null, objBooks, null); ////获取Sheet集 //object objSheets = objBook.GetType().InvokeMember("Worksheets", BindingFlags.GetProperty, null, objBook, null); ////获取第一个Sheet对象 //object[] Parameters = new Object[1] { 1 }; //object objSheet = objSheets.GetType().InvokeMember("Item", BindingFlags.GetProperty, null, objSheets, Parameters); //Parameters = new Object[2] { 1, 1 + 1 }; //object objCells = objSheet.GetType().InvokeMember("Cells", BindingFlags.GetProperty, null, objSheet, Parameters); ////向指定单元格填写内容值 //Parameters = new Object[1] { "name" }; //objCells.GetType().InvokeMember("Value", BindingFlags.SetProperty, null, objCells, Parameters); #endregion #region 一、首先简要回顾一下如何操作Excel表 Workbooks workbooks = eApp.Workbooks; Excel.ApplicationClass excel = workbooks.Application as Excel.ApplicationClass; Microsoft.Office.Interop.Excel.Worksheet WS = (Microsoft.Office.Interop.Excel.Worksheet)workbooks.get_Item(1); Excel.Workbook wb = excel.Workbooks[1]; //_Workbook workbook = workbooks.Add(XlWBATemplate.xlWBATWorksheet); int c = workbooks.Count; _Workbook workbook = workbooks.Add(ZFCEPath); Sheets sheets = workbook.Worksheets; _Worksheet worksheet = (_Worksheet)sheets.get_Item(1); Range range1 = worksheet.get_Range("A1", Missing.Value); const int nCells = 2345; range1.Value2 = nCells; #endregion ExcelExit(); } catch (Exception ex) { ExcelExit(); throw; } }
private void axWebBrowser_NavigateComplete2(object sender, AxSHDocVw.DWebBrowserEvents2_NavigateComplete2Event e) { NavigateComplete2Handler(); }
private void WbDocView_NavigateComplete2(object sender, AxSHDocVw.DWebBrowserEvents2_NavigateComplete2Event e) { Microsoft.Office.Interop.Word.Application wordApp = e.pDisp.GetType().InvokeMember("Application", System.Reflection.BindingFlags.GetProperty, null, e.pDisp, null) as Microsoft.Office.Interop.Word.Application; Microsoft.Office.Interop.Word.Document doc = e.pDisp.GetType().InvokeMember("Document", System.Reflection.BindingFlags.GetProperty, null, e.pDisp, null) as Microsoft.Office.Interop.Word.Document; }
private void AxWebBrowser1_NavigateComplete2(object sender, AxSHDocVw.DWebBrowserEvents2_NavigateComplete2Event e) { tsslStatus.Text = "网址已找到.正在打开网页" + e.uRL.ToString(); }
private void axWebBrowser1_NavigateComplete2(object sender, AxSHDocVw.DWebBrowserEvents2_NavigateComplete2Event e) { toolAddress.Text = e.uRL.ToString(); }
private void WebBrowser_NavigateComplete2(object sender, AxSHDocVw.DWebBrowserEvents2_NavigateComplete2Event e) { statusBar.Text = URL.Text + " loaded."; }