We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Table formatting is not working

Hello,

I am creating a table in word document at runtime. But table's content formatting is not applied. I have applied font style, font size on table but its not applied on table.
Please guide me how to resolve this.

Sample project is attached with this.

Thanks

Attachment: DocumentGenerations_b6ae791d.zip

1 Reply

DB Dilli Babu Nandha Gopal Syncfusion Team November 14, 2018 09:50 AM UTC

Hi Muhammad, 

Thank you for contacting Syncfusion support. 

On analyzing the given sample, we found that the Replace functionality is performed with save formatting(source) due to which the table font(destination) wasn’t considered. To preserve the table font in Replace functionality, save formatting must be disabled. Please find the code example which illustrates the above behavior. 
public WordDocument FindPlaceHolderAndInsertTable(WordDocument wrd, WTable table, string placeHolderName) 
{ 
    //Add the table to the text body part. 
    TextBodyPart bodyPart = new TextBodyPart(wrd); 
    bodyPart.BodyItems.Add(table); 
 
    //Replace the place holder text with the table. 
    wrd.Replace(placeHolderName, bodyPart, true, true, false); 
 
    return wrd; 
} 

We have modified the sample which can be downloaded from following link. 

Please let us know if you have any questions. 

Regards, 
Dilli babu. 


Loader.
Live Chat Icon For mobile
Up arrow icon