Describe the bug
Rowspan isn't applied properly, though I observe different behaviors and cannot explain them.
To Reproduce
import java.io.File;
import java.io.FileOutputStream;
import org.openpdf.text.Chunk;
import org.openpdf.text.Document;
import org.openpdf.text.PageSize;
import org.openpdf.text.pdf.PdfPCell;
import org.openpdf.text.pdf.PdfPTable;
import org.openpdf.text.pdf.PdfStream;
import org.openpdf.text.pdf.PdfWriter;
//TIP To <b>Run</b> code, press <shortcut actionId="Run"/> or
// click the <icon src="AllIcons.Actions.Execute"/> icon in the gutter.
public class Main {
static void main() throws Exception {
Document document = new Document(PageSize.A4, 10, 10, 10, 10);
File file = new File("test.pdf");
FileOutputStream fos = new FileOutputStream(file);
PdfWriter writer = PdfWriter.getInstance(document, fos);
writer.open();
writer.setFullCompression();
writer.setCompressionLevel(PdfStream.BEST_COMPRESSION);
document.open();
float width = document.getPageSize().getWidth() - 20;
float[] columns = {50f, 50f};
PdfPTable table = new PdfPTable(columns);
table.setTotalWidth(width);
table.setLockedWidth(true);
table.setHeaderRows(1);
PdfPCell cell = new PdfPCell();
cell.setRowspan(2);
cell.addElement(new Chunk("rowspanrowspanrowspanrowspanrowspanrowspanrowspanrowspanrowspanrowspanrowspanrowspanrowspanrowspanrowspan"));
table.addCell(cell);
table.addCell("row1");
table.addCell("row2");
document.add(table);
document.close();
writer.close();
fos.close();
}
}
Expected behavior
The left column should be one single cell spanning two rows.
Screenshots
From the sample code:
If the Chunk's content is reduced to a single "rowspan":
Interestingly enough, from my (unstable) non-sample code (migration from iText 9 in progress). The empty sections should be filled by the rowspan=5 cells. This also goes to prove there's no issue with colspan.
System
- OS: Win 10, WSL2
- Used font:
- OpenPDF version: 3.0.3
Your real name
Asking me this on a public form isn't really good form, and I don't understand the purpose of proving my identity. I am not a chatbot and my account's history should prove it, if that's the concern. Anyway, click my name, it'll show up on my profile.
Describe the bug
Rowspan isn't applied properly, though I observe different behaviors and cannot explain them.
To Reproduce
Expected behavior
The left column should be one single cell spanning two rows.
Screenshots
From the sample code:
If the Chunk's content is reduced to a single "rowspan":
Interestingly enough, from my (unstable) non-sample code (migration from iText 9 in progress). The empty sections should be filled by the rowspan=5 cells. This also goes to prove there's no issue with colspan.
System
Your real name
Asking me this on a public form isn't really good form, and I don't understand the purpose of proving my identity. I am not a chatbot and my account's history should prove it, if that's the concern. Anyway, click my name, it'll show up on my profile.