Table Column Widths in HTML

Hi,
I have been testing Aspose.Words to test processing of Word documents. I have a document with a table in it, and the table cells are set to “AutoFit to Contents”. When I use Aspose.Words to add text to the table cells, and save as DOC format, the resulting document has a correctly formatted table in which the table cells have been correctly expanded to accommodate the text. However, if I save to HTML format, the table widths are wrong. This works correctly in Microsoft Word. I read through the Aspose.Words documentation, and I’m not sure if I should be using the “UpdateTableLayout” method. I have tried this, but it generates the Visual Basic error message “Run-time exception thrown : System.NullReferenceException - Object reference not set to an instance of an object.”
Please can you advise how I can get the HTML document to have table cells that are big enough to accommodate the text within them?
Thanks

Hi
Thanks for your inquiry. Could you please provide me code example that will allow seeing your problem. I will investigate this and provide you more information.
Best regards.

Hi Alexey,
OK - I think I have found the problem! I have attached a Word document that has a table with two rows and two columns. The cells on the first row have been merged into a single cell. The cells have been set to “auto-fit to contents”. The code below then uses Aspose.Words to increase the text in the second row, and save the file to both DOC and HTML format. Because text has been added, the column/cell should have automatically increased in width. This has worked correctly in the DOC format file, but not in the HTML format file.

Dim DocDir As String = "c:\temp\aspose\"
awd = New Aspose.Words.Document(DocDir + "test.doc")
awd.FirstSection.Body.Tables(0).Rows(1).Cells(0).FirstParagraph.InsertAfter(New Aspose.Words.Run(awd, " - add text to make a longer line!"), awd.FirstSection.Body.Tables(0).Rows(1).Cells(0).FirstParagraph.LastChild)
awd.Save(DocDir + "testout.doc", Aspose.Words.SaveFormat.Doc)
awd.Save(DocDir + "testout.htm", Aspose.Words.SaveFormat.Html)

Hi
Thank you for additional information. You was right, UpdatetableLayout method should work in this case. But at the moment it works not properly with this kind of tables. I created an issue # 4444 in our defect database. Please expect a reply before the next hotfix (within 2-3 weeks). We might just fix it by then or provide more information.
Best regards.

Sorry not going to fix this now. The fact that the doc.UpdateTableLayout algorithm does not always work for “merged cells” that are simply wide is an open defect #1219 already. It will be addressed in one of the future releases, no estimate at this stage.

The issues you have found earlier (filed as 4444) have been fixed in this update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.