Free Support Forum - aspose.com

Issue in formating Cell Font

HI

I have used following code

NewTable.Rows[rowCnt].Cells[cellCnt].FirstParagraph.AppendChild((new Run(objWordDoc, detailWorkPaperValue)));

to assiging value to cell in row.

But after assign value like this i am loosing the existing font format

how can i retain my font format

am attaching my output.in output first table is template table and the second is the out table.But font formating is missing in output table

Please see me attachment

Hi Ajeesh,


Thanks for your inquiry. The first table in the document has not any Run node in last two rows. Please see the attached image file for detail. In this case, please set the font of Run node as shown in following code snippet. Hope this helps you. Please let us know if you have any more queries.

<span style=“font-size:
10.0pt;font-family:“Courier New”;color:#2B91AF;mso-no-proof:yes”>Document<span style=“font-size:10.0pt;font-family:“Courier New”;mso-no-proof:yes”> doc = new Document(MyDir

  • “AppendOutPut.docx”);<o:p></o:p>

DocumentBuilder builder = new DocumentBuilder(doc);

Table table = (Table)doc.GetChild(NodeType.Table, 0, true);

builder.MoveTo(table.LastRow.LastCell.FirstParagraph);

Aspose.Words.Font font = builder.Font;

Run run = new Run(doc, "Test");

run.Font.Name = font.Name;

run.Font.Size = font.Size;

table.LastRow.LastCell.FirstParagraph.AppendChild(run);

doc.Save(MyDir + "out.docx");