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

Free Support Forum - aspose.com

"AutoFitRows" does not work in combination with merged cells and borders

See attached sample: I create a table with merged ranges and cell borders. One cell (with blue background) has a long wrapped text, and it spans two cols.
AutoFitRows does not work for this cell.
AsposeCellsAutoFit.zip (4.5 KB)

I use the “AutoFitRows” approach which handles merged ranges:

  AutoFitterOptions afo = new AutoFitterOptions();
  afo.AutoFitMergedCellsType = AutoFitMergedCellsType.LastLine;
  _workSheet.AutoFitRows(1, 1, afo);

But it does not work here.

This seems to be related to borders - if I remove them (set variable “bolSetBorders” to false in the sample), the behavior is as expected.

Do you have any ideas? Is it an error in my sample or a bug?

Best regards

Wolfgang

@wknauf,

We reproduced the issue as you mentioned by using your sample. We found “AutoFitRows” does not work in combination with merged cells and borders.

We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): CELLSNET-53035

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

@wknauf,

This is to inform you that your issue has been resolved. The fix will be included in an upcoming release (Aspose.Cells v23.4) that we plan to release in the first half of April 2023. You will be notified when the next version is released.

Great, many thanks!

Wolfgang

@wknauf,

You are welcome.