Free Support Forum -

Sizing table cells to fit content

Is it possible to auto-size a table cell to fit its contents? If not, are there any plans to add that functionality? Can you suggest a decent workaround in the meantime?

Here is my scenario:

I am converting an HTML document to MS Word using the Aspose DocumentBuilder. I am not using the built-in HTML conversion capabilities because I need a more accurate conversion (full support for CSS, etc). So I use MSHTML to iterate over the HTML document and build the Aspose Document Model as I go. This approach is working great, but I don’t have a great way to translate auto-sized table cells. For example,

<table border=“1” style=width: 300px>
<td>cell 1.1 contains some longer content</td>
<td>cell 1.2</td>
<td>cell 1.4</td>
<td>cell 2.1</td>
<td>cell 2.2</td>
<td>cell 2.4</td>
<td>cell 3.1</td>
<td>cell 3.2</td>
<td>cell 3.4</td>
I am sizing the table to 300px by evenly distributing the width across the columns. However, I would like the first column to be wider and the third column to be narrower, just like it would look when viewing in a web browser.

Thanks for the help.


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

Thanks for your inquiry.

If the destination format of your document is a flow format (e.g DOC, DOCX and not PDF, Image etc) then I think the suggestions on this post here may be helpful to you.

We are currently looking into supporting fitting table cells to content. You request has been linked to the appropriate issue. We will keep you informed of any developments.

Best regards,

The issues you have found earlier (filed as WORDSNET-2044) have been fixed in this .NET update and in this Java update.

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