Font size style not rendered to html for h4


#1

Hello,
We use Aspose.Word java 18.11.
We got a problem reported at the conversion of a word file to html about an incorrect font size for some lines only, and it appeared after investigations those were all “h4” tags (Heading 4 style in word). For some reason, the style is set correctly for other headers (h1, h2, h3 and h5 all seem to work fine), but for that one the font size is simply not set and so it takes the default.

Analyzing in debug mode once aspose load the file, I see the “Heading 4” style is retrieved correctly from the word file with the right font size, but the font size is lost as soon as we convert to html
Here are the options used for export to html

	final HtmlSaveOptions saveOptions = new HtmlSaveOptions(SaveFormat.HTML);
	saveOptions.setExportListLabels(ExportListLabels.AS_INLINE_TEXT);
	saveOptions.setExportTocPageNumbers(false);
	saveOptions.setEncoding(StandardCharsets.UTF_8);
	saveOptions.setExportImagesAsBase64(true);

	try (final NoBomByteArrayOutputStream bos = new NoBomByteArrayOutputStream()) {
	    	doc.save(bos, getSaveOptions(doc));
	    	return bos.toUtf8String();
	}

Here is the word file : test.DOC.zip (6.4 KB)

Here is the created html :
(as you can notice, no font-size is set on h4 tags, although it is set to 12 in the word file, and other heading do have font size set)
<div><p style="margin-top: 0pt; margin-bottom: 24pt; text-align: center; widows: 0; orphans: 0; font-size: 12pt;" data-mce-style="margin-top: 0pt; margin-bottom: 24pt; text-align: center; widows: 0; orphans: 0; font-size: 12pt;"><span style="font-family: 'Times New Roman'; font-weight: bold; text-decoration: underline;" data-mce-style="font-family: 'Times New Roman'; font-weight: bold; text-decoration: underline;">MERCHANDISE LICENSE AGREEMENT</span></p><p style="margin-top: 24pt; margin-bottom: 12pt; text-indent: 36pt; text-align: justify; font-size: 12pt;" data-mce-style="margin-top: 24pt; margin-bottom: 12pt; text-indent: 36pt; text-align: justify; font-size: 12pt;"><span style="font-family: 'Times New Roman';" data-mce-style="font-family: 'Times New Roman';">This Merchandise License Agreement (the “</span><span style="font-family: 'Times New Roman'; font-weight: bold;" data-mce-style="font-family: 'Times New Roman'; font-weight: bold;">Agreement</span><span style="font-family: 'Times New Roman';" data-mce-style="font-family: 'Times New Roman';">”) is entered into effective as of [</span><span style="font-family: 'Times New Roman'; font-weight: bold;" data-mce-style="font-family: 'Times New Roman'; font-weight: bold;">__________</span><span style="font-family: 'Times New Roman';" data-mce-style="font-family: 'Times New Roman';">] (the “</span><span style="font-family: 'Times New Roman'; font-weight: bold;" data-mce-style="font-family: 'Times New Roman'; font-weight: bold;">Effective Date</span><span style="font-family: 'Times New Roman';" data-mce-style="font-family: 'Times New Roman';">”), by and and </span><span style="font-family: 'Times New Roman'; font-weight: bold;" data-mce-style="font-family: 'Times New Roman'; font-weight: bold;">[Licensee Name, Place of Incorporation and Address]</span><span style="font-family: 'Times New Roman';" data-mce-style="font-family: 'Times New Roman';"> (“</span><span style="font-family: 'Times New Roman'; font-weight: bold;" data-mce-style="font-family: 'Times New Roman'; font-weight: bold;">Licensee</span><span style="font-family: 'Times New Roman';" data-mce-style="font-family: 'Times New Roman';">”).</span></p><p style="margin-top: 12pt; margin-bottom: 12pt; text-align: center; page-break-after: avoid; font-size: 12pt;" data-mce-style="margin-top: 12pt; margin-bottom: 12pt; text-align: center; page-break-after: avoid; font-size: 12pt;"><span style="font-family: 'Times New Roman'; font-weight: bold; text-decoration: underline;" data-mce-style="font-family: 'Times New Roman'; font-weight: bold; text-decoration: underline;">RECITALS</span></p><p style="margin-top: 12pt; margin-bottom: 12pt; text-indent: 36pt; text-align: justify; font-size: 12pt;" data-mce-style="margin-top: 12pt; margin-bottom: 12pt; text-indent: 36pt; text-align: justify; font-size: 12pt;"><span style="font-family: 'Times New Roman'; -aw-import: ignore;" data-mce-style="font-family: 'Times New Roman'; -aw-import: ignore;">&nbsp;</span></p><h2 style="margin-top: 12pt; margin-bottom: 12pt; text-indent: 36pt; text-align: justify; page-break-after: avoid; font-size: 12pt;" data-mce-style="margin-top: 12pt; margin-bottom: 12pt; text-indent: 36pt; text-align: justify; page-break-after: avoid; font-size: 12pt;"><span style="font-family: 'Times New Roman'; font-weight: normal;" data-mce-style="font-family: 'Times New Roman'; font-weight: normal;">1.1</span><span style="font: 7pt 'Times New Roman'; -aw-import: spaces;" data-mce-style="font: 7pt 'Times New Roman'; -aw-import: spaces;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="font-family: 'Times New Roman'; font-weight: normal; text-decoration: underline;" data-mce-style="font-family: 'Times New Roman'; font-weight: normal; text-decoration: underline;">Effect of Termination or Expiration</span><span style="font-family: 'Times New Roman'; font-weight: normal;" data-mce-style="font-family: 'Times New Roman'; font-weight: normal;">.</span></h2><h3 style="margin-top: 12pt; margin-bottom: 12pt; text-indent: 72pt; text-align: justify; font-size: 12pt;" data-mce-style="margin-top: 12pt; margin-bottom: 12pt; text-indent: 72pt; text-align: justify; font-size: 12pt;"><span style="font-family: 'Times New Roman'; font-weight: normal;" data-mce-style="font-family: 'Times New Roman'; font-weight: normal;">1.1.1</span><span style="font: 7pt 'Times New Roman'; -aw-import: spaces;" data-mce-style="font: 7pt 'Times New Roman'; -aw-import: spaces;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="font-family: 'Times New Roman'; font-weight: normal; -aw-import: ignore;" data-mce-style="font-family: 'Times New Roman'; font-weight: normal; -aw-import: ignore;">&nbsp;</span></h3><h4 style="margin-top: 12pt; margin-left: 72pt; margin-bottom: 12pt; text-align: justify;" data-mce-style="margin-top: 12pt; margin-left: 72pt; margin-bottom: 12pt; text-align: justify;"><span style="font-family: 'Times New Roman'; font-weight: normal;" data-mce-style="font-family: 'Times New Roman'; font-weight: normal;">1.1.1.1</span><span style="font: 7pt 'Times New Roman'; -aw-import: spaces;" data-mce-style="font: 7pt 'Times New Roman'; -aw-import: spaces;">&nbsp; </span><span style="font-family: 'Times New Roman'; font-weight: normal;" data-mce-style="font-family: 'Times New Roman'; font-weight: normal;">Licensee shall immediately pay to</span><span style="font-family: 'Times New Roman'; font-weight: normal; -aw-import: spaces;" data-mce-style="font-family: 'Times New Roman'; font-weight: normal; -aw-import: spaces;">&nbsp; </span><span style="font-family: 'Times New Roman'; font-weight: normal;" data-mce-style="font-family: 'Times New Roman'; font-weight: normal;">the difference between the amount of Royalties actually paid to</span><span style="font-family: 'Times New Roman'; font-weight: normal; -aw-import: spaces;" data-mce-style="font-family: 'Times New Roman'; font-weight: normal; -aw-import: spaces;">&nbsp; </span><span style="font-family: 'Times New Roman'; font-weight: normal;" data-mce-style="font-family: 'Times New Roman'; font-weight: normal;">during the term that the Agreement was in effect and the entire amount of the Guaranteed Minimum Royalties;</span></h4><h4 style="margin-top: 12pt; margin-left: 72pt; margin-bottom: 12pt; text-align: justify;" data-mce-style="margin-top: 12pt; margin-left: 72pt; margin-bottom: 12pt; text-align: justify;"><span style="font-family: 'Times New Roman'; font-weight: normal;" data-mce-style="font-family: 'Times New Roman'; font-weight: normal;">1.1.1.2</span><span style="font: 7pt 'Times New Roman'; -aw-import: spaces;" data-mce-style="font: 7pt 'Times New Roman'; -aw-import: spaces;">&nbsp; </span><span style="font-family: 'Times New Roman'; font-weight: normal;" data-mce-style="font-family: 'Times New Roman'; font-weight: normal;">Subject to Section (Disposition of Inventory upon Expiration or Termination), Licensee shall immediately and permanently discontinue manufacturing, selling, advertising, distributing, and using the Licensed Produc</span></h4></div>


#2

@LaMachina

Please note that Aspose.Words mimics the behavior of MS Word. The heading 4 style has font name ‘Times New Roman’ and size 12. If you convert your document to HTML using MS Word, you will get the same output.


#3

@tahir.manzoor not quite sure what you’re saying here. Yes, I want h4 to have time new roman font and size 12 like in word. Yes, it is set in word, and it is rendered correctly when converting to html through word. No, it is not set correctly when going through aspose, the html output has no font size set for h4, so it will take whatever default is above.


#4

@LaMachina

We have tested the scenario and noticed that the font size of heading 4 is not correct in output HTML. For the sake of correction, we have logged this problem in our issue tracking system as WORDSNET-18730. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.