Epplus桌面应用程序 - 无法确定域的身份

时间:2014-06-14 21:43:59

标签: vb.net excel epplus

我刚刚开始使用excel互操作代码进行epplus,并在编写excel文档时执行了该操作,但我无法读取现有文件。我搜索但每个结果都与Web应用程序有关,我正在开发一个桌面应用程序。 我的代码很简单:

    Dim File As FileInfo = New FileInfo(DosyaAd)
Using package As New ExcelPackage(File)
    Dim She As ExcelWorksheet
    She = package.Workbook.Worksheets("BF")
End using

我收到此错误:她= package.Workbook.Worksheets(" BF")

System.IO.IsolatedStorage.IsolatedStorageException was unhandled by user code
  HResult=-2146233264
  Message=Unable to determine the identity of domain.
  Source=mscorlib
  StackTrace:
       at System.IO.IsolatedStorage.IsolatedStorage._GetAccountingInfo(Evidence evidence, Type evidenceType, IsolatedStorageScope fAssmDomApp, Object& oNormalized)
       at System.IO.IsolatedStorage.IsolatedStorage.GetAccountingInfo(Evidence evidence, Type evidenceType, IsolatedStorageScope fAssmDomApp, String& typeName, String& instanceName)
       at System.IO.IsolatedStorage.IsolatedStorage._InitStore(IsolatedStorageScope scope, Evidence domainEv, Type domainEvidenceType, Evidence assemEv, Type assemblyEvidenceType, Evidence appEv, Type appEvidenceType)
       at System.IO.IsolatedStorage.IsolatedStorage.InitStore(IsolatedStorageScope scope, Type domainEvidenceType, Type assemblyEvidenceType)
       at System.IO.IsolatedStorage.IsolatedStorageFile.GetStore(IsolatedStorageScope scope, Type domainEvidenceType, Type assemblyEvidenceType)
       at MS.Internal.IO.Packaging.PackagingUtilities.ReliableIsolatedStorageFileFolder.GetCurrentStore()
       at MS.Internal.IO.Packaging.PackagingUtilities.ReliableIsolatedStorageFileFolder..ctor()
       at MS.Internal.IO.Packaging.PackagingUtilities.GetDefaultIsolatedStorageFile()
       at MS.Internal.IO.Packaging.PackagingUtilities.CreateUserScopedIsolatedStorageFileStreamWithRandomName(Int32 retryCount, String& fileName)
       at MS.Internal.IO.Packaging.SparseMemoryStream.SwitchModeIfNecessary()
       at MS.Internal.IO.Packaging.SparseMemoryStream.Write(Byte[] buffer, Int32 offset, Int32 count)
       at MS.Internal.IO.Packaging.DeflateEmulationTransform.Decompress(Stream source, Stream sink)
       at MS.Internal.IO.Packaging.CompressEmulationStream..ctor(Stream baseStream, Stream tempStream, Int64 position, IDeflateTransform transformer)
       at MS.Internal.IO.Packaging.CompressStream.ChangeMode(Mode newMode)
       at MS.Internal.IO.Packaging.CompressStream.Seek(Int64 offset, SeekOrigin origin)
       at MS.Internal.IO.Zip.ProgressiveCrcCalculatingStream.Seek(Int64 offset, SeekOrigin origin)
       at MS.Internal.IO.Zip.ZipIOModeEnforcingStream.Read(Byte[] buffer, Int32 offset, Int32 count)
       at System.IO.StreamReader.ReadBuffer(Char[] userBuffer, Int32 userOffset, Int32 desiredChars, Boolean& readToUserBuffer)
       at System.IO.StreamReader.Read(Char[] buffer, Int32 index, Int32 count)
       at System.IO.StreamReader.ReadBlock(Char[] buffer, Int32 index, Int32 count)
       at OfficeOpenXml.ExcelWorksheet.GetWorkSheetXml(Stream stream, Int64 start, Int64 end, Encoding& encoding)
       at OfficeOpenXml.ExcelWorksheet.CreateXml()
       at OfficeOpenXml.ExcelWorksheet..ctor(XmlNamespaceManager ns, ExcelPackage excelPackage, String relID, Uri uriWorksheet, String sheetName, Int32 sheetID, Int32 positionID, eWorkSheetHidden hide)
       at OfficeOpenXml.ExcelWorksheets..ctor(ExcelPackage pck, XmlNamespaceManager nsm, XmlNode topNode)
       at OfficeOpenXml.ExcelWorkbook.get_Worksheets()
       at OfficeOpenXml.ExcelWorkbook.GetDefinedNames()
       at OfficeOpenXml.ExcelPackage.get_Workbook()
.........

1 个答案:

答案 0 :(得分:1)

如果此工作簿是在Microsoft Office中生成的,或是通过互操作生成的,则工作簿可能包含EPPLus库中未提供的功能,例如行和主题,以及列出的其他功能here

我自己没有经历过,但我从其他人那里听说,当工作表包含大量内容时会出现问题。