当然,必须引入office 的dll ...
1 : 定义如下局部或全局变量
Microsoft.Office.Interop.Excel.WorkbookClass w = null;
Microsoft.Office.Interop.Excel.Workbook wk = null;
Microsoft.Office.Interop.PowerPoint.Presentation pt = null;
2 :
this.axFramerControl1.Open("F://演示文稿.pptx");
this.axFramerControl1.Caption = "aaa";
this.axFramerControl1.set_EnableFileCommand(DSOFramer.dsoFileCommandType.dsoFileSave, false); //让保存,另存为按钮不能用,用户可以根据需要设置其他的按钮
this.axFramerControl1.set_EnableFileCommand(DSOFramer.dsoFileCommandType.dsoFileSaveAs, false);
this.axFramerControl1.Toolbars = false; //是否显示工具条,菜单条
this.axFramerControl1.Titlebar = false;
//以下可以取得word,excel,ppt的对象
//w = (Microsoft.Office.Interop.Word.DocumentClass)this.axFramerControl1.ActiveDocument;
//wk = (Microsoft.Office.Interop.Excel.Workbook)this.axFramerControl1.ActiveDocument;
pt = (Microsoft.Office.Interop.PowerPoint.Presentation)this.axFramerControl1.ActiveDocument;
//判断打开的文件是否做了修改
//如果以下的返回值为false,则没修改,相反则用户修改了office
w.saved
wk.saved
//返回值为0或-1
pt.saved(Microsoft.Office.Core.MsoTriState.msoFalse)
//Microsoft.Office.Core.MsoTriState.msoFalse为枚举类型 返回0 ,表示跟该枚举值一样,如上面,也就是为false, -1,表示不一样