AutoFitRow in Aspose.Excel version

Dose AutoFitRow works in the latest version ?

In my excel file, Cell A1 has Text Control “Wrap Text” activated.

I use this code to put value and use AutoFitRow

Dim myExcel As Aspose.Excel.Excel
myExcel = New Aspose.Excel.Excel

Dim tmp As String = “Hi” & vbNewLine & “Today is” & vbNewLine & “Monday” & vbNewLine & "Bye"
tmp = Replace(tmp, vbNewLine, Chr(10), 1, -1, vbTextCompare)
tmp = Replace(tmp, Chr(13), Chr(10), 1, -1, vbTextCompare)


However in my excel file, Row 1 has’nt change the row size.
I tried also with


But without any result.

Cell A1 is a merged cell, right? In MS Excel, autofit doesn’t take effect on merged cells, so is Aspose.Excel.



Cell A1 is not a merged cell.
The only properties I have in this cell is that I have activated “Wrap text”

Hi nima,
Please download the latest hotfix and have a try.


Still some problem.
How do you calculate Row Height ?

When I have 4 row in my cell, Autofitrow method change the cell height to fit for 2 rows.

What’s the string in your cell? Could you post it here?

And if possible, could you send the file to me?



I am using Aspose.Excel Version

here is the code that I use :

Dim myExcel As Aspose.Excel.Excel, mySheet As Aspose.Excel.Worksheet

myExcel = New Aspose.Excel.Excel
mySheet = myExcel.Worksheets(“Sheet1”)

Dim tmp As String = “hej” & vbNewLine & “har” & vbNewLine & “mar” & vbNewLine & “du”
tmp = Replace(tmp, vbNewLine, Chr(10), 1, -1, vbTextCompare)
tmp = Replace(tmp, Chr(13), Chr(10), 1, -1, vbTextCompare)



I will send nima.xls and nima2.xls via email to you

Hi nima,

I got your file and found the problem. It will be fixed before the end of April. Now thanks for your patience.

Any hotfix about this bug ?

Hi nima,

Sorry for the delay. I am working on this issue but it’s really a complex problem. So you have to wait for another one week. Thanks for your patience.

Aspose.Excel is discontinued and no more under development. We have introduced a new product Aspose.Cells which covers all the features supported by legacy and latest spread sheets. You can auto fit rows and columns using this new product as well as shown in the following code snippet.

// Instantiating a Workbook object
Workbook workbook = new Workbook(dataDir + "book1.xls");

// Accessing the first worksheet in the Excel file
Worksheet worksheet = workbook.getWorksheets().get(0);

// Auto-fitting the 2nd row of the worksheet

// Auto-fitting the 1st column of the worksheet

// Saving the modified Excel file in default (that is Excel 2003) format + "AutoFitRowsandColumns_out.xls");

// Print message
System.out.println("Row and Column auto fit successfully."); 

For further details about auto fitting the rows and columns using this new product, you may visit the following link:
Autofit Rows and Columns

Latest version can be downloaded here for testing:
Aspose.Cells for .NET (Latest Version)

A complete solution containing hundreds of ready to run examples along with all the required template files can be downloaded here to test variety of features.