We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Nesting tables

I am trying to upgrade my code to the current release. I use nested tables. I have updated my code and I am having an issue. If I comment out the other line in red to place the table on its own everything works fine. When I nest the table in to a cell and try to format cells in the nested table the pdf is blank after the point where the nested table should appear

colsInGroupTable = 4

For cnt As Int16 = 1 To res.rftCount

If res.rft(cnt).group <> savegroup Then

If colsInGroupTable > 3 Then
row1 = New Aspose.Pdf.Generator.Row(GroupTable)
GroupTable.Rows.Add(row1)
colsInGroupTable = 0
End If

savegroup = res.rft(cnt).group

If colsInGroupTable > 0 Then
cell1 = New Aspose.Pdf.Generator.Cell(GroupTable)
cell1.FitWidth = 15
row1.Cells.Add(cell1)
End If

cell1 = New Aspose.Pdf.Generator.Cell(GroupTable)
cell1.FitWidth = sumColWidth
row1.Cells.Add(cell1)
colsInGroupTable += 1

section = pdf.Sections(0)
SummaryTable = New Aspose.Pdf.Generator.Table(section)

'section.Paragraphs.Add(SummaryTable)
cell1.Paragraphs.Add(SummaryTable)

row = New Aspose.Pdf.Generator.Row(SummaryTable)
SummaryTable.Rows.Add(row)

cell = New Aspose.Pdf.Generator.Cell(SummaryTable)
row.Cells.Add(cell)
cell.Border = New BorderInfo
cell.Border.Left = New GraphInfo
cell.Border.Left.Color = New Aspose.Pdf.Generator.Color("Black")
cell.Border.Right = cell.Border.Left
cell.Border.Bottom = cell.Border.Left
cell.Padding = New MarginInfo
cell.Padding.Top = 2
cell.Padding.Bottom = 2
cell.FitWidth = grpColWidth1 + grpColwidth2
cell.ColumnsSpan = 2
cell.BackgroundColor = New Aspose.Pdf.Generator.Color("Black")

text = New Text(section)
cell.Paragraphs.Add(text)
seg = New Segment(text)
text.Segments.Add(seg)
text.TextInfo.Alignment = AlignmentType.Center
seg.TextInfo.FontName = "Arial"
seg.TextInfo.FontSize = 9
seg.TextInfo.Color = New Aspose.Pdf.Generator.Color("White")
seg.Content = "Group " & Left(res.rft(cnt).group, 1)
End If

row = SummaryTable.Rows.Add()
cell = row.Cells.Add()
cell.FitWidth = grpColwidth2
cell.Border = New BorderInfo
cell.Border.Left = New GraphInfo
cell.Border.Left.Color = New Aspose.Pdf.Generator.Color("Black")
cell.Border.Right = cell.Border.Left
cell.Border.Bottom = cell.Border.Left
cell.Padding = New MarginInfo
cell.Padding.Top = 2
cell.Padding.Left = 2

text = New Text(section)
cell.Paragraphs.Add(text)
seg = New Segment(text)
text.Segments.Add(seg)
text.TextInfo.Alignment = AlignmentType.Left
seg.TextInfo.FontName = "Arial"
seg.TextInfo.FontSize = 8
seg.TextInfo.Color = New Aspose.Pdf.Generator.Color("Black")
seg.Content = UCase(res.rft(cnt).clubName)

If showType = "club" Or showType = "teamclub" Or showType = "state" Then
text = New Text(section)
cell.Paragraphs.Add(text)
seg = New Segment(text)
text.Segments.Add(seg)
text.TextInfo.Alignment = AlignmentType.Left
seg.TextInfo.FontName = "Arial"
seg.TextInfo.FontSize = 6
seg.TextInfo.Color = New Aspose.Pdf.Generator.Color("Black")
seg.Content = sic.Abbreviate(res.rft(cnt).teamName, maxCharLength + 4)
End If

cell = New Aspose.Pdf.Generator.Cell(SummaryTable)
row.Cells.Add(cell)
cell.FitWidth = grpColWidth1
cell.Border = New BorderInfo
cell.Border.Left = New GraphInfo
cell.Border.Left.Color = New Aspose.Pdf.Generator.Color("Black")
cell.Border.Right = cell.Border.Left
cell.Border.Bottom = cell.Border.Left
cell.Padding = New MarginInfo
cell.Padding.Top = 2
cell.Padding.Right = 2
text = New Text(section)
text.TextInfo.Alignment = AlignmentType.Right
cell.Paragraphs.Add(text)
seg = New Segment(text)
text.Segments.Add(seg)
seg.TextInfo.FontName = "Arial"
seg.TextInfo.FontSize = 9
seg.TextInfo.Color = New Aspose.Pdf.Generator.Color("Black")
seg.Content = Int(res.rft(cnt).points)
Next

Hi John,

Thank you for using our products and sharing the sample code with us. I tried using your code to test your issue but due to missing variables, I was unable to replicate the scenario at my end. However, to exactly replicate your issue at our end, we would appreciate, if you create a sample application and post here to show us the issue. This will help us to regenerate the issue and get the cause of the issue soon.

We apologize for your inconvenience.

Thanks & Regards,

This code should not require any additional code to run. As soon as I add the line in red, the code fails....John

Dim tabA As Aspose.Pdf.Generator.Table = New Aspose.Pdf.Generator.Table()
tabA.IsFirstParagraph = True
section.Paragraphs.Add(tabA)

savegroup = ""
For cnt As Int16 = 1 To 4

If savegroup = "" Then

savegroup = "X"

row1 = New Aspose.Pdf.Generator.Row(tabA)
tabA.Rows.Add(row1)
cell1 = New Aspose.Pdf.Generator.Cell(tabA)
cell1.FitWidth = 540
row1.Cells.Add(cell1)

SummaryTable = New Aspose.Pdf.Generator.Table(section)
SummaryTable.DefaultCellBorder = New Aspose.Pdf.Generator.BorderInfo(Aspose.Pdf.Generator.BorderSide.All)

cell1.Paragraphs.Add(SummaryTable)

row = New Aspose.Pdf.Generator.Row(SummaryTable)
SummaryTable.Rows.Add(row)

cell = New Aspose.Pdf.Generator.Cell(SummaryTable)
row.Cells.Add(cell)
cell.Padding = New MarginInfo
cell.Padding.Top = 2
cell.Padding.Bottom = 2
cell.FitWidth = 540
cell.ColumnsSpan = 2
cell.BackgroundColor = New Aspose.Pdf.Generator.Color("Black")

text = New Text(section)
cell.Paragraphs.Add(text)
seg = New Segment(text)
text.Segments.Add(seg)
text.TextInfo.Alignment = AlignmentType.Center
seg.TextInfo.FontName = "Arial"
seg.TextInfo.FontSize = 9
seg.TextInfo.Color = New Aspose.Pdf.Generator.Color("White")
seg.Content = "Group " & Left(res.rft(cnt).group, 1)
End If

row = SummaryTable.Rows.Add()
cell = New Aspose.Pdf.Generator.Cell(SummaryTable)
cell = row.Cells.Add()
cell.FitWidth = 500
cell.Padding = New MarginInfo
cell.Padding.Top = 2
cell.Padding.Left = 2
cell.BackgroundColor = New Aspose.Pdf.Generator.Color("gainsboro")

text = New Text(section)
cell.Paragraphs.Add(text)
seg = New Segment(text)
text.Segments.Add(seg)
text.TextInfo.Alignment = AlignmentType.Left
seg.TextInfo.FontName = "Arial"
seg.TextInfo.FontSize = 8
seg.TextInfo.Color = New Aspose.Pdf.Generator.Color("Black")
seg.Content = UCase(res.rft(cnt).clubName)

If showType = "club" Or showType = "teamclub" Or showType = "state" Then
text = New Text(section)
cell.Paragraphs.Add(text)
seg = New Segment(text)
text.Segments.Add(seg)
text.TextInfo.Alignment = AlignmentType.Left
seg.TextInfo.FontName = "Arial"
seg.TextInfo.FontSize = 6
seg.TextInfo.Color = New Aspose.Pdf.Generator.Color("Black")
seg.Content = "X"
End If

cell = New Aspose.Pdf.Generator.Cell(SummaryTable)
row.Cells.Add(cell)
cell.FitWidth = 40
cell.Padding = New MarginInfo
cell.Padding.Top = 2
cell.Padding.Right = 2
text = New Text(section)
text.TextInfo.Alignment = AlignmentType.Right
cell.Paragraphs.Add(text)
seg = New Segment(text)
text.Segments.Add(seg)
seg.TextInfo.FontName = "Arial"
seg.TextInfo.FontSize = 9
seg.TextInfo.Color = New Aspose.Pdf.Generator.Color("Black")
seg.Content = "1"
Next

Hi John,

Thanks for sharing the details. I tried using your code to test your issue using Aspose.Pdf v6.7 but unable to find any issue with the code of line highlighted RED in your code. The complete code and resultant PDF document is attached for your reference. However, kindly visit the documentation link Create Nested Table for more details and code snippet as per your requirement.

Please feel free to contact support in case you need any further assistance.

Thanks & Regards,

It doesn’t look like I can include attachments.


I ran just the code and nothing else. Is there a limit in the evaluation license? When I run without formatting it works. When I add the defaultcellborder I get an incomplete pdf. There is no formatting and the aspose watermark and red “Evaluation” message do not appear (in other words, anything that occurs after that code does not happen).

I am really at a loss here. I am trying to update my code to 6.7 and upgrade but I can’t get anywhere on this.


When I add the defaultborders to the nested table it fails.

If I place the table in the section instead of nesting it, it works.

I meant to say that I can’t attach documents so I can’t show you the output.

Hi John,

Thank you for your feedback, I am very sorry for the inconvenience caused due to this issue. However, please find attached sample source code and resultant PDF in which DefaultCellBorder is used with nested table only. Moreover, if you are facing any Evaluation Version issue, kindly visit Purchase Information for all details about licensing, even before purchasing the license, you may also request a 30 days temporary license for evaluating the product.

Please do let us know if you need any further assistance.

Thanks & Regards,

Through hours of trial and error I did find the problem that caused all of my nested tables to fail after I upgraded. I used “FitWidth” to set the width of my columns in my code. The nesting of tables does not work unless you use myTable.ColumnWidths = (“50 50”) to set the column widths.

Hi John,

You are absolutely right, I am very sorry for the inconvenience caused due to this issue. However, I would like to share with you that "FitWidth" property has been obsolete, kindly use the "Table.ColumnWidths" property instead of "Cell.FitWidth". We are really sorry for this inconvenience.

Thanks & Regards,