PDFsharp & MigraDoc Foundation
http://forum.pdfsharp.de/

Frage/ Question
http://forum.pdfsharp.de/viewtopic.php?f=2&t=1509
Page 1 of 1

Author:  tzollo [ Mon Jan 17, 2011 8:26 am ]
Post subject:  Frage/ Question

Hallo, da mein Englisch nicht ausreicht um mein Problem qualifiziert zu schildern, hoffe ich, dass mir auch jemand auf Deutsch weiterhelfen kann.

Ich arbeite mit MigraDoc in VB 2010 und habe auch ohne VB Beispiel meine Dokumente bisher erstellt bekommen (an dieser Stelle noch einmal ein Lob für dieses Tool)!

Da ich nun mit einer Schleife ein Listview auslese und die Einträge mittels einer Table in MigraDoc ausdrucken möchte habe ich folgenden Code geschrieben:

Code:
            Dim table = New MigraDoc.DocumentObjectModel.Tables.Table()
            table.Borders.Width = 0.75

            Dim column = table.AddColumn(Unit.FromCentimeter(5))
            column.Format.Alignment = ParagraphAlignment.Left

            table.AddColumn(Unit.FromCentimeter(5))

            Dim row = table.AddRow()
            row.Shading.Color = Colors.AliceBlue
            Dim cell = row.Cells(0)
            cell.AddParagraph("Name")
            Dim cell1 = row.Cells(1)
            cell1.AddParagraph("Ersparnis mtl.")

            With ErgebnisFirma.ListeAN.CheckedItems
                ' Jede Zeile wird durchgegangen
                ' .SubItems(3) = Spalte 1 der Listview
                ' .SubItems(1) = Spalte 2 der Listview
                ' usw. ...
                For i As Integer = 0 To .Count - 1
                    paragraph7.AddFormattedText(CStr(.Item(i).SubItems(2).Text) & " " & CStr(.Item(i).SubItems(1).Text))
                    Dim row1 = table.AddRow()
                    Dim cell2 = row1.Cells(i)
                    cell2.AddParagraph((CStr(.Item(i).SubItems(2).Text) & " " & CStr(.Item(i).SubItems(1).Text)))
                    Dim cell3 = row1.Cells(i + 1)
                    cell3.AddParagraph((Format(CDbl(.Item(i).SubItems(4).Text), "C")))
                Next

                document.LastSection.Add(table)


Leider funktioniert das so nicht. Ich vermute, das ich eine weitere Schleife für die Cells der Table benötige?!

Vielen Dank
Thobias

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/