我想通过asp.net(vb)读取Word、Excel文件的元数据(如作者、关键字等)。我怎样才能做到这一点 ?
有没有样品,参考网站?
我在网上找到了以下代码,但它返回第二条语句的错误(“ Dim excelbook As New Microsoft.Office.Interop.Excel.Workbook ”)
Public Sub ReadExcel(ExcelFileName As String)
Dim Wapp As New Microsoft.Office.Interop.Excel.Application
Dim excelbook As New Microsoft.Office.Interop.Excel.Workbook
If Wapp Is Nothing Then
Wapp = New Microsoft.Office.Interop.Excel.Application
End If
If excelbook Is Nothing Then
excelbook = New Microsoft.Office.Interop.Excel.Workbook
Else
excelbook.Close()
End If
excelbook = Wapp.Workbooks.Open(ExcelFileName)
Dim _BuiltInProperties As Object = excelbook.BuiltinDocumentProperties
If Not _BuiltInProperties Is Nothing Then
excel_keyword = _BuiltInProperties("Keywords").Value
End If
If Not excelbook Is Nothing Then
excelbook.Close()
End If
If Not Wapp Is Nothing Then
Wapp.Quit()
End If
End Sub