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

Free Support Forum - aspose.com

Table.Autofit() computes including hyperlink's URL

Hi there,
I found an annoying behaviour (which I think should be considered a bug). If a table contains hyperlinks, the Table.AutoFit() apparently calculates the required width of the cell including the hyperlink’s URL. The display text is short, but the URL is quite long (like 175 chars). The cell with the URL is very wide, see attached.
I would appreciate a quick fix for this, as we need to deliver the product this week.

Hi Alex,

Thanks for your inquiry. Could you please attach your input document here for testing? I will investigate the issue on my side and provide you more information.

Best Regards,

Hi Awais,
I cannot send you the documents, it contains sensitive data. But with the following code it is easily reproduced:

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.Write("Plain text");
builder.Font.Underline = Underline.Single;
builder.Font.Color = Color.Blue;
builder.InsertHyperlink("Link", "http://www.aspose.com/a/very/long/hyperlink/to/demonstrate/a/bug/in/Table/AutoFit", true);
builder.Write("More text");
Table t = builder.EndTable();
t.AllowAutoFit = true;
doc.Save("C:\\table.docx", SaveFormat.Docx);
doc.Save("C:\\table.pdf", SaveFormat.Pdf);

I now see that saving into Word causes no problem (maybe Word recalculates correctly?) but saving in Pdf does cause the problem.
(btw. I find this forum editor a bit difficult to use, I hope the code is legible)

Hi Alex,

Thanks for this additional information. We are aware of this issue and are currently looking into fixing it. Your request has been linked to the appropriate issue. We will inform you as soon as it’s resolved.


Hi Adam,
thinking about how your code will compute spatial requirements, it might be broader, i.e. for fields in general it should only take runs that are visible in the document surface.
I would really appreciate if you give this issue a high priority!

Hi Alex,
Thanks for your request. Unfortunately, the issue is still unresolved. As I can see analysis of this issue is completed, so I think it will be fixed soon. We will let you know once the issue is resolved.
Best regards,

There is another issue, I just found: AutoFit - ToWindow sometimes overflows the table far beyond the edge of the page. It seems to be the case if there is a lot of text in many cells in different columns. Perhaps something you might fix in the same go? :slight_smile:

Hi Alex,

Thanks for your inquiry.

Could you please attach your sample document which demonstrates this issue here for testing?


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

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