Rowspan in TH elements result in odd behavior

Hi there!
I am using the Java Aspose component to convert HTML to Word (and PDF).
I’ve attached the entire html file (converted to txt for security reasons). There seems to be some rendering issues. Word vs PDF vs HTML all look different. But when chrome renders the code it looks correct. I have validated the HTML with regard to proper structure within the thead and there appears to be no problems, all opening tags have closing tags.

what it does look like in word.png is what is exported after conversion to word document.
what it does look like in pdf.png is whats exported as a PDF.
what it should look like.png is what is rendered in a browser with the same HTML

Please advise!

Thank you very much,
Doug

Hi Doug,

Thanks for your inquiry. Well, the output is much better if you just increase the page width as follows:

Document doc = new Document(MyDir + @"table+copy.html");
doc.FirstSection.PageSetup.PageWidth = 14 * 72; 
doc.Save(MyDir + @"16.1.0.docx");
doc.Save(MyDir + @"16.1.0.pdf");

Please note that it is not guaranteed that the output Word/PDF documents will look exactly the same as the input HTML file in web browsers. This is because Aspose.Words was originally designed to work with Microsoft Word documents and HTML documents are quite different. However, Aspose.Words’ HTML engine tries to mimic the way the Microsoft Word works. To you, this means that if you convert HTML file into a Microsoft Word document or PDF using Aspose.Words, the output will appear almost exactly as if it was done by Microsoft Word. Moreover, I have attached two documents generated using the above code here for your reference.

Best regards,

Thank you for the reply!

I appreciate your response, not sure if I have the option of changing the exported page width. However, I have been playing around with it, and I have found that I can set the colspan of the top row to a value thats larger than the width of the entire table, and suddenly the row span works!

I’ve attached an image, as you can see the “1. OM-3801” colspan is set to the width of the table plus one. It’s agonizingly close to what I’m after, but you can see the width is slightly wider than the next row.

Is there anyway to fix this? It’s odd that when you add a row with a wider colspan, then the rowspan attribute is correctly rendered.

Any advice would be a huge help!
Best regards,
Doug

Hi Doug,

Thanks for the additional information. Could you please also attach your expected Word document here for our reference. We will investigate the structure of your expected document as to how you want your final output be generated like. You can create expected document using Microsoft Word application.

Best regards,

Thank you for your quick responses!

I’ve attached how I’d like the table to look, basically looking to get the top row header aligned with the 2nd row header.

Hi Doug,

Thanks for your inquiry. I have attached a sample html file here for your reference. When you convert this html to Word format, you’ll see the Table output matches to what is shown in your “header row aligned.docx” file.

Best regards,