2014-06-14 18 views
1

我剛剛開始將我的Excel Interop代碼啓動到epplus中,並在savng excel文檔時做了它,但無法讀取現有文件。我搜索,但每個結果都與Web應用程序有關,我正在開發一個桌面應用程序。 我的代碼是如此簡單:Epplus桌面應用程序 - 無法確定域的標識

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() 
......... 
+0

你是否設法解決了這個問題?我有一個類似的我不能出去,任何幫助將不勝感激。 – ccalboni

回答

1

如果在Microsoft Office或通過製作了該工作簿互操作,工作簿可能包含EPPLus庫無法提供的功能,例如行和主題,以及列出的其他功能here

我自己並沒有經歷過,但我從其他人那裏聽說,當工作表包含大量內容時會出現問題。

+0

你好,工作手冊只包含文本和數字。你能建議其他一些簡單易用的圖書館嗎? – Rusel

+0

還有另一個我用過的圖書館[NPOI](https://npoi.codeplex.com)。 – Lucas

+0

另外,您是否嘗試過使用EPPlus從任何不同的Excel文件中讀取任何文件?這可能是文件本身的問題。 – Lucas