我正在尝试编辑已打开的Excel文件(由共享网络中的其他用户编辑),以便对其进行一些更改并将其保存回来。但是当我尝试打开文件时,我收到以下错误:
Message=The process cannot access the file
'Y:\COMMON\SharedFolders\Export.xlsx', because it is being used by another process.
Source=mscorlib
StackTrace:
à System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
à System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
à System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
à System.IO.File.InternalReadAllBytes(String path, Boolean checkHost)
à System.IO.File.ReadAllBytes(String path)
à OfficeOpenXml.ExcelPackage.ReadFile()
à OfficeOpenXml.ExcelPackage.ConstructNewFile(Stream stream, String password)
à OfficeOpenXml.ExcelPackage..ctor(FileInfo newFile)
顺便说一下,我正在使用EPPLUS库。
答案 0 :(得分:1)
你不能。话虽这么说,你可以看一些"源安全"解决方案(如svn,sharepoint或google docs)。你也可以实施一些“穷人”#34;来源安全自己 - 即小型网络应用程序,将作为文件系统的代理和&将允许您上传文件,列表文件夹,下载文件。
其他选项是在没有人访问该文件时延迟更新到日期。
答案 1 :(得分:0)
Google允许同时进行多次编辑...如果可能的话,您应该尝试将该文件移到那里。