How to align text in table (left- center or right )?

Hello all,
i work with visual studio 2012 and c# 4.0
I’m new with aspose and i must to change all our rtf dynamic document to aspose word .
Well, that’s some work …
I have a little problem how i can align (left, center or right) some text in a table cell ?
is there a property align or anything else ?
here is it a code :
a table with one row and three cell.
first cell must be align => rigth
second cell must be align => center
thrid cell must be align => left

builder.InsertCell();
builder.Write("text align right ?");
builder.InsertCell();
builder.Write("text align center ?");
builder.InsertCell();
builder.Write("text align left ?");
//
builder.EndRow();
builder.EndTable();

thanks for your time
Christophe

Hi Christophe,

Thanks for your inquiry. Please use ParagraphFormat.Alignment property to get or set text alignment for the paragraph.

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
Table table = builder.StartTable();
// Insert a cell
builder.InsertCell();
builder.ParagraphFormat.Alignment = ParagraphAlignment.Right;
builder.Write("This is row 1 cell 1");
// Insert a cell
builder.InsertCell();
builder.ParagraphFormat.Alignment = ParagraphAlignment.Center; 
builder.Write("This is row 1 cell 2");
// Insert a cell
builder.InsertCell();
builder.ParagraphFormat.Alignment = ParagraphAlignment.Left;
builder.Write("This is row 1 cell 3");
builder.EndRow();
builder.EndTable();
doc.Save(MyDir + "Out.docx");

Hello,
thanks a lot for your code that’s exactly what i want
have a nice day and thanks for your knowledge
christophe

Hi Christophe,

Thanks for your feedback. Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.