How to create table properly with allignments and all

Developer
Mar 28, 2011 at 12: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 = Alignment.center;
//tabelaOplat.Alignment = Alignment.center;
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 7:33 PM

Hi,

Maybe this helps:

http://docx.codeplex.com/discussions/351361

Roger