简体   繁体   English

如何使用 C# 中的 interop.excel 从 excel 文件中删除只读模式

[英]How to remove read-only mode from excel file using interop.excel in C#

I have a doubt about the excel sheet.我对 excel 表有疑问。 When I apply the formula column.当我应用公式列时。 If my code throws any exceptions/errors then my excel file is set as a read-only mode.如果我的代码抛出任何异常/错误,那么我的 excel 文件将设置为只读模式。 So, here I want my file remains in read-write mode.所以,在这里我希望我的文件保持读写模式。 Please, help me to solve this problem.请帮我解决这个问题。

There are multiple reasons why the file may only be available in read-only mode:该文件可能仅在只读模式下可用的原因有多种:

  1. Someone other process is using the file.其他进程正在使用该文件。 Perhaps one of your earlier Excel instances you left opened after a crash / exception?也许您在崩溃/异常后打开的早期 Excel 实例之一? Utilize Task Manager to kill ghost instances of Excel or other apps that may be using the file.利用任务管理器杀死 Excel 或其他可能正在使用该文件的应用程序的幽灵实例。

  2. The file is opened in read only mode.该文件以只读模式打开。 Here's some info on how to open it in editable mode.以下是有关如何以可编辑模式打开它的一些信息。 https://www.stellarinfo.com/article/excel-cannot-open-read-only-document.php https://www.stellarinfo.com/article/excel-cannot-open-read-only-document.php

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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