Docx to Html Hyperlink tag formatting

After formatting hyperlinks in word to remove the underline, and then converting to html with aspose.words it appears that the link style is placed inside a span tag rather than on the anchor tag. as a result, the anchor tag, by default, is underlined. generated style:

span.Hyperlink {
    font-family: Arial;
    font-size: 8pt;>
    font-weight: normal;
    text-decoration: none;
    color: #215868;
}

After formatting hyperlinks in word to remove the underline, and then converting to html with aspose.words it appears that the link style is placed inside a span tag rather than on the anchor tag. as a result, the anchor tag, by default, is underlined.
generated style:

span.Hyperlink {
    font-family: Arial;
    font-size: 8pt;
    font-weight: normal;
    text-decoration: none;
    color:#215868
}                                                                                                                                                                                                                                                                                                                           

generated html

<a style="color:#215868" href="..." target="_blank">
    Cigna Drug Coverage Policy No. 1316
</a>

Is there any way to control how the styles are applied to the output html?\

generated html

<a style="color:#215868" href="..." target="_blank">
    Cigna Drug Coverage Policy No. 1316
</a>

Is there any way to control how the styles are applied to the output html?

Hi Jake,

Thanks for your inquiry. Please note that Aspose.Words mimics the same behavior as MS Word does. If you convert your document to Html using MS Word, you will get the same output.

HtmlSaveOptions.CssStyleSheetType Property specifies how CSS (Cascading Style Sheet) styles are exported to HTML, MHTML or EPUB. Default value is Inline for HTML/MHTML.

The detail of CssStyleSheetType enumeration is as follow:

Inline CSS styles are written inline (as a value of the style attribute on every element).
Embedded CSS styles are written separately from the content in a style sheet embedded in the HTML file.
External CSS styles are written separately from the content in a style sheet in an external file. The HTML file links the style sheet.

You can workaround this issue using following code example. Hope this helps you. Please let us know if you have any more queries.

Document doc = new Document(MyDir + "in.docx");
HtmlSaveOptions opts = new HtmlSaveOptions(SaveFormat.HTML);
opts.setCssStyleSheetType(CssStyleSheetType.EXTERNAL);
opts.setCssStyleSheetFileName("myCSS.css");
doc.save(MyDir + "Out.html", opts);

PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(MyDir + "myCSS.css", true)));

out.println("");
out.println("a { text-decoration:none }");
out.close();