insertHTML with border-bottom on a span

I’ve been trying to insert some html with insertHTML that has a separate underline color. To facilitate I want to use border-bottom but I notice that borders do not come through unless they are all the same width, style and color.

build.insertHTML("<del><div>asdf<span style="border-bottom:1px solid red;">1234</span></del>")

I read the article found here;
https://docs.aspose.com/words/java/text-features-supported-on-html-import/
which notes the underline color was planned to be supported with border-bottom. Is there any movement on that?

Are there any other workarounds (inserting a shape, etc.) that I can use to achieve the desired result?

Hi Adam,

Thanks for your inquiry.

Please note that it is not guaranteed that the output Word document will look exactly the same as the input HTML. This is because Aspose.Words was originally designed to work with Microsoft Word documents and HTML documents are quite different.

However, Aspose.Words’ HTML engine tries to mimic the way the Microsoft Word works. To you, this means that if you convert HTML file/string into a Microsoft Word document or PDF using Aspose.Words, the output will appear almost exactly as if it was done by Microsoft Word. Moreover, I have attached two Word documents (one generated by Aspose.Words 16.6.0 and the other generated by Microsoft Word 2016) here for your reference. Both outputs are identical.

If we can help you with anything else, please feel free to ask.

Best regards,

I understand that there is no guarantee here and have no expectation of such. My question though is about whether or not there is any way to support the underline color feature from word using Aspose Words to create the document.

I noted that in your documentation that you might be looking at border-bottom to facilitate this and was wondering if there was any movement on that.

All I want to do here is have some text with a different underline color on it.

Hi Adam,

Thanks for your inquiry. We have logged this requirement in our issue tracking system as WORDSNET-13999. Our product team will further look into the details of this problem and we will keep you updated on the status of this issue. We apologize for any inconvenience.

Best regards,

Hi Awais,

Any update on this item I can share with our teams here?

Regards,
Adam

Hi Adam,

Thanks for being patient. Regarding WORDSNET-13999, the fix of this issue is currently in development stage. We will inform you via this thread as soon as this issue is resolved. We apologize for any inconvenience.

Best regards,

Hi Awais,

Can you provide an update on this fix?

Thanks

Hi Adam,

The fix of this issue will be included in next Aspose.Words 16.10.0 version which will be released in the middle of October. We will inform you as soon as this version of Aspose.Words will be released.

Best regards,

The issues you have found earlier (filed as WORDSNET-13999) have been fixed in this Aspose.Words for .NET 16.10.0 update and this Aspose.Words for Java 16.10.0 update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.

We updated the Aspose to this version and are still having the problem with borders not showing up. Are we missing something? What information do you need to assist us? Can you provide an example of it working - perhaps we are applying a property or something that is resulting in it not working.

Hi Adam,
We do not treat ‘border-bottom’ as underline, because they differ in terms of rendering and interaction with other CSS properties.
In the actual CSS version, there is a way of changing the underline color. The following HTML code, for example, results in black text with red underline.

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);<
builder.InsertHtml("<style>" 
    + ".underline { color: red; text-decoration: underline }" 
    + ".text { color: initial }" 
    + "</style>" 
    + "<p><span class='underline'>Some text</span></p>");

doc.Save(MyDir + @"16.11.0-.docx");

Although this code has a significant drawback - the color must be reset on inner text elements - however, it conforms to the CSS specification and is recognized by Aspose.Words. Hope, this workaround helps.
Best regards,