我正在尝试使用 vb.net 将 .csv 转换为 .xls,但我无法找到有效的方法。我知道如何将 .xls 转换为 .csv 是否与此类似?这是我到目前为止的代码,这是我收到的错误:
“外部表不是预期的格式。”
Public Sub ConvertCSV(ByVal lvFileName As String, ByVal lvFileNameNoExt As String)
Dim DA As New OleDb.OleDbDataAdapter
Dim DS As New DataSet
Dim objStreamWriter As StreamWriter
Dim objconn As New System.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\GD Test\Test.csv;Extended Properties=Excel 8.0;")
ObjConn.Open()
Dim objcmd As New System.Data.OleDb.OleDbCommand("Select * from [AutoBatchPrintBypass.RPT$]", objconn)
objcmd.CommandType = CommandType.Text
objStreamWriter = New StreamWriter(gvDipDir & gvClientCode & ".XLS")
objconn.Close()
End Sub