本帖最后由 繁星 于 2023-9-29 13:34 编辑
利用假期同步到最新4.2.0.0版本,顺便修正下错误
共计413个函数,因为我只用了其中不到十分之一,想全部测试一遍是个大工程,所以大部分函数都未经测试,若发现问题可以留言或私信给我改正
参考官方文档https://www.libxl.com/documentation.html?lang=c
最基本读写:#include 'libxl.au3'
#include <Array.au3>
Local $sFileName = 'Test.xlsx'
Local $BookHandle = xlCreateXMLBook()
If $BookHandle Then
Local $hSheet = xlBookAddSheet($BookHandle, 'Sheet1')
If $hSheet Then
For $i = 0 To 1000 - 1
For $j = 0 To 10 - 1
xlSheetWriteStr($hSheet, $i, $j, '测试' & '-' & $i & '-' & $j)
Next
Next
xlBookSave($BookHandle, $sFileName)
EndIf
EndIf
If xlBookLoad($BookHandle, $sFileName) Then
For $i = 0 To xlBookSheetCount($BookHandle) - 1
Local $hSheet = xlBookGetSheet($BookHandle, $i)
If $hSheet Then
Local $Array[xlSheetLastRow($hSheet)][xlSheetLastCol($hSheet)]
For $x = 0 To UBound($Array) - 1
For $y = 0 To UBound($Array, 2) - 1
$Array[$x][$y] = xlSheetReadStr($hSheet, $x, $y)
Next
Next
_ArrayDisplay($Array, xlBookGetSheetName($BookHandle, $i))
EndIf
Next
EndIf
xlBookRelease($BookHandle)
|