table alignment property always returns left

Sep 5, 2013 at 10:51 AM
I have a sample document with table centre aligned in the document.
When I load the document using DocX and reterive the table and try to get Table.Alignment, it returns left, even though it is centre aligned.

Please find the code sample to first create the doc using DocX and then load the same and check alignment.

1) using (var document = Novacode.DocX.Create(@"C:\TestDoc.doc"))
            {
                var int_t = document.AddTable(2, 2);
                int_t.Alignment = Novacode.Alignment.center;
                var int_t1 = document.AddTable(3, 2);
                int_t1.Alignment = Novacode.Alignment.left;
                document.InsertTable(int_t);
                document.InsertTable(int_t1);                  

                // Save this document.
                document.Save();
            } 
2) using (DocX novaDoc = Novacode.DocX.Load(@"C:\TestDoc.doc"))
            {
                var table1 = novaDoc.Tables[0];
                var table2 = novaDoc.Tables[1];
                Assert.IsTrue
                    (
                        table1.Alignment == Novacode.Alignment.center
                        && table2.Alignment == Novacode.Alignment.left,
                        "Could not manage Alignment property of a table"
                    );
            }
        }