We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Preserve Bold Formatting of H1 Tag during Converting DOCX to HTML using C# .NET API


We are converting docx into HTML.
We upgrade our Aspose version to 19.3, after the upgrade we see the spans under h1 tag losing the font weight/style which means its no longer bold.

Previous behavior
h1 style=“margin-top:18pt; margin-bottom:6pt; page-break-before:always; page-break-after:avoid; font-size:11pt” section_id=“30393699_head_1”>
span style=“font-family:Arial;font-size:13pt;font-weight:bold;font-style:normal”>1
span style=“font-family:Arial”>
span style=“ont-family:Arial;font-size:13pt;font-weight:bold;”>Scope
span style="-aw-bookmark-end:_Toc508613804">


Current behavior
h1 style=“margin-top:18pt; margin-bottom:6pt; page-break-before:always; page-break-after:avoid; font-size:11pt” section_id=“30393699_head_1”>
span style=“font-family:Arial”>1
span style=“font-family:Arial”>
span style=“font-family:Arial”>Scope
span style="-aw-bookmark-end:_Toc508613804">


Why is the change in behavior, we are losing the formatting due to upgrade. Please let us know if this can be corrected or if there is anything we can do to get it working as before.



To ensure a timely and accurate response, please ZIP and attach the following resources here for testing:

  • Your simplified input Word document
  • Aspose.Words 19.10 generated output HTML file showing the undesired behavior
  • Your expected HTML file showing the desired output. You can create it by using old version of Aspose.Words.
  • Please also create a standalone simple console application (source code without compilation errors) that helps us to reproduce your current problem on our end and attach it here for testing. Please do not include Aspose.Words DLL files in it to reduce the file size.

As soon as you get these pieces of information ready, we will start investigation into your issue and provide you more information. Thanks for your cooperation.


Please find the simplified input word document, Console Application and the output HTML files generated using old and new Aspose DLLs.

Please follow the below steps to run the Console Application:

  • Place the input word document in the C:\AsposeConsoleApplication\Process\DraftWatchFolder\ISO folder
  • Run the Console Application.
  • The HTML output file will be generated in the C:\AsposeConsoleApplication\Process\DraftStagingFolder\ISO folder.

AsposeConsoleApplication.zip (4.6 MB)
Files.zip (15.5 KB)

Thanks in Advance.


We tested the scenario and have managed to reproduce the same problem on our end. For the sake of correction, we have logged this problem in our issue tracking system. The ID of this issue is WORDSNET-19539. We will further look into the details of this problem and will keep you updated on the status of correction. We apologize for your inconvenience.


Regarding WORDSNET-19539, it is to update you that we do not export “font-weight:bold” on spans that are children of a <h1> element, because <h1> has “font-weight:bold” applied by default, which is inherited by all child nodes. As a result, both the “desired” and “undesired” HTML documents provided by you look the same in web browsers.

Can you please also provide more infomration as to how you use the resulting documents so that the text of <h1> gets non-bold. Do you view them with non-default user agent CSS styles?

We are embedding this HTML generated from aspose into our application and we have local styling as for all h tags in our application.

For "<H1 " and all the rest of h tags the font weight is set as 400. We were relying on the h1 style from the HTML generated by aspose to guide us on this particular h1 or spans, rest of the application we will manage as per our requirement of the website design. If we apply this on all H1 then it will break our website page as everything which is H1 will be bold and we will lose our styling.

It was working in older version because local span which requires bold was having style and it was automatically handled.


Thanks for the additional information. We have logged these details in our issue tracking system and will keep you posted on any further updates.