自己做个菜单或者按钮导出
Dim dt As Table = CurrentTable
Dim dlg As new SaveFileDialog
dlg.Filter = "excel文件|*.xls"
dlg.filename = dt.name
If dlg.ShowDialog = DialogResult.OK Then
Dim Book As New XLS.Book '定义一个Excel工作簿
Dim Sheet As XLS.Sheet = Book.Sheets(0) '引用工作簿的第一个工作表
sheet.name = dt.name
For c As Integer = 0 To dt.Cols.Count -1 '添加列标题
Sheet(0, c).Value = dt.Cols(c).Name
Next
For r As Integer = 0 To dt.Rows.Count - 1 '填入数据
For c As Integer = 0 To dt.Cols.Count -1
If dt.cols(c).IsBoolean Then
Dim ary() As String = dt.grid.cols(dt.cols(c).name).format.split(";")
If ary.length = 2 Then
If dt.rows(r)(c) = True Then
Sheet(r +1, c).Value = ary(0)
Else
Sheet(r +1, c).Value = ary(1)
End If
Else
Sheet(r +1, c).Value = dt.rows(r)(c)
End If
Else
Sheet(r +1, c).Value = dt.rows(r)(c)
End If
Next
Next
'打开工作簿
Book.Save(dlg.FileName)
Dim Proc As New Process
Proc.File = dlg.FileName
Proc.Start()
End If