IsTextWrapped problem

If I set the IsTextWrapped property on a cell and display the spreadsheet, the text is wrapped correctly but the row is not sized to fit the text.

If you type in say “hello world. This is a test” into a cell in Excel and go to the Format Cells option, if you check the Wrap Text option and ok it, the text is wrapped and the row resized to fit the text in.

Why does the Aspose component not do this?

Dear Haydn,

Thank for your consideration.

Generally speaking, the AutoFit function is a slow function. In MS Excel, you will not find the slowness of the AutoFit. But if you want to wrap many cells, automatically calling autofix function will slow down your program.

You can set the IsTextWrapped property on many cells and call AutoFitRow once. That will speed up the program.

@Haydn,
Aspose.Excel is discontinued now and is replaced with an advanced version Aspose.Cells having support for all the latest versions of MS Excel. This new version also supports AutoFit and text wrapping using the IsTextWrapped property. You may give a try to the following sample code to achieve the same functionality.

string InputPath = dataDir + "Book1.xlsx";

// Creating a file stream containing the Excel file to be opened
FileStream fstream = new FileStream(InputPath, FileMode.Open);

// Opening the Excel file through the file stream
Workbook workbook = new Workbook(fstream);

// Accessing the first worksheet in the Excel file
Worksheet worksheet = workbook.Worksheets[0];

// Auto-fitting the 3rd row of the worksheet
worksheet.AutoFitRow(1);

// Saving the modified Excel file
workbook.Save(dataDir  + "output.xlsx");

// Closing the file stream to free all resources
fstream.Close();

For more information on opening different versions of Excel files, please follow the link below:
Line Breaks and Text Wrapping
AutoFit Rows and Columns

Download the latest version of Aspose.Cells for .NET from the following link:
Aspose.Cells for .NET (Latest Version)

You can download the latest demos here.