Hi All,
I am trying to add a table in a cell and then I am spanning the cell to 4
coulmns as required by the table. Inspite of that the nested table resided
in the first cell. Why it does not span to whole row?
The code is as below:
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import com.lowagie.text.Cell;
import com.lowagie.text.Document;
import com.lowagie.text.DocumentException;
import com.lowagie.text.PageSize;
import com.lowagie.text.Table;
import com.lowagie.text.pdf.PdfWriter;
/*
* Created on Oct 12, 2006
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
/**
* @author vislavti
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
public class VerticalText {
public static void main(String[] args) throws DocumentException {
System.out.println("Table in cells");
// step1
Document document = new Document(PageSize.A4, 50, 50, 50, 50);
try {
// step2
PdfWriter writer =
PdfWriter.getInstance(document, new
FileOutputStream("c:\\TableInCell.pdf"));
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (DocumentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
// step3
document.open();
Table table1 = new Table(4);
Cell c1 = new Cell("1");
Cell c2= new Cell("2");
Cell c3= new Cell("3");
c3.setColspan(2);
Cell c4 = new Cell("4");
Cell c5= new Cell("5");
Cell c6= new Cell("6");
Table table2=new Table(3);
table1.addCell(c1);
table1.addCell(c2);
table1.addCell(c3);
//c1.setColspan(4);
//table1.addCell(c1);
//table1.addCell(c2);
//table1.addCell(c3);
table2.addCell(c4);
table2.addCell(c5);
table2.addCell(c6);
Cell c7= new Cell(table2);
c7.setColspan(4);
table1.addCell(c7);
document.add(table1);
document.close();
}
}
The output of the above code can be seen in the attached pdf file.
http://www.nabble.com/file/3615/TableInCell.pdf TableInCell.pdf
--
View this message in context:
http://www.nabble.com/Why-does-table-resides-in-cell---tf2434132.html#a6787542
Sent from the iText - General mailing list archive at Nabble.com.
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions