Dim lst as MScomctl.ListItem
Printer.Print "ListView contents:"
For each lst in ListView1.ListItems
Printer.Print vbtab & lst.Text
Next
Printer.End
Dim f as Integer
Dim s as String
Dim lst As ListItem
Dim lsi As ListSubItem
f=FreeFile
Open App.Path & "\listviewcontent.htm" For Output As #f
Print #f, "<html><head><title>"
Print #f, "Содержимое списка"
Print #f, "</title></head><body><table align=center border=1 width=90% height=80% cellspacing=0 cellpading=0>"
For Each lst In Me.ListView1.ListItems
s="<tr><td>" & lst.text & "&nsbp;</td>"
For Each lsi In lst.ListSubItems
s=s & "<td>" & lsi.Text & " </td>"
Next
Print #f, s & "</tr>"
Next
Print #f, "</table></body></html>"
Close #f
Option Explicit
Private Sub Command1_Click()
Dim f As Integer
Dim s As String
Dim lst As ListItem
Dim lsi As ListSubItem
f = FreeFile
Open "c:\listviewcontent.htm" For Output As #f
Print #f, "<html><head><title>"
Print #f, "Ñîäåðæèìîå ñïèñêà"
Print #f, "</title></head><body><table align=center border=1 width=90% height=80% cellspacing=0 cellpading=0>"
For Each lst In Me.ListView1.ListItems
s = "<tr><td>" & lst.Text & " </td>"
For Each lsi In lst.ListSubItems
s = s & "<td>" & lsi.Text & " </td>"
Next
Print #f, s & "</tr>"
Next
Print #f, "</table></body></html>"
Close #f
Shell "explorer c:\listviewcontent.htm", vbNormalFocus
End Sub
Private Sub Form_Load()
Dim i As Integer
Dim j As Integer
Dim lst As MSComctlLib.ListItem
With Me.ListView1
For i = 1 To 10
Set lst = .ListItems.Add(, "k_" & i, "Item " & i)
For j = 1 To 3
lst.ListSubItems.Add , lst.Key & "_" & j, "Subitem " & j
Next j
Set lst = Nothing
Next i
End With
End Sub
kibernetics писал(а):Konst_One
а подобным кодом можно ли както печатать без использования ИЕ?
не факт что у юзера будет ИЕ.
Сейчас этот форум просматривают: Google-бот, Mail.ru [бот], Yandex-бот и гости: 48