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<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

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<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

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.

http://www.aspose.com/documentation/file-format-components/aspose.words-for-.net-and-java/object-model-basics.html

Best regards.