Posted by a ceTe Software moderator
Hello,
Please try adding the "Total" column to the first row and set the row span to 2. This should work for you. Below is the modified code for it.
Dim MyTable As Table2 = New Table2(0, 0, 900, 600)
MyTable.CellDefault.Align = TextAlign.Center
MyTable.CellDefault.VAlign = VAlign.Center
MyTable.Border.LineStyle = LineStyle.Solid
MyTable.Border.Width = 0.1
'' Add columns to the table
MyTable.Columns.Add(50) 'Col 1
MyTable.Columns.Add(50) 'Col 2 AND sub col 1
MyTable.Columns.Add(50) 'Col 3 AND sub col 2
MyTable.Columns.Add(50) 'Sub col 3
MyTable.Columns.Add(50) 'Sub col 4
MyTable.Columns.Add(50) 'Total
''Cells that span two rows
'' Add rows to the table and add cells to the rows
Dim rwHeader As Row2 = MyTable.Rows.Add(0, Font.HelveticaBold, 10, Grayscale.Black, Grayscale.LightGrey)
rwHeader.Cells.Add("Col 1", 1, 3)
Dim rwHeader1 As Row2 = MyTable.Rows.Add(0, Font.HelveticaBold, 10, Grayscale.Black, Grayscale.LightGrey)
rwHeader1.Cells.Add("Col 2", 2, 1)
rwHeader1.Cells.Add("Col 3", 2, 1)
rwHeader1.Cells.Add("Total", 1, 2)
Dim rwHeader2 As Row2 = MyTable.Rows.Add(0, Font.HelveticaBold, 10, Grayscale.Black, Grayscale.LightGrey)
rwHeader2.Cells.Add("sub col 1", 1, 1)
rwHeader2.Cells.Add("sub col 2", 1, 1)
rwHeader2.Cells.Add("sub col 3", 1, 1)
rwHeader2.Cells.Add("sub col 4", 1, 1)
Thanks,
ceTe Software Support Team.