Dim dt As DataTable = cmd.ExecuteReader()
Dim Book As New XLS.Book
Dim fl As String = "c:\reports\test.xlsx"
Book.Save(fl)
'重新打开工作簿
Book = New XLS.Book(fl)
Dim Sheet As XLS.Sheet = Book.Sheets(0)
Dim Style As Xls.Style = Book.NewStyle
Style.BackColor = Color.Red
For c As Integer = 0 To nms.Count - 1
Sheet(0, c).Value = nms(c)
Next
For r As Integer = 0 To dt.DataRows.Count - 1
For c As Integer = 0 To nms.Count - 1
Sheet(r + 1, c).Value = dt.DataRows(r)(nms(c))
Next
Next
Book.Save(fl)
Dim Proc As New Process
Proc.File = fl
Proc.Start()