Free Support Forum -

Format of table cells without text

I have a word document with a formatted table (i.e. a small font), but without text. Using Aspose.Words I insert text into the table.

The Cell objects do contain 1 paragraph, but the cells do not have a run. This way all formatting information is lost. The inserted text is shown using standard formatting.

When I add text to the cells in the table, and replace that text with new text, formatting will work ok. However I do not like to have to add the text to the tables.

Is there a way to determine the correct formatting for the cells? Another possiblilty is to have Aspose generate a run with empty text.

I have made a small test. It fills in empty but formatted cells and the inserted text takes the cell formatting correctly:

string filename = Application.StartupPath + @"\testTable.doc";

Document doc = new Document(filename);

DocumentBuilder builder = new DocumentBuilder(doc);

Table table = doc.Sections[0].Body.Tables[0];

foreach(Row row in table.Rows)


foreach(Cell cell in row.Cells)



builder.Write("some text");



Please send us the code you are currently using to insert new text in the table.

Thank you for the fast response. Since there were no run objects in the paragraph I created a new Run object. I did not use the DocumentBuilder to create a new Run. That was my error. Using the documentBuilder to append the text the format is correct. I changed my code to use the DocumentBuilder in this case and it works.