AppendHtml h1 font

Hi,

I am using AppendHtml() to insert html code to a paragraph and ApplyStyle() to change the font family. but  the new font setting is not applied to h1, h2... What is the proper way to change the style of such html tags? Thanks for help

3 Replies

VR Vijay Ramachandran Syncfusion Team November 27, 2017 10:19 AM UTC

Hi James,

Thank you for using Syncfusion products.

On analyzing further with the given details, we suspect that your requirement is to change the font family by applying new custom style to paragraphs which has heading style. We have prepared sample to meet this requirement, please find the sample from below link and let us know if it helps:
http://www.syncfusion.com/downloads/support/forum/134747/ze/ApplyStyle-1921677451.zip

In the above sample, we have done following things:

   1. Created new Word document with single section and paragraph.
   2. Appended the HTML text (which has heading paragraphs) to document using AppendHTML() API.
   3. Iterated all the paragraphs, which are added from HTML text.
   4. Cleared formatting for heading paragraphs and its child items.
   5. Applied the new custom style to paragraphs which has heading styles.
   6. Saved the resultant Word document.

If we misunderstood any of your requirement, then kindly elaborate the actual requirement along with detailed description. Thereby we will analyze further on the mentioned case and will provided you appropriate solution.

Regards,
Vijay R



JL James Lau November 28, 2017 03:56 AM UTC

Hi Vijay,

Thank you so much, the sample code help me sort out the problem. 

At first, I only redefine heading styles with difference font setting, then run AppendHtml() and ApplyStyle(), they won't affect the heading display.
After re-apply style "Heading 1", "Heading 2" to the imported elements, they show in different font now.


DB Dilli Babu Nandha Gopal Syncfusion Team November 28, 2017 12:38 PM UTC

Hi James, 
  
We are glad to know that your requirement has been achieved as per our suggestions. Please let us know if you need any further assistance and we will be happy to assist you as always 
  
Regards, 
Dilli babu. 


Loader.
Up arrow icon