简体   繁体   中英

how to prevent C# from forcing excel file to open as read only?

当我通过 System.Diagnostics.Process.Start 或 Microsoft.Office.Interop.Excel 打开 Excel(.xlsm) 时,文件被迫以只读模式启动,如何防止这种情况并以正常方式启动?

I think it isn't the problem System.Diagnostics.Process.Start . Because Your file is read-only already.

Try to force attribute of the file before opening it.

The is a lot of examples of codes to do that

IE

File.SetAttributes(fileExcelPath, attr & ~FileAttributes.ReadOnly);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM