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.StartTable();
builder.InsertCell();
builder.Write(
"Plain text");
builder.InsertCell();
builder.PushFont();
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.PopFont();
builder.InsertCell();
builder.Write(
"More text");
builder.InsertCell();
builder.Write(
"123");
Table t = builder.EndTable();
t.AllowAutoFit =
true;
t.AutoFit(
AutoFitBehavior.AutoFitToWindow);
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.
cheers,
Alex
(btw. I find this forum editor a bit difficult to use, I hope the code is legible)