itextsharp and Multiple Font types in a Table Cell

Discussion in 'ASP .Net' started by Hawksey, Aug 23, 2006.

  1. Hawksey

    Hawksey Guest

    Hello

    I have just started messing with the itextsharp component and was
    wondering if it was possible to add two concatenated phrases each with
    a different font type to a a table cell

    eg
    ############################
    Dim pdfCell As Cell
    Dim phFirst As Phrase
    Dim phSecond As Phrase
    Dim fntNormalText As Font = FontFactory.GetFont(FontFactory.HELVETICA,
    12, Font.NORMAL)
    Dim fntBoldText As Font = FontFactory.GetFont(FontFactory.HELVETICA,
    12, Font.BOLD)

    phFirst = New Phrase(("Name:", fntBoldText)
    phSecond = New Phrase(strFirstName & " " & strSurname, fntNormalText)
    pdfCell = New Cell(phFirst & phSecond)
    ##################################

    The above doesn't work, but I was hoping someone could point me in the
    right direction to accomplish the task.

    Many thanks
    Paul
     
    Hawksey, Aug 23, 2006
    #1
    1. Advertisements

  2. Hawksey

    Hawksey Guest

    Managed to sort this out.

    If anyone is interested.
    #############################################
    Dim phFirst As Phrase
    Dim phSecond As Phrase
    Dim para As Paragraph = New Paragraph
    Dim fntNormalText As Font =
    FontFactory.GetFont(FontFactory.HELVETICA,
    12, Font.NORMAL)
    Dim fntBoldText As Font =
    FontFactory.GetFont(FontFactory.HELVETICA,
    12, Font.BOLD)

    phFirst = New Phrase("Name:", fntTRSBoldText)
    phSecond = New Phrase(strFirstName & " " & strSurname,
    fntTRSNormalText)
    para.Add(phFirst)
    para.Add(phSecond)
    pdfCell = New Cell(para)
    ##################################################
     
    Hawksey, Aug 23, 2006
    #2
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.