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

Free Support Forum - aspose.com

AutoFitRow with IsTextWrapped produce cells that are too tall

In version, if both AutoFitRow and IsTextWrapped are used the resulting cell height appears to be set to about 2 times the required height.

I will forward an example worksheet.

Hi Win,

It is a difficult task to make an accurate autofit because of the font issue. MS Excel use GDI to calculate the font size. Because Aspose.Excel is a pure manged component, we use GDI+ instead. GDI+ is much more faster than GDI in dotnet. But the GDI+ font size is really different with GDI.

Anyway, I will check this issue.

Aspose.Excel is no more available now and is replaced by Aspose.Cells which is better than the previous product in terms of performance and range of supported features. Aspose.Cells supports all the features which are provided by different versions of MS Excel. You can autofit rows and columns along with the option to set the Text Wrapping property as demonstrated in the following example:

// Instantiate a new Workbook
Workbook wb = new Workbook();

// Get the first (default) worksheet
Worksheet _worksheet = wb.Worksheets[0];

// Create a range A1:B1
Range range = _worksheet.Cells.CreateRange(0, 0, 1, 2);

// Merge the cells

// Insert value to the merged cell A1
_worksheet.Cells[0, 0].Value = "A quick brown fox jumps over the lazy dog. A quick brown fox jumps over the lazy dog....end";

// Create a style object
Aspose.Cells.Style style = _worksheet.Cells[0, 0].GetStyle();

// Set wrapping text on
style.IsTextWrapped = true;

// Apply the style to the cell
_worksheet.Cells[0, 0].SetStyle(style);

// Create an object for AutoFitterOptions
AutoFitterOptions options = new AutoFitterOptions();

// Set auto-fit for merged cells
options.AutoFitMergedCellsType = AutoFitMergedCellsType.EachLine;

// Autofit rows in the sheet(including the merged cells)

// Save the Excel file
wb.Save(outputDir + "AutofitRowsforMergedCells.xlsx");

Here is a link to an article which describes this feature in more detals:
AutoFit Rows and Columns

Following link points to the free trial version of this product:
Aspose.Cells for .NET (Latest Version)

If you want to test other features of this product, you may download a comlete executable solution here.