sun_hoper 发表于 2009-3-26 10:28:25

如何得到一个excel表格的行数?

如题,有函数么?

hhasee 发表于 2009-4-28 15:35:30

顶一个先,我也碰到了这个问题,一个文件不知有多少行,有这要的函数吗?

wasd 发表于 2009-4-28 15:41:26

是不是这一个



; ***************************************************************
; Example 1 - Write to a Cell using a Loop, after opening a workbook and returning its object identifier.Read the cells into an array, display array,
;               then Save and Close file.
; *****************************************************************

#include <Excel.au3>
#include <Array.au3>

Local $oExcel = _ExcelBookNew() ;Create new book, make it visible

For $i = 1 To 5 ;Loop
    _ExcelWriteCell($oExcel, $i, $i, 1) ;Write to the Cell Vertically using values 1 to 5
Next

For $i = 1 To 5 ;Loop
    _ExcelWriteCell($oExcel, Asc($i), 1, $i + 2) ;Write to the Cell Horizontally, using Asc just to use different values for reading purposes
Next

$aArray1 = _ExcelReadArray($oExcel, 1, 1, 5, 1) ;Direction is Vertical
$aArray2 = _ExcelReadArray($oExcel, 1, 3, 5) ;Direction is Horizontal
_ArrayDisplay($aArray2, "Horizontal")
_ArrayDisplay($aArray1, "Vertical")

MsgBox(0, "Exiting", "Press OK to Save File and Exit")
_ExcelBookSaveAs($oExcel, @TempDir & "\Temp.xls", "xls", 0, 1) ; Now we save it into the temp directory; overwrite existing file if necessary
_ExcelBookClose($oExcel) ; And finally we close out

sonny 发表于 2009-12-16 20:03:11

ei ~~ 我也遇到这个问题了~~~

netegg 发表于 2009-12-16 20:18:32

$aArray = _ExcelReadSheetToArray($oExcel)
行数 列数

sonny 发表于 2009-12-16 20:46:11

感谢~~ 问题解决~~
页: [1]
查看完整版本: 如何得到一个excel表格的行数?