AutoFitRow changes worksheet standard height

Hello,

we realized that calling autofitrow changes standard height of w worksheet. Here is a snippet:

Workbook w1 = new Workbook();
System.out.println(w1.getWorksheets().get(0).getCells().getStandardHeight());
Style style = w1.getWorksheets().get(0).getCells().get("A1").getStyle();
style.setTextWrapped(true);
w1.getWorksheets().get(0).getCells().get("A1").setStyle(style);
w1.getWorksheets().get(0).getCells().get("A1").setValue("LOOOOOOOOOOOOOOOOOONG TEEEEEEEEEEXT");
w1.getWorksheets().get(0).getCells().get("A2").setValue("SOME OTHER LOOOOOOOOOOOOOOOOOONG TEEEEEEEEEEXT");
w1.getWorksheets().get(0).autoFitRow(0);
System.out.println(w1.getWorksheets().get(0).getCells().getStandardHeight());

The result would be printing:
12.75
11.25

I guess it’s not the desired behaviour to modify this property. The intention was just to modify the height of one specific row, not all of them.

@konradglayer,
I can not reproduce the issue as the result is printing as 12.75 twice. Please upgrade to latest version and share your feedback.

Yes, it’s seems to occur on the newest version, please take a look:
Screenshot 2021-07-15 at 10.53.29.png (395.4 KB)

@konradglayer,

This is strange as I also could not find the issue. I am using latest version (you may print the version number at the start too) of Aspose.Cells for Java API on Windows8, JDK1.8 in IntelliJIdea, see the screenshot on my end.
sc_shot1_enviroment_Windows8_JDK1.8_IntelliJIdea.png (35.8 KB)

What is your environment (OS, JDK version, etc.)?

Hi, tried 3 different Java versions on MacOS and 1 Linux version, all fail with what I described:

Aspose version: 21.7.0
Java version: 1.8.0_265
OS version: Mac OS X
Height before: 12.75
Height after: 11.25

Aspose version: 21.7.0
Java version: 11.0.8
OS: Mac OS X
Height before: 12.75
Height after: 11.25

Aspose version: 21.7.0
Java version: 15.0.2
OS: Mac OS X
Height before: 12.75
Height after: 11.25

Aspose version: 21.7.0
Java version: 11.0.11
OS version: Linux
Height before: 12.75
Height after: 11.25

@konradglayer,
We have observed this issue in Mac OS X and Linux whereas this issue is not there in Windows OS. This issue is logged in database for further investigation. You will be notified here once any update is ready for sharing.

This issue is logged as:
CELLSJAVA-43547 - AutoFitRow changes worksheet standard height

@konradglayer,
Please install or copy “Arial” to Mac os and linux system, then set the font with FontConfigs.SetFontFolders() or FontConfigs.SetFontFolder() methods.

Thanks, that corrected the behavior. But still the question remains - should the standardHeight (=hight of all rows without their height set individually) be modified when I only want to resize one row via autoFitRow?

Also - it seems that without that font configuration Aspose Cells modifies Workbooks in unexpected ways - are there any other steps required to make Aspose Cells work as expected?

@konradglayer,

Your concerns make sense. We have already fixed this issue. So, when you auto-fit one row only, the default row height will not be changed. We will provide you the fixed version in the next few days.

You need to install the font(s) and specify the font configurations via code at the start of your program. See the document for your reference.

Perfect, can’t wait for that release.

In the meantime we were wondering - is there a way to provide another font as an alternative for Arial? (for licensing reasons). We considered some open source font like Liberation Sans which is metric-compatible with Arial, configured it via FontConfigs.setFontSubstitutes for Arial, or configured it as default via setDefaultFontName, but it did not fix the problem with rows height - rest of rows were still changed to 11.25 as if Arial was missing.

@konradglayer,

We will evaluate it but let the new fix comes out for testing. Hopefully, we will provide the fix in the next few days. By the way, could you try some true type font (.ttf) as substitutions if that makes any difference?

Yeah, it’s exactly what I did and tried to explain - tried using Liberation Sans ttf font (attached in a zip). It’s supposed to be metric-compatible with Arial. I used setFontSubstitutes with it but it didn’t help, so wanted to ask if it should and if so then why not…

LiberationSans-Regular.ttf.zip (207.2 KB)

@konradglayer,

We have logged it and will evaluate it soon.

The issues you have found earlier (filed as CELLSJAVA-43547) have been fixed in this update. This message was posted using Bugs notification tool by johnson.shi