private void axFramerControl1_OnDocumentOpened(object sender, AxDSOFramer._DFramerCtlEvents_OnDocumentOpenedEvent e) { Document document = e.document as Document; document.ActiveWindow.DisplayRulers = false; document.ActiveWindow.DisplayRightRuler = false; document.ActiveWindow.DisplayVerticalRuler = false; document.ActiveWindow.DisplayScreenTips = false; document.Application.DisplayAlerts = WdAlertLevel.wdAlertsNone; document.ActiveWindow.View.ShowBookmarks = true; document.ActiveWindow.ActivePane.DisplayRulers = false; document.ActiveWindow.View.DisplaySmartTags = false; //disable word commandbars try { //test debug.write /*Debug.Listeners.Add(new TextWriterTraceListener(Console.Out)); * Debug.AutoFlush = true; * Debug.Indent(); * Debug.WriteLine(Name.ToString()); * Debug.Unindent();*/ Document wordDoc = document as Document; //Disable Text popup menu(while right click on the word client area). //Index is 78, in word 2003. //Name=Text Index=78 Type=msoBarTypePopup //The reason disable this first is when word started, we right click word //client area at once, the text popup menu perhaps still enable at this moment. wordDoc.CommandBars[78].Enabled = false; wordDoc.CommandBars[78].Visible = false; //this course cost a few time, disable all tool bars, menu bars. for (int i = 1; i <= wordDoc.CommandBars.Count; i++) { wordDoc.CommandBars[i].Enabled = false; wordDoc.CommandBars[i].Visible = false; } } catch (Exception) { } }
void axFramerControl1_OnDocumentOpened(object sender, AxDSOFramer._DFramerCtlEvents_OnDocumentOpenedEvent e) { fileName = e.file; }