Cannot see double underline after converting html to docx

Hi Team,

I have tried to convert html to docx.
Html document has double underlines in it as shown in this :

But, after converting it to docx, I am unable to see double underlines as show in this :test.docx (17.7 KB)

I am attaching a sample word document having double underlines in it,and code below:
Files.zip (18.0 KB)

@Melancholy In your source HTML double underline is defined as double bottom border of the text:

<span style="border-bottom:3px double black;">testabcdefg。</span>

Aspose.Words in this case mimics MS Word behavior and ignores this style attribute. If you convert your source HTML document to DOCX using MS Word you will get exactly the same result.
If you need to apply underline in your HTML that will be preserved in DOCX document after conversion, you can use text-decoration style attribute:

<span style="text-decoration:underline">test</span>

in this case,how can I support double underline?

@Melancholy Unfortunately, there is no way to apply double underline via HTML. However, you can easily achieve this via code:

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
        
builder.getFont().setUnderline(Underline.DOUBLE);
builder.write("this text has double underline");
        
doc.save("C:\\Temp\\out.docx");

maybe, is there a way you can find to support in the future? Because,this is a problem that has been bothering us for a long time.And we have already brought your license,we want to keep using this product.

please help :smile:

@Melancholy We have linked this thread to a feature request WORDSNET-23782. We will consider supporting underline style via text-decoration-style attribute. We will keep you updated and let you know one the issue is resolved.

Thank you very much

1 Like