.Net - 打开excel工作簿,它打开以前的版本,缓存

时间:2013-02-08 10:54:27

标签: .net vb.net excel

如果我在我的网络应用程序文件夹中打开一个excel工作簿,当我读完单元格时,它会给我一个我正在处理的excel电子表格中的值。这可能是一些缓存问题吗?

    Dim xlApp As Excel.Application = Nothing
    Dim xlWorkBook As Excel.Workbook = Nothing
    Dim xlWorkSheet As Excel.Worksheet = Nothing
    Dim misValue As Object = System.Reflection.Missing.Value
    Dim strCell2 As String = ""
    xlApp = New Excel.ApplicationClass
    xlWorkBook = xlApp.Workbooks.Open("book1.xlsx")
    xlWorkSheet = xlWorkBook.Worksheets("sheet1")
    Dim strOutput As String = ""
    Dim cell As Excel.Range
    Dim i As Integer = 1
    For Each cell In xlWorkSheet.Range("B:B")
        strCell2 = xlWorkSheet.Cells(i, 2).value
        If strCell2 <> Nothing Then
            strCell2 = xlWorkSheet.Cells(i, 2).value ' value here is of a different workbook
            i = i + 1
        Else
            Exit For
        End If
    Next

我可以在“解决方案资源管理器”中看到excel电子表格,当我点击它时会打开正确的工作簿。 Confused.com。

任何想法,在打开内容之前我是否需要清除内存或缓存?

0 个答案:

没有答案