Hello,
I’m testing Aspose for .NET libraries to check if we can use it in our application (and replace real Office apps). During my tests I’ve found that converting Word file to HTML generates different output (comparing to HTML generated from Web Page filtered in Word). For the same document Aspose generates the following HTML:
With Inline styles:
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Style-Type" content="text/css" /> <meta name="generator" content="Aspose.Words for .NET 19.6" /> <title> </title> </head> <body> <div> <p style="margin-top:0pt; margin-bottom:0pt; font-size:10pt"> <a href="A0fee689ba9d24dda9a832f4811bde09a" style="text-decoration:none"><span style="font-family:Arial; text-decoration:underline; color:#0000ff">test</span></a> </p> </div> </body> </html>
With Embeded styles:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta name="generator" content="Aspose.Words for .NET 19.6" />
<title>
</title>
<style type="text/css">
body { font-family:'Times New Roman'; font-size:10pt }
p { margin:0pt }
span.Hyperlink { text-decoration:underline; color:#0000ff }
</style>
</head>
<body>
<div>
<p>
<a href="A0fee689ba9d24dda9a832f4811bde09a" style="text-decoration:none"><span class="Hyperlink" style="font-family:Arial">test</span></a>
</p>
</div>
</body>
</html>
And Word 365 generates this one:
<html>
<head>
<meta http-equiv=Content-Type content="text/html; charset=utf-8">
<meta name=Generator content="Microsoft Word 15 (filtered)">
<style>
<!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
punctuation-wrap:simple;
text-autospace:none;
font-size:10.0pt;
font-family:"Times New Roman",serif;}
a:link, span.MsoHyperlink
{color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{color:purple;
text-decoration:underline;}
.MsoChpDefault
{font-size:10.0pt;}
@page WordSection1
{size:595.3pt 841.9pt;
margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.WordSection1
{page:WordSection1;}
-->
</style>
</head>
<body lang=NL link=blue vlink=purple>
<div class=WordSection1>
<p class=MsoNormal><span style='font-family:"Arial",sans-serif'><a
href="A0fee689ba9d24dda9a832f4811bde09a">test</a></span></p>
</div>
</body>
</html>
As far as I read in your documentation, Aspose.Word should mimic Word application behavior. So why there is such big difference between generated HTML?
For example:
- In Word there is such style definition:
Style definition
<!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
punctuation-wrap:simple;
text-autospace:none;
font-size:10.0pt;
font-family:"Times New Roman",serif;}
a:link, span.MsoHyperlink
{color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{color:purple;
text-decoration:underline;}
.MsoChpDefault
{font-size:10.0pt;}
@page WordSection1
{size:595.3pt 841.9pt;
margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.WordSection1
{page:WordSection1;}
-->
- In Word
<body>
tag has additional attributes - In Aspose
<a>
tag has inline style which sets font to text-decoration:none and inside it there is a span with text-decoration:underline. Is there a way to set<a>
style to text-decoration:underline?