How to get number of column count of table in Word document using .NET

Dear supporters,


I have an exist MS Word File with a table inside. I don’t know how to count a table’s number of columns. Can you help me the method to get it.

Thanks,

@danganh

Thanks for your query. Please use the following code snippet for your requirement. Hope this helps you. Please let us know if you have any more queries.

Document doc = new Document(MyDir + "TableInside.doc");
Table table = (Table)doc.GetChild(NodeType.Table, 0, true);
Console.WriteLine(table.Rows[0].Cells.Count);