.NET 中调用dsoFramer打开office,如何判断office文档是否修改了??

当然,必须引入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,表示不一样

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值