D
dirk
Unregistered / Unconfirmed
GUEST, unregistred user!
VB中代码:
-----------------------------------------------------------------------
Option Explicit
Dim Ex As Excel.Application
Dim Wb As Workbook
Dim Ws As Worksheet
Dim Ra As Range
Private Sub Command1_Click()
Dim a(2, 2) As String
Set Ex = New Excel.Application
Set Wb = Ex.Workbooks.Add
Set Ws = Wb.Worksheets.Add
Ex.Visible = True
a(0, 0) = "aaaaa"
a(0, 1) = "bbbbb"
a(1, 0) = "ccccc"
a(1, 1) = "ddddd"
[red]Ws.Range("A1:B2") = a[/red]
End Sub
Private Sub Command2_Click()
Ex.Quit
End Sub
-----------------------------------------------------------------------
但Delphi中无法写入整个数组,而这个方法可使写入Excel的速度大大提高,有没有办法实现???
-----------------------------------------------------------------------
Option Explicit
Dim Ex As Excel.Application
Dim Wb As Workbook
Dim Ws As Worksheet
Dim Ra As Range
Private Sub Command1_Click()
Dim a(2, 2) As String
Set Ex = New Excel.Application
Set Wb = Ex.Workbooks.Add
Set Ws = Wb.Worksheets.Add
Ex.Visible = True
a(0, 0) = "aaaaa"
a(0, 1) = "bbbbb"
a(1, 0) = "ccccc"
a(1, 1) = "ddddd"
[red]Ws.Range("A1:B2") = a[/red]
End Sub
Private Sub Command2_Click()
Ex.Quit
End Sub
-----------------------------------------------------------------------
但Delphi中无法写入整个数组,而这个方法可使写入Excel的速度大大提高,有没有办法实现???