How to to change the alignment of table columns content

@alexey.noskov sir i want to change the alignment of table columns content individually(Text in cells ) ,for example one table have two columns A and B, i want to set to column A content(column A cells text) as Left alignment and column B content (column B cells text)set to be right alignment how can I fix this plz help me.

@srinu12 To change alignment of table cell content you should simply change alignment of paragraphs inside the cell. For example:

Document doc = new Document(@"C:\Temp\in.docx");
Table table = doc.FirstSection.Body.Tables[0];

// Chage alignment in the first cell of the first row.
foreach (Paragraph p in table.FirstRow.FirstCell.Paragraphs)
    p.ParagraphFormat.Alignment = ParagraphAlignment.Center;

doc.Save(@"C:\Temp\out.docx");

@alexey.noskov thank you so much sir for your response, sir above code is working for first row first cell only ,also I want to change first row second cell and second row second cell and second row first cell…etc. like above code for second row is not working. how can we do for second row and third, total I have three rows and two columns.

is there any possibility to change paragraph alignment by using columns, I want to change column A of its cells paragraphs with left alignment and column B of its cells paragraphs with right alignment .

@srinu12 In MS Word tables there is no concept of column, rows in tables are independent and can contain any number of cells. In your case you should simply take the cell by index from each row in the table and change alignment of paragraph in each cell as demonstrated in the code example provided in my previous answer.