Autofit row issue on Linux environment

Hi,

We are having very wired issue while doing autoFitRows using aspose api. When we run the program on windows it works fine, but the same code when we run on Linux (CentOS 5.5) it does not work means autofit row logic does not work.

One thing we have noticed is if we remove the Styling logic then it works on both the environment.

I have attached the both the excel generated via Windows and Linux, and the code to generate the excel.

Could you please look into this issue?

=================Sample Code===========================
public static void main(String[] args) {

Workbook workbook = new Workbook();

WorksheetCollection worksheets = workbook.getWorksheets();
Worksheet sheet = worksheets.get(0);

Cell cell = sheet.getCells().get(“C3”);
sheet.getCells().merge(cell.getRow(),cell.getColumn(), 1, 2);

cell.putValue(“Password Changed Logins Report”);


Style headerStyle = cell.getStyle();
headerStyle.getFont().setColor(Color.getGray());
headerStyle.getFont().setBold(true);
headerStyle.getFont().setSize(12);
headerStyle.setPattern(BackgroundType.SOLID);
headerStyle.setHorizontalAlignment(TextAlignmentType.CENTER);
headerStyle.setTextWrapped(true);


cell.setStyle(headerStyle);

sheet.getCells().setStandardWidthPixels(128);

AutoFitterOptions options = new AutoFitterOptions();
options.setAutoFitMergedCells(true);
try {
sheet.autoFitRows(cell.getRow(), cell.getRow(), options);
} catch (Exception e1) {
e1.printStackTrace();
}

try {
sheet.getWorkbook().save("/tmp/data1.xlsx");
} catch (Exception e) {
e.printStackTrace();
}

}

================================================


Thanks!
Nimesh

Hi Nimesh,


Thank you for contacting Aspose support.

We have evaluated your presented scenario on Linux Mint Rebecca against the latest version of Aspose.Cells for Java 8.3.2.4. We are unable to replicate the problem as shown in your provided snapshot. Moreover, there is no difference in the spreadsheets generated on Windows & Linux. Please check the resultant spreadsheets as attached.

Please give a try to the latest version of the API (download link shared above). In case the problem persists, please provide us your envirnoment details such as follow.

  • Operating system version (CentOS 5.5)
  • Operating system architecture
  • JDK vendor
  • JDK version

We have tried using the latest version but no luck same issue.

FYI,
we are using Aspose Cell for Java 8.3.1 version.

We have tried on following OS
==================================================================
CentOS release 6.6 (Final)
==================================================================
LSB Version: :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
Distributor ID: CentOS
Description: CentOS release 6.6 (Final)
Release: 6.6
Codename: Final

Java Info
java version "1.7.0_11"
Java™ SE Runtime Environment (build 1.7.0_11-b21)
Java HotSpot™ 64-Bit Server VM (build 23.6-b04, mixed mode)
==================================================================

==================================================================
CentOS release 5.11 (Final)
==================================================================
LSB Version: :core-4.0-amd64:core-4.0-ia32:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-ia32:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-ia32:printing-4.0-noarch
Distributor ID: CentOS
Description: CentOS release 5.11 (Final)
Release: 5.11
Codename: Final

java version "1.7.0_71"
Java™ SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot™ 64-Bit Server VM (build 24.71-b01, mixed mode)
==================================================================


Thanks!
Nimesh

Hi Nimesh,


We are sorry to know that you are still experiencing the said issue. We have retested the scenario on another flavor of Linux (Ubuntu 14). Unfortunately, we are unable to replicate the said issue. Setting up your exact environment (CentOS) will require some time, however we have started moving in that direction, and we will keep you posted with updates in this regard.

In the meanwhile, please give another try to the latest version while displaying the API version just to make sure that your project is using the upgraded API. Please also share your resultant spreadsheet (generated with 8.3.2.4) here for further analysis. Thank you.

Java

System.out.println(CellsHelper.getVersion());

Hi,

Thanks for looking into this issue, we have tried printed API version it showing 8.3.2.4, we have attached the excel generated using new aspose api version.


Just FYI,
We were able to reproduce this issue RedHat server too, we haven’t tried the linux version you have described. Actually our Integration and QA server has CentOS and RedHat server.
On RedHat server we tried only with 8.3.1 aspose api not with the 8.3.2.4 version.
================================================================
RedHatEnterpriseServer
================================================================
LSB Version: :core-4.0-amd64:core-4.0-ia32:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-ia32:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-ia32:printing-4.0-noarch
Distributor ID: RedHatEnterpriseServer
Description: Red Hat Enterprise Linux Server release 5.10 (Tikanga)
Release: 5.10
Codename: Tikanga

java version "1.7.0_11"
Java™ SE Runtime Environment (build 1.7.0_11-b21)
Java HotSpot™ 64-Bit Server VM (build 23.6-b04, mixed mode)
================================================================

Thanks!
Nimesh

Hi Nimesh,


Thank you for retesting the case. Please allow us some time to prepare the required environment (CentOS/RHEL) to reevaluate this scenario on our side. We will keep you posted with updates in this regard.

Hi Nimesh,


Thank you for your patience.

We have investigated the matter, and we think the problem you are having is due to the unavailability of the required fonts in your Linux environment. Please note, Aspose.Cells APIs require TureType fonts to be available in the environment to correctly calculate the row heights and column widths.

In order to troubleshoot this scenario further, we would request you to installed the Microsoft’s core fonts using the ttf-mscorefonts-installer. You can find details on how you can install this package in your Linux environment from this article. Once you have installed these fonts, please set the font directory using the CellsHelper.setFontDir method (at the start of your application & before creating an object of Workbook), and point to the location that contains the TTF files for Arial font.

Please let us know of your feedback in this regard.

Hi,

Thanks for looking into this issue.
It worked after installing TrueType Fonts on Linux environment.

Thanks!
Nimesh

Hi Nimesh,


Thank you for the confirmation. Please feel free to get in touch if you require any further assistance with Aspose APIs.