This project has moved. For the latest updates, please go here.

How to create table properly with allignments and all

Mar 28, 2011 at 1:06 PM


I tried to create table that would be evenly distributed with columns of certain sizes, i wanted it to fill the whole width of page. I tried like like zillions combinations with AutoFit, Aligments and Width of columns and it seems that it's very random.


Table tabelaOplat = document.InsertTable(7, rowsCountAll);
// tabelaOplat.AutoFit = AutoFit.Contents;
tabelaOplat.Design = TableDesign.LightListAccent3;
//tabelaOplat.AutoFit = AutoFit.ColoumnWidth;
//tabelaOplat.Alignment =;
//tabelaOplat.Alignment =;
tabelaOplat.Rows[0].Cells[0].Paragraphs[0].InsertText("Opis", false, formattingTabelaTytul);
tabelaOplat.Rows[0].Cells[1].Paragraphs[0].InsertText("Data naliczenia", false, formattingTabelaTytul);
tabelaOplat.Rows[0].Cells[2].Paragraphs[0].InsertText("Kwota brutto", false, formattingTabelaTytul);
tabelaOplat.Rows[0].Cells[0].Paragraphs[0].Alignment = Alignment.left;
tabelaOplat.Rows[0].Cells[1].Paragraphs[0].Alignment = Alignment.left;
tabelaOplat.Rows[0].Cells[2].Paragraphs[0].Alignment = Alignment.left;
tabelaOplat.Rows[0].Cells[0].Width = 2000;
tabelaOplat.Rows[0].Cells[1].Width = 2000;
tabelaOplat.Rows[0].Cells[2].Width = 500;

Can someone tell me how to do it properly? Or maybe there's a way to make it percentage like 1st column 40%, 2nd column 40% and last column rest.

Apr 5, 2012 at 8:33 PM


Maybe this helps: