Vb.net and Itextsharp

Asked

Viewed 100 times

0

Good for everyone, I have a problem, through a list I am trying to create a PDF, with the title and with the content. Example:

Title 1

Description title 1

My problem is that if you have more than one Title 1 content, it will always duplicate the title.

Example:

Title 1

Description title 1

Title 1

Description title 1

And here’s what I wanted to do:

Title 1

Description title 1

Description Title 1.2

Title 2

Description title 2

My code:

        Dim x As Integer
    For x = 0 To administrador.ListView1.Items.Count - 1
        'ADDTitle
        Dim FontTitle = FontFactory.GetFont("Arial", 11)
        Dim Titlechunk As New Chunk(gettitle(administrador.ListView1.Items(x).Text.Substring(4, 2)).ToString, FontTitle)
        Titlechunk.Font.SetStyle(FontStyle.Bold)
        Dim Titlepara As New Paragraph()
        Titlepara.Add(Titlechunk)
        Titlepara.Alignment = Element.ALIGN_LEFT
        PdfDoc.Add(Titlepara)

        'Descrição
        Dim FontDesc = FontFactory.GetFont("Arial", 9)
        Dim phDesc As New Phrase()
        Dim Descchunk As New Chunk("  > " + administrador.ListView1.Items(x).SubItems(1).Text + " COM A QUANTIDADE NECESSÁRIA DE " + administrador.ListView1.Items(x).SubItems(2).Text + "UNIDADE(S)", FontDesc)
        phDesc.Add(Descchunk)
        Dim paraDesc As New Paragraph()
        paraDesc.Add(phDesc)
        PdfDoc.Add(paraDesc)

        PdfDoc.Add(New Paragraph(" "))
    Next

Thank you for your attention :b

  • I don’t understand very well what you want. Could you add more details to the question? Ask a tour to learn more about the site.

  • Good, let me see if I can explain better, I wanted in PDF to make titles for categories, but if there is more than one category that puts everything in the same title zone and not always "duplicate" the title with the category.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.