Jump to content
Sign in to follow this  
Riz

ListView Print

Recommended Posts

Riz

Little Help Please.

Can anyone help me with this example below.

How can I print only the list.

Thanks in advance.

#include <GuiConstants.au3>
#include <GuiListView.au3>
#include <File.au3>

Opt ('MustDeclareVars', 1)
Dim $listview, $Btn_Exit, $msg, $Status
GUICreate("ListView Get BackColor", 392, 322)

$listview = GUICtrlCreateListView("col1|col2|col3", 40, 30, 310, 149, BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER))
GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES)
GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_FULLROWSELECT, $LVS_EX_FULLROWSELECT)
GUICtrlCreateListViewItem("line1|data1|more1", $listview)
GUICtrlCreateListViewItem("line2|data2|more2", $listview)
GUICtrlCreateListViewItem("line3|data3|more3", $listview)
GUICtrlCreateListViewItem("line4|data4|more4", $listview)
GUICtrlCreateListViewItem("line5|data5|more5", $listview)
$Btn_Exit = GUICtrlCreateButton("Exit", 150, 260, 70, 30)
$Btn_Print = GUICtrlCreateButton("Print", 250, 260, 70, 30)
$Status = GUICtrlCreateLabel("ListView BackColor: " & _GUICtrlListViewGetBackColor ($listview), 0, 302, 392, 20, BitOR($SS_SUNKEN, $SS_CENTER))
GUISetState()
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
            ExitLoop
        Case $msg = $Btn_Print
            $print = _FilePrint($listview)
    EndSelect
WEnd
Exit

Share this post


Link to post
Share on other sites
GaryFrost

#include <GuiConstants.au3>
#include <GuiListView.au3>
#include <GuiStatusBar.au3>
#include <File.au3>

Opt('MustDeclareVars', 1)
Dim $listview, $Btn_Exit, $msg, $StatusBar, $Btn_Print, $GUI, $print
$GUI = GUICreate("ListView Get BackColor", 392, 322)

$listview = GUICtrlCreateListView("col1|col2|col3", 40, 30, 310, 149, BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER))
GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES)
GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_FULLROWSELECT, $LVS_EX_FULLROWSELECT)
GUICtrlCreateListViewItem("line1|data1|more1", $listview)
GUICtrlCreateListViewItem("line2|data2|more2", $listview)
GUICtrlCreateListViewItem("line3|data3|more3", $listview)
GUICtrlCreateListViewItem("line4|data4|more4", $listview)
GUICtrlCreateListViewItem("line5|data5|more5", $listview)
$Btn_Exit = GUICtrlCreateButton("Exit", 150, 260, 70, 30)
$Btn_Print = GUICtrlCreateButton("Print", 250, 260, 70, 30)
$StatusBar = _GuiCtrlStatusBarCreate($GUI, -1, "")
_GuiCtrlStatusBarSetSimple($StatusBar)
_GuiCtrlStatusBarSetText($StatusBar, "ListView BackColor: " & _GUICtrlListViewGetBackColor($listview), 255)
GUISetState()
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
            ExitLoop
        Case $msg = $Btn_Print
            If FileExists(@ScriptDir & "\listview.txt") Then FileDelete(@ScriptDir & "\listview.txt")
            For $x = 0 To _GUICtrlListViewGetItemCount($listview) - 1
                FileWriteLine(@ScriptDir & "\listview.txt", _GUICtrlListViewGetItemText($listview, $x))
            Next
            $print = _FilePrint(@ScriptDir & "\listview.txt")
    EndSelect
WEnd
Exit


SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.