Hi I am trying to use autofit for a single cell but it is not working. But when I do the option of auto fit cell width it works. Can any body help ??
Hi,
Thanks for providing us template file and details.
Please try our latest version/fix: Aspose.Cells for Java v17.5.5 (attached)
I have tested your scenario/ case using the following sample code and it works fine. The output file is also attached which is fine tuned:
e.g.
Sample code:
Workbook book = new Workbook("Apple+(10).xlsx");
Worksheet sheet = book.getWorksheets().get(0);
sheet.autoFitColumns();
book.save("out1.xlsx");
If you still find any issue with v17.5.5, kindly paste your sample code with your output file, we will check it soon.
Thank you.
Hi Amzad. Thanks for replying and files. But I have one problem my project is in spring mvc. I am using maven and dependencies are present in pom.xml file. On maven repository version 17.5.5 is not available. The latest version available is 16.11.0. Can you help buddy ??
Hi,
https://releases.aspose.com/java/repo/com/aspose/aspose-cells/
Hi Amjad.
Hi,
Well, in MS Excel, auto-fit operation is based on complete row and column, you cannot implement auto-fit operation on one cell, you have to either auto-fit the complete column (cells) or complete row (cells). For your situation, I think you may autofit G column (index=6) only via Aspose.Cells APIs. It will not implement auto-fit operation to other columns in the worksheet. See the sample code for your reference:
e.g.
Sample code:
Workbook book = new Workbook("Apple+(10).xlsx");
Worksheet sheet = book.getWorksheets().get(0);
AutoFitterOptions options = new AutoFitterOptions();
sheet.autoFitColumn(6);//Autofit G column cells only.
book.save(“out1.xlsx”);
Let us know if you still have any issue or query.
Thank you.
- Cell.getWidthOfValue ()
- Cell.getHeightOfValue ()
- B3: Sample Data.
- B4: This is Sample Data.
- B5: This is Sample Data With More Text.
Hi Shakeel.