Public Class ExportToExcel
    Dim printtype As Integer
   
    Private Sub ExportToExcel_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Me.客户TableAdapter.Fill(Me.NorthwindDataSet.客户)
        D1.DataSource = Me.NorthwindDataSet.客户



        '表格字段名特殊格式设置打印测试
        D1.Columns(1).HeaderCell.Style.ForeColor = Color.Red
        Dim mystyle As FontStyle
        mystyle = FontStyle.Bold + FontStyle.Strikeout + FontStyle.Underline + FontStyle.Italic
        D1.Columns(1).HeaderCell.Style.BackColor = Color.Blue
        D1.Columns(1).HeaderCell.Style.Font = New Font("黑体", 13, mystyle)
        D1.Columns(3).HeaderCell.Style.BackColor = Color.Red
    End Sub


    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        Dim tt As New VBprinter.DGVprint
        tt.ExportDGVToExcel2(D1, "用5.2版新增快速导出Excel功能（ExportDGVToExcel2函数）导出数据测试", "", True)
        tt.Dispose()
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Dim tt As New VBprinter.DGVprint
        tt.ExportDGVToExcel(D1, "用原来的导出Excel功能（ExportDGVToExcel函数）导出数据测试")
        tt.Dispose()
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim tt As New VBprinter.VB2008Print
        tt.ExportDGVToExcel2(D1, "用5.2版新增快速导出Excel功能（ExportDGVToExcel2函数）导出数据测试", "", True)
        tt.Dispose()
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Dim tt As New VBprinter.VB2008Print
        tt.ExportDGVToExcel(D1, "用原来的导出Excel功能（ExportDGVToExcel函数）导出数据测试")
        tt.Dispose()
    End Sub
End Class