JeromeB 0 Posted September 29, 2010 hey guys, I have actually a form who generate a listview with 3 columns. I would like to add a button, and when we click on it, the listview items are export in Excel. Range by columns. thx for your help. Jérôme Share this post Link to post Share on other sites
water 2,387 Posted September 29, 2010 (edited) The Array UDF has function _ArrayDisplay which displays an array in a lsitview and lets you copy the content to the clipboard. The Listview is copied to an array and then written to the clipboard. The example below is taken directly from arry.au3 and copies all selected listview entries to an array. Local $aiCurItems[1] = [0] For $i = 0 To GUICtrlSendMsg($hListView, $_ARRAYCONSTANT_LVM_GETITEMCOUNT, 0, 0) If GUICtrlSendMsg($hListView, $_ARRAYCONSTANT_LVM_GETITEMSTATE, $i, 0x2) Then $aiCurItems[0] += 1 ReDim $aiCurItems[$aiCurItems[0] + 1] $aiCurItems[$aiCurItems[0]] = $i EndIf Next You could then use function _ExcelWriteArray to write the array to Excel. Edited September 29, 2010 by water My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2020-10-10 - Version 1.5.2.1) - Download - General Help & Support - Example Scripts - WikiOutlookEX (NEW 2020-12-15 - Version 1.6.3.1) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2020-06-27 - Version 1.3.2.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - WikiTask Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - WikiTutorials:ADO - Wiki, WebDriver - Wiki Share this post Link to post Share on other sites
JeromeB 0 Posted September 29, 2010 (edited) Hey Thx for your answer, but i dont understand how to do for put my entire listview into an array. I have actually $List1 = GUICtrlCreateListView("", 9, 8, 615, 374) _GUICtrlListView_AddColumn($List1, "IP", 100) _GUICtrlListView_AddColumn($List1, "Computer Name", 100) _GUICtrlListView_AddColumn($List1, "User Actually Connected", 200) And adding items with GUICtrlCreateListViewItem($IpList & "|" & $sResult & "|" & $user, $List1) Can you give me an exemple to show me how to procede. Jérôme Edited September 29, 2010 by Jerome60 Share this post Link to post Share on other sites
water 2,387 Posted September 29, 2010 Can you give me an exemple to show me how to procede. Sure. Something like this: #include <Guilistview.au3> #include <excel.au3> GUICreate("listview items", 220, 250, 100, 200) $listview = GUICtrlCreateListView("col1 |col2|col3 ", 10, 10, 200, 150) $item1 = GUICtrlCreateListViewItem("item2|col22|col23", $listview) $item2 = GUICtrlCreateListViewItem("item1|col12|col13", $listview) $item3 = GUICtrlCreateListViewItem("item3|col32|col33", $listview) GUISetState() Sleep(2000) $oExcel = _ExcelBookNew() $iItems = _GUICtrlListView_GetItemCount($listview) For $iItem = 0 To $iItems-1 $Zf = _GUICtrlListView_GetItemTextString($listview, $iItem) $Zf = StringSplit($Zf, "|", 1) _ExcelWriteArray($oExcel, $iItem + 1, 1, $Zf, 0, 1) Next My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2020-10-10 - Version 1.5.2.1) - Download - General Help & Support - Example Scripts - WikiOutlookEX (NEW 2020-12-15 - Version 1.6.3.1) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2020-06-27 - Version 1.3.2.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - WikiTask Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - WikiTutorials:ADO - Wiki, WebDriver - Wiki Share this post Link to post Share on other sites