感谢您的阅读,我的疑问如下,我试图从 xls 文件中获取数据,但必须在本地完成,无需上传文件,我已经完成了与 txts 文件类似的操作,并且效果很好:
Function Send(ByVal file As HttpPostedFileBase) As ActionResult
Dim line As String
Dim textreader As System.IO.StreamReader = New StreamReader(file.InputStream)
While Not textreader.EndOfStream
line = textreader.ReadLine()
ViewBag.line = line
End While
Return View("Index")
End Function
但我不能对excel文件做同样的事情,首先,因为我不能使用streamreader,所以在使用这段代码时我不知道如何指定我的xls文件的目录
Dim oApp As Excel.Application = New Excel.Application
Dim oWB As Excel.Workbook
Dim oSheet As Excel.Worksheet
oWB = oApp.Workbooks.Open(file.inputstream) <-- HERE IS WHERE I GET (AN OBVIOUS) ERROR
有人知道如何在本地打开文件吗?谢谢阅读 :)