When converting from Word to HTML- the HTML styles are different between OS

Hi,


We have an automatic test for the feature that converts a Word document into a HTML file using Aspose Word 16.4.0, and we’ve found the CSS generated on Mac OS is different with that on Ubuntu. Could you let us know how we can get the same CSS across OS?

The snippets below are the sample codes being used for the conversion,

Document document = new Document(inputStream);

document.joinRunsWithSameFormatting();

ByteArrayOutputStream output = new ByteArrayOutputStream();

HtmlSaveOptions saveOptions = new HtmlSaveOptions(SaveFormat.HTML);

saveOptions.setEncoding(Charset.forName(“utf-8”));

saveOptions.setExportHeadersFootersMode(ExportHeadersFootersMode.NONE);

saveOptions.setExportMetafileAsRaster(true);

saveOptions.setScaleImageToShapeSize(false);

saveOptions.setImageResolution(96);

document.save(output, saveOptions);



Regards,

Feng
Hi Sascha,

Thanks for your inquiry. Aspose.Words reads fonts installed on operating system during importing or saving HTML. Please make sure that you have same fonts on both operating systems.

If you still face problem, please attach the following resources here for testing:

  • Your input Word document
  • Please attach the output Html and CSS created at Ubuntu and Mac operating systems.

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

PS: To attach these resources, please zip them and Click 'Reply' button that will bring you to the 'reply page' and there at the bottom you can include any attachments with that post by clicking the 'Add/Update' button.

Hi Tahir,


Thanks for your reply.

Could you please confirm that the fonts installed have the impact on the generated style in HTML? in other words, if the fonts are different, then the generated CSS would be different?

Regards,

Feng
Hi Feng,

Thanks for your inquiry.

Aspose.Words reads fonts installed on operating system during importing or saving HTML. So, if the fonts are different, the output CSS will be different.

Please share the requested detail in my previous post here for our reference. We will investigate the issue on our side and provide you more information.