我需要在运行时使用vb.net创建一个word文档。如何在不使用microsoft.office.interop
的情况下执行此操作?我之前创建了excel文件,但不知道如何使用它。这是我用来创建Excel文件的内容:
Sub export_to_excel(recordCount As Integer, DataArray(,) As Object, fileName_Location As String)
Dim oExcel As Object
Dim oBook As Object
Dim oSheet As Object
''Start a new workbook in Excel.
oExcel = CreateObject("Excel.Application")
oBook = oExcel.Workbooks.Add
''Add headers to the worksheet on row 1.
oSheet = oBook.Worksheets(1)
' For i = 0 To headers.Count - 1
oSheet.Range("A1").Value = "AAA"
oSheet.Range("B1").Value = "BBB"
oSheet.Range("C1").Value = "CCC"
oSheet.Range("A1:C1").Font.Bold = True
'Next
''Transfer the array to the worksheet starting at cell A2.
oSheet.Range("A2").Resize(recordCount, 3).Value = DataArray
''Save the Workbook and quit Excel.
oBook.SaveAs(fileName_Location)
oSheet = Nothing
oBook = Nothing
oExcel.Quit()
oExcel = Nothing
GC.Collect()
End Sub
如何使用此代码之类的东西创建word文件?