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

Free Support Forum - aspose.com

Table Column Span not retained properly from HTML to DOC

Hi,

While converting HTML to DOC using Aspose Words for Java 10.1.0, the Table column span is not retained Properly. I have attached both the HTML and converted Document. Suggest some ideas to retain it.

Hi

Thanks for your request. I cannot reproduce the problem on my side. I use the latest version of Aspose.Words for testing. You can download the latest version from here;

http://www.aspose.com/community/files/51/.net-components/aspose.words-for-.net/category1188.aspx

Best regards,

Hi,

Thanks for your reply.Its working fine now.But met with new issue that, in my html i have two table seperated by Empty paragraphs. When i convert that to DOC, the tables are merged up.Please find the attachments.

Hello

Thanks for your request. The problem occurs because the paragraph between your tables is absolutely empty. To work this problem around, you should insert #$nbsp (non-breaking space) between your tables. Or you can try using the following code:

Document doc = new Document("C:\\Temp\\input.html");

// Get collection of tables

NodeCollection tables = doc.GetChildNodes(NodeType.Table, true);

Paragraph spliter = new Paragraph(doc);

spliter.ParagraphBreakFont.Size = 5;

// Loop through all tables

foreach (Table table in tables)

{

// Check if the next node after the tabel is another table.

// If so, insert an empty paragraph between tables.

if (table.NextSibling != null && table.NextSibling.NodeType == NodeType.Table)

table.ParentNode.InsertAfter(spliter.Clone(true), table);

}

doc.Save("C:\\Temp\\out.doc");

Best regards,

Thanks for your reply.