tags:

views:

90

answers:

1

Hi Folks,

Is there a way to assign a font to a list that is added to table cell in ITextsharp. I'm sure it must be straightforward but I'm missing it.

Dim tblSignature As New PdfPTable(1)
        tblSignature.WidthPercentage = 90.0F

        Dim _baseFont As BaseFont = BaseFont.CreateFont(BaseFont.HELVETICA, BaseFont.WINANSI, BaseFont.NOT_EMBEDDED)

        Dim _bFont As New Font(_baseFont, 4, Font.ITALIC, Color.RED)

        Dim cell As New PdfPCell(New Phrase(TheItem.Value, _bFont))

        TheParagraph.Font = _bFont


        Dim list As New List(list.UNORDERED, 25.0F)
        list.SetListSymbol("[  ]")


        If ListItems.Count > 0 Then
            For Each ListItem In .ListItems
                //I have tried adding as chunk/phrase and applying font but no joy
                //Item not added to cell
                //list.Add(New Chunk(ListItem, _bFont))

                list.Add(ListItem)
            Next

            list.IndentationLeft = 5.0F

            cell.AddElement(list)
        End If

        cell.Colspan = 6
        cell.HorizontalAlignment = 0
        cell.PaddingBottom = 5.0F
        cell.PaddingLeft = 5.0F
        cell.PaddingRight = 5.0F

        '' add to doc
        tblSignature.AddCell(cell)

        TheParagraph.Add(tblSignature)

Does anyone know How I'd change this so that the list/cell has the specific font I've set at the top.

Cheers

+2  A: 

The iTextSharp.text.ListItem object has an iTextSharp.text.Font property you can set.

Jay Riggs
Bloody hell, I was applying a string directly to the list rather than using a ListItem, thanks very much
Israfel