@purusadh
Please note that formatting is applied on a few different levels. For example, let’s consider formatting of simple text. Text in documents is represented by Run element and a Run can only be a child of a Paragraph. You can apply formatting
- to Run nodes by using Character Styles e.g. a Glyph Style .
- to the parent of those Run nodes i.e. a Paragraph node ( possibly via paragraph Styles ).
- you can also apply direct formatting to Run nodes by using Run attributes ( Font ). In this case the Run will inherit formatting of Paragraph Style, a Glyph Style and then direct formatting.
You can call Document.JoinRunsWithSameFormatting method before saving the document to joins runs with same formatting in all paragraphs of the document.
You may use HtmlSaveOptions.CssStyleSheetType as shown below to reduce inline styles. Hope this helps you.
doc.joinRunsWithSameFormatting();
HtmlSaveOptions options = new HtmlSaveOptions();
options.setPrettyFormat(true);
options.setCssStyleSheetType(CssStyleSheetType.EMBEDDED);
doc.save(MyDir + "19.9.html", options);