回复 1# ak47gglllk
不知道是不是这样?
#include <GUIConstantsEx.au3>
#include <GuiListView.au3>
#include <MsgBoxConstants.au3>
#include <Array.au3>
#include <Excel.au3>
Example()
Func Example()
Local $aItem, $sText, $idListview
GUICreate("ListView Get Item Text Array", 400, 300)
$idListview = GUICtrlCreateListView("col1|col2|col3", 2, 2, 394, 268)
GUICtrlCreateListViewItem("line1|data1|more1", $idListview)
GUICtrlCreateListViewItem("line2|data2|more2", $idListview)
GUICtrlCreateListViewItem("line3|data3|more3", $idListview)
GUICtrlCreateListViewItem("line4|data4|more4", $idListview)
GUICtrlCreateListViewItem("line5|data5|more5", $idListview)
GUISetState(@SW_SHOW)
Local $ListColumnCount = _GUICtrlListView_GetColumnCount($idListview)
Local $ListRowCount = _GUICtrlListView_GetItemCount($idListview)
Dim $ItemArray[1][$ListColumnCount]
For $i = 0 To $ListRowCount - 1
$aItem = _GUICtrlListView_GetItemTextString($idListview, $i)
_ArrayAdd($ItemArray, $aItem, 0)
Next
_ArrayDelete($ItemArray, 0)
;_ArrayDisplay($ItemArray)
Local $oAppl = _Excel_Open()
Local $oWorkbook = _Excel_BookNew($oAppl)
$oWorkbook.activesheet.cells(1, 1).resize($ListRowCount, $ListColumnCount) = $oWorkbook.application.transpose($ItemArray)
; Loop until the user exits.
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>Example
|