当我尝试阅读我的Excel时如何插入密码? vb.net

时间:2016-05-05 07:41:32

标签: vb.net

我尝试读取Excel,但是有密码(我知道密码)如何插入密码来读取excel。我的代码是这样的:

 Dim FileName As String = Path.GetFileName(FileUpload1.PostedFile.FileName)
            Dim Extension As String = Path.GetExtension(FileUpload1.PostedFile.FileName)
            'Dim FolderPath As String = ConfigurationManager.AppSettings("Upload")

            Dim FilePath As String = Server.MapPath("~") & "\Upload\" & FileName
            FileUpload1.SaveAs(FilePath)

            Dim existingFile = New FileInfo(FilePath)
            Dim pack As ExcelPackage = New ExcelPackage(existingFile)
            Dim workBook As ExcelWorkbook = pack.Workbook

            If workBook.Worksheets.Count > 0 Then ...

行上显示错误:

  

Dim pack As ExcelPackage = New ExcelPackage(existingFile)

错误:

  

无法打开包裹。包是一个OLE复合文档。如果这   是加密包,请提供密码

0 个答案:

没有答案