Dynamically created cell renders blank

I’m working on a project that uses the Aspose.Total (v2.2) license. Due to confidentiality with the client I can’t post the direct XML or source we are using to generate the PDFs but I will do my best to post everything relevant that I can.


Currently I am working on a reporting package to aggregate data from around the system. The report works great about 99% of the time. I have an error where one cell of a dynamically populated table is not rendered with text. I have verified in the code that the text is supplied to the cell via a new text object and the Paragraphs.Add method. The most puzzling part about this is that the third row first cell is always rendered without text. When I duplicate data being fed into the methods that generate the cell rows it is still the third row first cell that is blank, not the fifth and sixth rows. Also, this only happens on one source object for the report. Other source objects appear to work fine, although we have yet to have more than about a dozen test cases.

Can anyone help me with a resolution or maybe some items on how I can find where some error message is being stored or logged?

[Modified source and XML to be posed in a few moments.]
<Table ID="problemTable" IsBroken="false" ColumnWidths="25% 12.5% 12.5% 12.5% 12.5% 12.5% 12.5%"
FontName="Arial" >
Table Header Label
<Table IsBroken="false" ColumnWidths="16.6% 16.7% 16.6% 16.7% 16.7% 16.7%"
FontName="Arial" ColumnAdjustment="AutoFitToWindow" >
BCR:
Bcr
Breakeven:
Breakeven
NPV:
Npv
Private Sub CreateTableRow(ByVal table As Table, ByVal rowData As String())
Dim dataRow As New Row(table)
Dim itemCell As Cell
Dim borderInfo As BorderInfo = New BorderInfo(BorderSide.All, New Color("#000000"))
Dim textInfo As New TextInfo

'set up the text info
textInfo.FontName = "Arial"
textInfo.FontSize = 10

For i As Integer = 0 To rowData.Length - 1
If i = 0 Then
textInfo.IsTrueTypeFontBold = True
textInfo.Alignment = AlignmentType.Left
Else
textInfo.IsTrueTypeFontBold = False
textInfo.Alignment = AlignmentType.Right
End If

itemCell = New Cell(dataRow)
itemCell.BackgroundColor = New Color("White")
itemCell.Border = borderInfo
itemCell.Paragraphs.Add(New Text(rowData(i), textInfo))
dataRow.Cells.Add(itemCell)
Next

'_rowHeightAdjustment = 11
dataRow.FixedRowHeight = _rowHeightAdjustment
table.Rows.Add(dataRow)
End Sub

Here are some images demonstrating the problem.

Hello Matt,

Thanks for your interest in our products.

I've tried replicating the scenario using the following code snippet and the XML document and I'm afraid I'm unable to notice the problem that rows are missing data values. I've tested it with the latest version of Aspose.Pdf for .NET 4.1.2. Can you please take a look over the following code snippet and the resultant PDF in attachment.

I'm afraid I couldn't test the XML file that you've shared, because it wasn't complete. Can you please try using the latest version and in case the problem still persists, can you please modify the following code so that we can replicate the issue at our end.

We apologize for your inconvenience.

[VB.NET]

Dim dt As DataTable = New DataTable("Employee")
dt.Columns.Add("Modernization Funds", System.Type.GetType("System.Int32"))
dt.Columns.Add("FY2009", System.Type.GetType("System.String"))
dt.Columns.Add("FY2010", System.Type.GetType("System.String"))
dt.Columns.Add("FY2011", System.Type.GetType("System.String"))
dt.Columns.Add("FY2012", System.Type.GetType("System.String"))
dt.Columns.Add("FY2013", System.Type.GetType("System.String"))
dt.Columns.Add("FY2014", System.Type.GetType("System.String"))

Dim rowcount As Int32
For rowcount = 1 To 10\
Dim dr As DataRow = dt.NewRow()
dr(0) = rowcount
dr(1) = rowcount * 1
dr(2) = rowcount * 2
dr(3) = rowcount * 3
dr(4) = rowcount * 4
dr(5) = rowcount * 5
dr(6) = rowcount * 6
dt.Rows.Add(dr)
Next

Dim pdf1 As Pdf = New Pdf()
'Create a Pdf instance and bind the XML template file to Pdf instance
pdf1.BindXML("D:/pdftest/tableissuetemplate.xml", Nothing)
'Get the section and then table from the obtained section of the Pdf that
'is built from the XML template
Dim sec1 As Aspose.Pdf.Section = pdf1.Sections("Section1")
Dim table1 As Aspose.Pdf.Table = CType(sec1.Paragraphs("Table1"), Aspose.Pdf.Table)
Dim row1 As Aspose.Pdf.Row = CType(table1.Rows("Row1"), Aspose.Pdf.Row)
row1.BackgroundColor = New Aspose.Pdf.Color("Green")
''Import data into the Table object from the DataTable created above
table1.ImportDataTable(dt, True, 0, 0, rowcount, 7)

pdf1.Save("d:/pdftest/tableissuetemplate.pdf")

[XML]

<?xml version="1.0" encoding="utf-8" ?>
<Pdf xmlns="Aspose.Pdf">
<Section ID="Section1">
<Table ID="Table1" ColumnWidths="100 50 50 50 50 50 50" IsFirstRowRepeated="true" FontName="Arial">

<All LineWidth="0.1" />

<Row ID="Row1" VerticalAlignment="Center">
</Row>
<Row ID="Row2" VerticalAlignment="Center">
</Row>
</Table>
</Section>
</Pdf>

codewarior,

Thanks for the assistance. I think this may be an issue with the older version of aspose that we have. Our development effort has been re-focused into another portion of our app for now.

Matt