Free Support Forum -

Padding CSS property in HTML to Word Conversion using Aspose.Words Cloud API


I am trying to convert a simple HTML with H1 tags. I want to add padding-right: 20px; to a span within H1.
While padding-right works for p tag, it doesn’t work for h1 tag

Please find attached sample HTML, converted doc and desired doc (15.6 KB)

If you look into the HTML, have created 4 sections testing different options. In Section 1 we get the desired padding by using   but that would not the desired way of doing as the padding taken up by spaces may differ based on fontname and fontsize. Ideally we would want HTML in Section 2 to convert to word as it renders in browser as that’s one of the standard ways of doing it in CSS/HTML

Can you please look into this and share the best approach to get the desired result using CSS/HTML



Thanks for your inquiry. We have noticed the issue and logged a ticket WORDSCLOUD-720 in our issue tracking system for further investigation and resolution. We will notify you as soon as it is resolved.

Hi Tilal,

Any update on this?



I am afraid your reported issue is still not resolved. Please note we have performed initial investigation and noticed that issue is inherited from underlying lib, Aspose.Words for .NET. So at first place the issue will be fixed in the Aspose.Words for .NET and later it will be ported into the Cloud API. We will notify you as soon as we made some significant progress towards issue resolution.


Thanks for your patience. I am afraid we have closed the issue as "Not a Bug". Aspose.Words tries to mimic MS Word as close as possible.

Please note Aspose.Words ignores padding of inline-level HTML elements (like span ) on import, because in the MS Word document model inline-level elements can’t have any padding. It is a limitation of the DOCX format.

As for block-level elements, Aspose.Words converts their horizontal padding to indent on import. That’s why “padding-right works for p tag”. We may support inline-level padding in the future, when it is introduced in future versions of MS Word.