#include <Excel.au3>
#include <array.au3>
$oExcel = _ExcelBookNew()
example1()
example2()
example3()
Func example1()
$begin = TimerInit()
For $j = 1 To 10 ;列
For $i = 1 To 100 ;行
$filename1 = $i & ',' & $j
_ExcelWriteCell($oExcel, $filename1, $i, $j)
Next
Next
$dif = TimerDiff($begin)
MsgBox(0, 0, '处理1000行用时:' & $dif & '毫秒')
EndFunc
Func example2()
$begin1 = TimerInit()
Local $aArray[100][10]
For $i = 0 To 99
For $j = 0 To 9
$aArray[$i][$j] = $i + 1 & ',' & $j + 1
Next
;~ _ExcelWriteSheetFromArray($oExcel, $aArray, $i, 1, 0, 0) ;基于 0 开始的数组参数
Next
;~ _ArrayDisplay($aArray)
_ExcelWriteSheetFromArray($oExcel, $aArray, 1, 1, 0, 0) ;基于 0 开始的数组参数
$dif1 = TimerDiff($begin1)
MsgBox(0, '处理1000行用时:' & $dif1 & '毫秒', '处理1000行用时:' & $dif1 & '毫秒')
EndFunc
Func example3()
$begin = TimerInit()
Dim $e_a[10][100]
For $i=0 To 99
For $j=0 To 9
$e_a[$j][$i] = '行' & $i & ',列' & $j
Next
Next
$oExcel.activesheet.range("A1:J100").value = $e_a ; 使用上面的数字来 填写表格内容
$dif = TimerDiff($begin)
MsgBox(0, 0, '处理1000行用时:' & $dif & '毫秒', 1)
EndFunc
|