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

Free Support Forum - aspose.com

Aspose Cells for Java - cannot set column width

I’m trying to set a specific column width (actually I need to set a picture into cell, but even if I remove the picture code the problem persists).
This is the code:

    final Worksheet worksheet = this.xlsBuilder.getWorksheet();
    final Cell localCell = worksheet.getCells().get(row, column);
    localCell.setValue("");
    // final int index = worksheet.getPictures().add(row, column, fileStream);
    // final Picture pic = worksheet.getPictures().get(index);
    final double width = 2.35;
    final double widthCm = 5.979;
    final double height = 1.16;
    // pic.setHeightInch(height);
    // pic.setWidthInch(width);
    final Cells cells = worksheet.getCells();

    cells.setRowHeightInch(row, height);
    cells.setColumnWidth(column, widthCm);
    cells.setColumnWidthInch(column, width);
    cells.getColumns().get(column).setWidth(widthCm);
    // cells.setStandardWidthInch(width);

Please provide a solution.
Aspose Cells version:

Release-Date: 2014-03-26
Implementation-Title: Aspose.Cells for Java
Implementation-Version: 8.0.0.0

@gheorghe,

Thanks for providing us code segment and some details.

Since you are using some older version of the product, so I am not sure about your issue. Also, we cannot evaluate your issue in older version. Neither we can fix any issue in older version (if found). The fixes are based on latest APIs set only.

We recommend you to kindly try our latest version/fix: Aspose.Cells for Java v17.10.3

If you still find the issue with v17.10.3, kindly do provide your simple JAVA program with template file(s) to reproduce the issue on our end, we will check it soon. Also provide your expected file which you could create (with your desired column’s with set) in MS Excel manually. This will help us evaluate your issue precisely and consequently figure it out soon.

PS. Please see the document on how to adjust row height and column width for your reference:
https://docs.aspose.com/display/cellsjava/Adjusting+Row+Height+and+Column+Width