Image in table cell trouble


#1

I am trying to add an image to a table cell that is in a header and when i place it in the table cell It no longer appears in the pdf. This same thing also occurrs when I try to nest a table, the nested table does not appear. Any help would be great, below is my code to add to a header section.


Private Sub BuildHeader(ByRef header As HeaderFooter)

Dim dhhsLogo As Image

Dim headerTable As Table

Dim detailsTable As Table

Dim mainRow As Row

Dim detailRow1 As Row

Dim detailRow2 As Row

'load image

dhhsLogo = New Image(header)

dhhsLogo.ImageInfo.ImageFileType = ImageFileType.Wmf

dhhsLogo.ImageInfo.File = DHHS_LOGO_LOCATION

'build details table

detailsTable = New Table

detailRow1 = detailsTable.Rows.Add()

detailRow1.Cells.Add("XXX")

detailRow1.Cells.Add("XXX" & Environment.NewLine & "XXX")

detailRow1.Border = New BorderInfo(Fix(BorderSide.Bottom), 2)

detailRow2 = detailsTable.Rows.Add()

detailRow2.Cells.Add("XXX")

detailRow2.Cells.Add("XXX" & Environment.NewLine & "XXX" & Environment.NewLine & "XXX")

headerTable = New Table

mainRow = headerTable.Rows.Add()

'add the image and table to the main table

mainRow.Cells.Add().Paragraphs.Add(dhhsLogo)

mainRow.Cells.Add().Paragraphs.Add(detailsTable)

'add table to the passed in header

header.Paragraphs.Add(headerTable)

End Sub


#2

I rewrote a little of the code to try to get it to work. Now if i don’t add the image i can get the nested table to show up but I still can’t get the image to showup in the cell. The new code is as follows:

Private Sub BuildHeader(ByRef header As HeaderFooter)

Dim dhhsLogo As Image

Dim headerTable As Table

Dim detailsTable As Table

Dim mainRow As Row

Dim detailRow1 As Row

Dim detailRow2 As Row

Dim imageCell As Cell

Dim addressCell As Cell

'build the main table

headerTable = New Table

headerTable.ColumnWidths = “200 500”

mainRow = headerTable.Rows.Add()

imageCell = mainRow.Cells.Add()

addressCell = mainRow.Cells.Add()

'load image

dhhsLogo = New Image(header)

dhhsLogo.ImageInfo.ImageFileType = ImageFileType.Wmf

dhhsLogo.ImageScale = 0.75F

dhhsLogo.ImageInfo.File = DHHS_LOGO_LOCATION

'build details table

detailsTable = New Table(addressCell)

detailsTable.ColumnWidths = “300 200”

detailsTable.DefaultCellTextInfo = dataTILeft

detailRow1 = detailsTable.Rows.Add()

detailRow1.Cells.Add(“XXXX”)

detailRow1.Cells.Add(“XXX” & Environment.NewLine & “XXX”)

detailRow1.Border = New BorderInfo(Fix(BorderSide.Bottom), 2)

detailRow2 = detailsTable.Rows.Add()

detailRow2.Cells.Add(“XXX”)

detailRow2.Cells.Add(“XXX” & Environment.NewLine & “XXX” & Environment.NewLine & “XXX”)

'add sub items to cells

imageCell.Paragraphs.Add(dhhsLogo)

addressCell.Paragraphs.Add(detailsTable)

'add main table to the header

header.Paragraphs.Add(headerTable)

End Sub


#3

I just downloaded the 2.5.3 hotfix and everything is working fine now.