国产一级a片免费看高清,亚洲熟女中文字幕在线视频,黄三级高清在线播放,免费黄色视频在线看

打開APP
userphoto
未登錄

開通VIP,暢享免費電子書等14項超值服

開通VIP
表格數(shù)據(jù)導(dǎo)到Txt、Excel

'表格數(shù)據(jù)導(dǎo)到Txt

    Private Sub ToolStripButtonExpTxt_Click(sender As Object, e As EventArgs) Handles ToolMain_ButtonExpTxt.Click

        Dim cFileName As String = "D:\MyProg\" & "連板" & Date.Now.Month.ToString & Date.Now.Day.ToString & ".txt"

        Dim oFile As New StreamWriter(cFileName)

        Dim strTemp As String = Nothing

        Try

            For r = 0 To DGV_GpHqFind.RowCount - 1

                strTemp = ""

                For c = 0 To DGV_GpHqFind.Columns.Count - 1

                    strTemp &= DGV_GpHqFind(c, r).Value & ","

                Next

                oFile.WriteLine(strTemp)

            Next

            MsgBox("數(shù)據(jù)已導(dǎo)到:" & cFileName, 64, "信息提示")

            oFile.Close()

        Catch ex As Exception

            MsgBox(ex.ToString, 48, "錯誤信息")

        End Try

        oFile = Nothing

    End Sub

    '表格數(shù)據(jù)導(dǎo)到Excel

    Private Sub ToolStripButtonExpExcel_Click(sender As Object, e As EventArgs) Handles ToolMain_ButtonExpExcel.Click

        Dim oExce As Excel.Application

        Dim oWork As Excel.Workbook

        Dim oSh As Excel.Worksheet

        Dim oRng As Excel.Range

        Try

            Dim cTitle As String = "代碼,名稱,今開,昨收,今收,漲跌,漲幅%,最高,最低,成交量,成交額"

            Dim aTitle As Array = cTitle.Split(",")

            ' Start Excel and get Application object.

            oExce = CreateObject("Excel.Application")

            oExce.Visible = True

            ' Add a new workbook.

            oWork = oExce.Workbooks.Add

            oSh = oWork.ActiveSheet

            For c As Integer = 0 To aTitle.Length - 1

                oSh.Cells(1, c + 1).Value = aTitle(c)

            Next

            oExce.ScreenUpdating = False

            ' Format A1:D1 as bold, vertical alignment = center.

            oSh.Range("A:B").NumberFormatLocal = "@"

            For r = 0 To Me.DGV_GpHqFind.RowCount - 1

                For c = 0 To Me.DGV_GpHqFind.ColumnCount - 1

                    With oSh

                        If c < 2 Then

                            .Cells(r + 2, c + 1).Value = Me.DGV_GpHqFind.Item(c, r).Value.ToString

                        Else

                            .Cells(r + 2, c + 1).Value = Me.DGV_GpHqFind.Item(c, r).Value

                        End If

                    End With

                Next

            Next

            With oSh.Range("A1", "K" & DGV_GpHqFind.RowCount + 1)

                .Font.Name = "微軟雅黑"

                .Font.Size = 11

            End With

            With oSh.Range("A1", "K1")

                .Font.Bold = True

                .VerticalAlignment = Excel.XlVAlign.xlVAlignCenter

                .EntireColumn.AutoFit()

            End With

            oExce.ScreenUpdating = True

            ' Make sure Excel is visible and give the user control

            ' of Excel's lifetime.

            ' Release object references.

            'oExce.Visible = True

            oRng = Nothing

            oSh = Nothing

            oWork = Nothing

            oExce.Quit()

            oExce = Nothing

        Catch ex As Exception

            MsgBox(ex.ToString, 48, "錯誤信息")

        End Try

    End Sub

本站僅提供存儲服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點擊舉報。
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
C# 將數(shù)據(jù)導(dǎo)出到Excel匯總
分享一個DoNet 下 datagridview導(dǎo)出到excel的函數(shù)
C#
Excel 多個excel文件 如何合并到一個excel文件中
Excel VBA 文件批量改名/自定義函數(shù)獲取文件夾路徑/自定義函數(shù)獲取文件夾下所有文件
VB.NET向Excel寫入并保存數(shù)據(jù)
更多類似文章 >>
生活服務(wù)
分享 收藏 導(dǎo)長圖 關(guān)注 下載文章
綁定賬號成功
后續(xù)可登錄賬號暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點擊這里聯(lián)系客服!

聯(lián)系客服