We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Line Height causing Outlook to not render the html

I use the tool to convert docs to html to be included in an electronic newsletter.

This is the code that was generated from a doc:


Aspose.Words.236c44dd-92f0-408e-9bbc-b48b904916d8.001.jpeg" width=193 height=237>


The Line-Height:118.75% caused Outlook to not render any HTML after that point. When I removed just that part and resent it Outlook rended the code fine.

Any ideas?

Hi

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your request. Could you please attach your input document here for testing? I will check the problem on my side and provide you more information.

Best regards,

See Attached.

Hi

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for additional information. I managed to reproduce the problem on my side. Your request has been linked to the appropriate issue. You will be notified as soon as it is fixed.

But as workaround you can try using the following code before saving to HTML

Document doc = new Document(@"Test044\in.doc");

NodeCollection paragraphs = doc.GetChildNodes(NodeType.Paragraph, true);

foreach (Paragraph par in paragraphs)

par.ParagraphFormat.LineSpacingRule = LineSpacingRule.AtLeast;

doc.Save(@"Test044\in.html");

Hope this helps.

Best regards,

Hello!<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for your patience.

I have investigated the issue more thoroughly and found the cause of the problem. In your document converted to HTML line height is explicitly specified as percentage:

line-height: 118.75%

This CSS declaration is pretty valid. Line height allows percentage and it can be a floating point number. See specification for more details:

http://www.w3.org/TR/CSS2/visudet.html#propdef-line-height

http://www.w3.org/TR/CSS2/syndata.html#value-def-percentage

Microsoft Outlook seemingly treats 118.75% as 11875%, i.e. if it wasn’t a decimal separator. If you open the converted HTML with Outlook and scroll down the window you’ll see all remaining contents but with astronomical line spacing. According to CSS specification, this is an issue with Microsoft Outlook. Please note that other visual agents show this document well. I tried Microsoft Internet Explorer 8.0 and Mozilla Firefox 3.5.7.

Technically floating point number with fractional part (not integer) can occur here. I inspected the source document and found that line spacing is set internally as 285 twips for every paragraph. This can be easily seen if you convert the document to WordprocessingML 2003 format with Microsoft Word and open it as plain text. You will see line spacing rules on every paragraph as this:

Recalculating twips to lines we divide 285 by 240 and get 1.1875. This coefficient is multiplied by 100 and output as percentage to the HTML. Everything is correct.

I also noted that Microsoft Word truncates this value to 118%. (It doesn’t round to 119% but truncates just throwing away fractional part.) This idea is not very good since output is already compliant. Rounding or truncating all percentages to integers is not the case. As a workaround you can change line spacing rule for paragraphs as my colleague advised. Please let us know if you have any questions.

Regards,