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

Free Support Forum - aspose.com

Content in <TD> elements are getting wrapped in multiple lines in the converted imaged files

Hi Aspose Team,

I will be loading a html file into Aspose word document and convert this documnet into PNG files.

Load the html file into document
Aspose.Words.Document doc = new Aspose.Words.Document(@"D:\Aspose\RDP\NEWFiles\WithoutHELPAndClose.html");

Converted the loaded html file into Image files:

for (int pageCounter = 0, stop = doc.PageCount; pageCounter < stop; pageCounter++)
Aspose.Words.Saving.ImageSaveOptions options = new Aspose.Words.Saving.ImageSaveOptions(Aspose.Words.SaveFormat.Png);
options.PageIndex = pageCounter;

// images are of the format \<0-padded-page-index>.png, e.g. (somepath\myfile02.png)
@"D:\Aspose\RDP\NEWFiles\FileTD\", "", "Image", pageCounter + 1)
, options);
In the converted image files The text in

elments are shown in multiple lines.

I request you to look into this and sugegst me how to overcome this issue.

I have attached the input html file and the images generated..




Thanks for your inquiry. The problem occurs because in your input HTML document you’re nesting tr elements many times in other tr and td elements. I have removed all such occurrences from your input HTML file and attached its modified version here for your reference.

I hope, this will help.

Best Regards,

Hi Hafeez,

Thanks for look into this.

I tried with the html file you attached but , still in the converted image file.. a line in the html file is shown in multiple lines in the converted image file..

The issue I am facing is for example if you see the text "Siddi test3 what are your salary requirements"..If I open the html file..this text is shown in a single line in the browser ..But when I convert this html file to PNG files or doc file the same text is shown in multiple lines..

Can you please look into this again and let me know if any information is required..




Thanks for your inquiry. Please note that Aspose.Words was originally designed to work with MS Word documents. Upon processing HTML, some features of HTML might be lost. You can find a list of limitations upon HTML exporting/importing here:

The only work around I can suggest you is as follows:

doc = new Document(@“c:\test\in.html”);

NodeCollection tbls = doc.GetChildNodes(NodeType.Table,
foreach (Table tbl in tbls)
tbl.Alignment = TableAlignment.Left;


I hope, this will help.

Best Regards,