PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Sat May 11, 2024 10:22 am

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Frage/ Question
PostPosted: Mon Jan 17, 2011 8:26 am 
Offline

Joined: Mon Nov 29, 2010 8:34 am
Posts: 4
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


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 97 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group