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

Aligning text within a table not working?

Oct 30, 2015 at 10:45 PM
I'm trying to create and insert a table after paragraph p. That part works fine. However, I'm trying to get the contents of the first column aligned left and the second column aligned centered. Here's my code:
Table t = p.InsertTableAfterSelf(FieldAttributes.Count, 2);
t.Alignment = Alignment.left;  // doesn't seem to do anything
for (int RowIndex = 0; RowIndex < FieldAttributes.Count; RowIndex++)
    Row CurrentRow = t.Rows[RowIndex];
    Formatting fmt = new Formatting();
    if (RowIndex == 0) fmt.Bold = true;
    CurrentRow.Cells[0].Paragraphs[0].InsertText("my text", false, fmt);
    CurrentRow.Cells[0].Paragraphs[0].Alignment = Alignment.left; // doesn't work
    CurrentRow.Cells[0].Width = 300;
    CurrentRow.Cells[1].Paragraphs[0].InsertText("my other text", false, fmt);
    CurrentRow.Cells[1].Paragraphs[0].Alignment =; // I guess this works
    CurrentRow.Cells[1].Width = 300;
Everything comes out centered!

What am I doing wrong?
Oct 30, 2015 at 11:34 PM
Edited Nov 3, 2015 at 2:56 AM
Nevermind. I figured this one out.

I needed to set
 t.Design = TableDesign.None;
after creating the table.