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

Free Support Forum - aspose.com

Lost autoFitRow() functionality from v2.2.1.10 to v2.4.1.9

The following code example adjusts the row’s height so that the entire text could be seen in v2.2.1.10, but doesn’t resize the row in v2.4.1.9. I need this functionality working again so I can move to the newest jar file.


import java.io.IOException;
import java.io.InputStream;

import com.aspose.cells.Cell;
import com.aspose.cells.Cells;
import com.aspose.cells.FileFormatType;
import com.aspose.cells.License;
import com.aspose.cells.Style;
import com.aspose.cells.Workbook;
import com.aspose.cells.Worksheet;
import com.nielsen.powerpoint.Test;

public class Aspose
InputStream stream = null;
try {
final License licenseCells=new com.aspose.cells.License();
if(stream != null) stream.close();
} catch(Exception e) {

public void test() throws IOException
final Workbook wb = new Workbook();
final Worksheet ws = wb.getWorksheets().getActiveSheet();
final Cells cells = ws.getCells();
final Cell cell = cells.getCell(0, 0);
final Style style = cell.getStyle();

cell.setValue(“This text may be longer than the current merged cell width so let’s wrap it and change the cell’s height.”);

int mergedColWidth = 0;
for (int i=0; i<=1; i++)
mergedColWidth += cells.getColumnWidth(i);
float colWidth = cells.getColumnWidth(0);
cells.setColumnWidth(0, mergedColWidth);
cells.setColumnWidth(0, colWidth);
cells.merge(0, 0, 0, 1);

wb.save(“c:\Aspose.Test.xls”, FileFormatType.EXCEL97);

public static void main(String args[]) {
try {
Aspose aspose = new Aspose();
} catch (Exception e) {


Well, rows will not get affected by AutoFitRow when there are merged cells in them. You may check it manually in MS Excel too. Anyways, we will closely look into it and get back to you soon.

Thank you.

I understand that is how Excel works. But your software has changed functionality. Was your implementation wrong before and you’ve corrected it? If so, I’ll have to figure out a new way of formatting my cells due to your changes from the old version to this one. If you run the same code and just change the underlying Aspose jar, the cell formats are different (as seen in my attached examples).


<!–[if gte mso 10]> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman","serif";}

<![endif]–><span style=“font-size: 10pt; font-family: “SimSun”,“serif”;”>Hi,

Yes, it was a bug in the old versions. In the
new versions we have changed the logic because we need to make our generated
Excel files similar to MS Excel after all. We follow MS Excel standards.

Thank you.

Thanks for the quick reply. Now that I know it is working correctly in the newer jar versions, I have updated our code to work differently.

- Frank