Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.

vb6 export listview or sql query, to word table

[es] :: Visual Basic 6 :: vb6 export listview or sql query, to word table

[ Pregleda: 3364 | Odgovora: 4 ] > FB > Twit

Postavi temu Odgovori

Autor

Pretraga teme: Traži
Markiranje Štampanje RSS

nidzolino85

Član broj: 236000
Poruke: 32
*.dynamic.isp.telekom.rs.



Profil

icon vb6 export listview or sql query, to word table11.01.2015. u 19:17 - pre 112 meseci
Potrebna mi je pomoc kako da iz listview-a ili na osnovu upita exportovati podatke (iz odredjenih polja baze) u word tablicu
Probao sam najpre sa formfields i bookmark-om, medjutim uspem da upisem samo jedan podatak (jer formfield je nije predvidjen za multiselect). Naime ova kontrola bi mi najbolje dosla jer nju dobro poznajem i koristim. Sustina mog problema je zapravo sto koristim word kao template za punjenje odredjenih podataka, medjutim za sva polja koja su staticna korisim formfield-s dok tablica (za koju ne znam koliko ce imati polja) treba da se puni podacima a koje dobijem iz upita. Kako ovo izvesti?

Code:
 .FormFields("a1").Range = Form1.txtImePrezime
 
Odgovor na temu

nidzolino85

Član broj: 236000
Poruke: 32
*.dynamic.isp.telekom.rs.



Profil

icon Re: vb6 export listview or sql query, to word table13.01.2015. u 13:25 - pre 112 meseci
Moze li necija pomoc???
 
Odgovor na temu

goranvuc
Goran Vucicevic
Novi Sad

Član broj: 4934
Poruke: 1846
*.dynamic.sbb.rs.



+41 Profil

icon Re: vb6 export listview or sql query, to word table13.01.2015. u 17:47 - pre 112 meseci
Upotrebi MailMerge.
 
Odgovor na temu

nidzolino85

Član broj: 236000
Poruke: 32
*.dynamic.isp.telekom.rs.



Profil

icon Re: vb6 export listview or sql query, to word table13.01.2015. u 18:20 - pre 112 meseci
Goranvuc Hvala, ako moze samo pojasnjenje kakva je to kontrola

Evo sta sam ja uspeo da izvucem, ovo je exportovanje iz listview-a direktno u word", stim sto bez On Error Resume Next prijavljuje gresku "error 5941"
Ono sto me zanima, ukoliko bih zeleo da iskoristim ovaj kod, kako mogu da:

1. Definisem izgled - stil tabele
2. Kako da dodajem samo odredjene tabele iz listview-a, a ne sve

Code:
On Error Resume Next
Dim objword As Word.Application
    Dim odoc As Word.Document
    Dim otable As Word.Table
    Dim i As Integer
    Dim j As Integer
    Set objword = New Word.Application
    Set odoc = objword.Documents.Add
    odoc.Activate
    objword.Selection.Move Unit:=wdStory
    objword.Selection.TypeParagraph
    objword.Selection.TypeParagraph
    Set otable = odoc.Tables.Add(odoc.Paragraphs(1).Range, ListView1.ListItems.Count, ListView1.ColumnHeaders.Count, wdWord9TableBehavior, wdAutoFitWindow)
    For i = 1 To ListView1.ColumnHeaders.Count
    otable.Rows(1).Cells(i).Range.Text = ListView1.ColumnHeaders(i)
    Next
    For i = 1 To ListView1.ListItems.Count
        otable.Columns(1).Cells(i).Range.Text = ListView1.ListItems(i).Text
    For j = 2 To ListView1.ColumnHeaders.Count
        otable.Rows(i + 2).Cells(j).Range.Text = ListView1.ListItems(i).SubItems(j - 1)
        Next
    Next
    objword.Visible = True
    Set objword = Nothing
    Set odoc = Nothing
    Set otable = Nothing
    ErR.Clear
 
Odgovor na temu

miki987

Član broj: 208123
Poruke: 511
*.dynamic.isp.telekom.rs.



+5 Profil

icon Re: vb6 export listview or sql query, to word table26.01.2015. u 23:56 - pre 111 meseci
evo

Code:
Set otable = oDoc.Tables.Add(oDoc.Paragraphs(10).Range, ListView1.ListItems.Count, 3, wdWord9TableBehavior, wdAutoFitWindow)


gde ti je paragraphs(10) pozicija kada kursorom brojis koliko redova imas, e znaci od 10og ce da krene da ti puni tabelu

Code:
oDoc.Tables(1).Rows(1).Height = 5
        oDoc.Tables(1).Columns(1).Width = 90
        oDoc.Tables(1).Columns(2).Width = 290
        oDoc.Tables(1).Columns(3).Width = 113


ovde si definisao sirinu tabela a ovde dole imena

Code:

        otable.Rows(1).Cells(1).Range.Text = "Datum"
        otable.Rows(1).Cells(2).Range.Text = "Trošak"
        otable.Rows(1).Cells(3).Range.Text = "Iznos"


sto znaci nekako ovako

Code:
 Set otable = oDoc.Tables.Add(oDoc.Paragraphs(10).Range, ListView1.ListItems.Count, 5, wdWord9TableBehavior, wdAutoFitWindow)

        'otable.Rows.HorizontalPosition = 0 'In points
        'otable.Rows.VerticalPosition = 80
        oDoc.Tables(1).Rows(1).Height = 5
        oDoc.Tables(1).Columns(1).Width = 30
        oDoc.Tables(1).Columns(2).Width = 290
        oDoc.Tables(1).Columns(3).Width = 90
        oDoc.Tables(1).Columns(4).Width = 50
        oDoc.Tables(1).Columns(5).Width = 30
        
        otable.Rows(1).Cells(1).Range.Text = "Datum"
        otable.Rows(1).Cells(2).Range.Text = "Obaljeni posao"
        otable.Rows(1).Cells(3).Range.Text = "DAtum opet"
        otable.Rows(1).Cells(4).Range.Text = "Sati"
        otable.Rows(1).Cells(5).Range.Text = "Iznos"
        
    For i = 1 To ListView1.ListItems.Count

        otable.Columns(1).Cells(i + 1).Range.Text = ListView1.ListItems(i).SubItems(1)
        otable.Columns(2).Cells(i + 1).Range.Text = ListView1.ListItems(i).SubItems(9)
        otable.Columns(3).Cells(i + 1).Range.Text = ListView1.ListItems(i).SubItems(11)
        otable.Columns(4).Cells(i + 1).Range.Text = ListView1.ListItems(i).SubItems(6)
        otable.Columns(5).Cells(i + 1).Range.Text = ListView1.ListItems(i).SubItems(7)
        
 
        
        otable.Columns(1).Cells(i).Range.ParagraphFormat.Alignment = wdAlignParagraphCenter
        otable.Columns(2).Cells(i).Range.ParagraphFormat.Alignment = wdAlignParagraphCenter
        otable.Columns(3).Cells(i).Range.ParagraphFormat.Alignment = wdAlignParagraphCenter
        otable.Columns(4).Cells(i).Range.ParagraphFormat.Alignment = wdAlignParagraphCenter
        otable.Columns(6).Cells(i).Range.ParagraphFormat.Alignment = wdAlignParagraphCenter

    Next
        otable.Rows(1).Cells(1).Range.ParagraphFormat.Alignment = wdAlignParagraphCenter
        otable.Rows(1).Cells(2).Range.ParagraphFormat.Alignment = wdAlignParagraphCenter
        otable.Rows(1).Cells(3).Range.ParagraphFormat.Alignment = wdAlignParagraphCenter
        otable.Rows(1).Cells(4).Range.ParagraphFormat.Alignment = wdAlignParagraphCenter
        otable.Rows(1).Cells(5).Range.ParagraphFormat.Alignment = wdAlignParagraphCenter
    End With
 
Odgovor na temu

[es] :: Visual Basic 6 :: vb6 export listview or sql query, to word table

[ Pregleda: 3364 | Odgovora: 4 ] > FB > Twit

Postavi temu Odgovori

Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.