How to change the format (like font, fontsize, etc) of a WTableCell?

Hi,

When I set a WTableCell there are no properties available like CharacterFormat, FontName, FontSize, etc. 

Is there a way to change the format of a WTableCell like they are available for IWTextRange property CharacterFormat?



5 Replies

MR Manikandan Ravichandran Syncfusion Team February 21, 2020 01:21 PM UTC

WTable table = new WTable(document);
WTableRow tableRow = table.AddRow();
WTableCell tableCell = tableRow.AddCell();
IWTextRange textRange = tableCell.AddParagraph().AppendText("Hello World");
textRange.CharacterFormat.FontSize = 14;
  
 
 

Otherwise, if your requirement is to apply the formatting to the table cell, we suggest you use the ‘CellFormat’ property of the table cell as below.

 
WTable table = new WTable(document);
WTableRow tableRow = table.AddRow();
WTableCell tableCell = tableRow.AddCell();
tableCell.CellFormat.BackColor = Color.Gray;
  
 
 

Please refer to our UG documentation to know more about table cell formatting.
https://help.syncfusion.com/file-formats/docio/working-with-tables#apply-formatting-to-table-row-and-cell

If you think, we misunderstood your requirement, kindly share the complete runnable sample or modified sample of above along with input word document to reproduce the mentioned issue, so that we can proceed further to analyze and update you with the appropriate details. 
 

Please let us know if you have any other questions.

Regards,
Manikandan Ravichandran
 



VI Vince February 21, 2020 01:42 PM UTC

Hi,

Thanks for your reply.

My requirement is to apply the formatting to the table cell.

But as explained before there are no properties to change CharacterFormat, FontName, FontSize, etc.

Also there are no samples available to change these properties for the text in a WTableCell in https://help.syncfusion.com/file-formats/docio/working-with-tables#apply-formatting-to-table-row-and-cell





VI Vince February 24, 2020 03:26 PM UTC

Hello Manikandan.

Thanks for the reply.

Your sample was the missing link for me. Thanks!

Best regards,

Vince 


PN Preethi Nesakkan Gnanadurai Syncfusion Team February 25, 2020 06:22 AM UTC

Hi Vince, 
  
Most welcome. 
  
Regards, 
Preethi 


Loader.
Up arrow icon