从流程开始以只读方式打开excel文件 [英] open excel file as readonly from process start

查看:107
本文介绍了从流程开始以只读方式打开excel文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须使用Process.Start方法打开一个excel应用程序.当前代码如下.

I have to open an excel application using the Process.Start method. Current code is below.

startInfo.FileName = "EXCEL.EXE";            
startInfo.Arguments = "\"C:\\Shared\\Some Directory\\File Name 2016.xlsm";
var res = Process.Start(startInfo);

我只需要对该文件具有读取权限.但是,如果另一个用户打开了文件,则会弹出一个窗口提示,询问我是否要以只读模式打开文件.无论如何,是否有使用Process.Start方法指定该文件仅需要以只读方式打开?

I only need read access to the file. However if another user has the file open a window prompt pops up asking if I would like to open the file in read only mode. Is there anyway using the Process.Start method to specify that the file only needs to be opened as read only?

我已经阅读过有关动词的使用,但是认为我缺少一些东西.

I have read about using verbs however think I'm missing something.

推荐答案

只需使用/r键:

startInfo.FileName = "EXCEL.EXE";            
startInfo.Arguments = "/r \"C:\\Shared\\Some Directory\\File Name 2016.xlsm\"";
var res = Process.Start(startInfo);

这篇关于从流程开始以只读方式打开excel文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆