JeromeB Posted September 29, 2010 Share 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 Link to comment Share on other sites More sharing options...
water Posted September 29, 2010 Share 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 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
JeromeB Posted September 29, 2010 Author Share 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 Link to comment Share on other sites More sharing options...
water Posted September 29, 2010 Share 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 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now