当我打开.xls Excel vb.net时,为什么要给我“存档文件不能大小为0”?

时间:2016-03-23 13:21:38

标签: vb.net

Dim FileName As String = Path.GetFileName("C:\Users\vladut.moraru\Desktop\TCO Orders\BOMTemplate.xls")
Dim Extension As String = Path.GetExtension(FileName)
'Dim FolderPath As String = ConfigurationManager.AppSettings("Upload")

Dim FilePath As String = Server.MapPath("~") & "\TempUploads\" & 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 currentWorksheet As ExcelWorksheet = workBook.Worksheets(2)

    currentWorksheet.Cells(5, 7).Value = Quantity

    DDL_ShippingMode.Text = Nothing
    DDL_Transporter.Text = Nothing
End If

我想在excel文件中写,但是当我尝试上传时,我会在网上给出错误:

  

Dim pack As ExcelPackage = New ExcelPackage(existingFile)

我想在表2中写一些文字并保存,但是当我尝试给我那个错误时。我怎么能这样做?

0 个答案:

没有答案