We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

CellFormat right-aligned

Hello,
how can insert a text in cell of a table right-aligned? It is possible?
Thanks for your help.
Best regards.
Thomas

Hi
Thanks for your request. I think that you should use paragraph alignment to achieve this. For example see the following code.

// Create new document
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// Set width of cell
builder.CellFormat.Width = 200;
// Set horizontal alignment
builder.ParagraphFormat.Alignment = ParagraphAlignment.Right;
// Insert cell
builder.InsertCell();
// Insert text into the cell
builder.Write("Some text");
builder.EndRow();
builder.EndTable();
// Save document
doc.Save(@"Test095\out.doc");

Hope this helps.
Best regards.

Thanks,
but i dont use paragraphs.
Are there any alternative ways to insert text in cell of a table right-aligned.
Thanks for your help,
Thomas

Hi
Anyway you use paragraphs if you inset text into the table cell. If cell contains some text then this cell has one or more child paragraphs. Please see the following link for more information.
https://docs.aspose.com/words/net/aspose-words-document-object-model/
Best regards.