0

there is a picture visualizing my problem.

enter image description here

I have a table with let's say 5 columns and 5 rows. The first row and first column has a long text. The text won't fit in to the cell but I want to show the entire text in a line, spanning all the following columns. It is not a real colspan as the column-borders should still be visible. So it's more an overlay.

I am experimenting with the example "Fit text in cell" with the custom cell renderer but I don't really understand the different occupied areas, boxes and the dimensions coming with it.

Not to say that the dimension and positioning thing in iText is not really intuitive.

I appreciate any help.

Thanks.

Amedee Van Gasse
  • 7,280
  • 5
  • 55
  • 101
Sabrina
  • 3
  • 1

1 Answers1

0

So you want something like this ?

enter image description here

C# example

//Create a table with 5 columns
var table = new Table(new float[] { 3,3,3,3,3}).SetWidth(UnitValue.CreatePercentValue(100)).SetFixedLayout(); 
// Creat the cell with the long text
Cell cell = new Cell(1, 5).Add(new Paragraph("Long text that spans over the 5 Columns")); 
//Add the top row 5 cells    
table.AddCell("Column 1 text")
table.AddCell("Column 2 text")
table.AddCell("Column 3 text")
table.AddCell("Column 4 text")
table.AddCell("Column 5 text") 

//Add the long text
table.AddCell(cell);