Free Support Forum - aspose.com

Table Properties - Automatically resize to fit contents

Hi,

If I have a long bit of Text or a hyperlink in a table cell, it pushes the table off the page ( See attached )

When I open the word document and go to table properties / options and untick "Automatically resize to fit contents" the table comes back on the screen and the text wraps.

I've tried various cell options in code but no joy. Can I set this option on the table somehow in code?

thanks,

jason

Hi

Thank you for your interest in Aspose.Words. You should specify width of cell and set FitText property to true. For example see the following code.

Document doc = new Document();

DocumentBuilder builder = new DocumentBuilder(doc);

builder.InsertCell();

builder.CellFormat.Width = 100;

builder.CellFormat.FitText = true;

builder.Write("This is some test text www.dh.gov.uk/en/Policyandguidance/Healthandsocialcaretopics/Longtermconditions/DH_4130657


And some more text….."
);

builder.EndRow();

builder.EndTable();

doc.Save(@"out.doc");

I hope that this will help you to solve your problem.

Best regards.

thanks,

At first it wasn't working for me , but then relised that my table width was wider then my document.

after adjusting the width, FitText worked fine,

thanks,

jason