Official public blog of Erwan Cosnuau

16 July 2009

Merging cells, rowspand, colspan in iTextSharp PDFPCell PDFPTable

If you're using cells it's easy:
http://itextsharp.sourceforge.net/tutorial/ch05.html
example 5 (Chap0505.pdf)
it looks like this:
cell.Rowspan = 2;
cell.BorderColor = new Color(255, 0, 0);
table.addCell(cell);
table.addCell("1.1");
table.addCell("2.1");
table.addCell("1.2");
table.addCell("2.2");
table.addCell("cell test1");
cell = new Cell("big cell");
cell.Rowspan = 2;
cell.Colspan = 2;
cell.BackgroundColor = new Color(0xC0, 0xC0, 0xC0);
table.addCell(cell);

if you're using PDFPTable and PDFPCells no such things as an easy RowSpan ColSpan of course
We need to use nested tables what an horrible solution:

http://threebit.net/mail-archive/itext-questions/msg05899.html

Eample in Java: http://www.nabble.com/file/3929/RowSpanExample.java
Resulting PDF: http://www.nabble.com/file/3928/TableInCell.pdf

Have fun

Posted via email from Erwan Cosnuau Online

0 comments:

Partagez cet article

Preventes Web 2.0

Where am I ?

Donate

Money?
A gift?

Blog Archive