Auto fit columns for excel added as OLE in the slide not working as expected.
Cell value is “####” for the cells having number with more than 9 digit whereas it works fine for the cells having text with more length.
For numbers and text it is having different behavior as mentioned above in the excel which is added as OLE in ppt slide.
When I tried it directly in MS PowerPoint it works fine . I tried adding this (8.7 KB)
excel in a slide directly as an OLE it works fine. But via aspose it is not working.
FYI, I am using an licensed version of aspose slides.
@Team - Let me know if you have any update on this.
@mrajgopal.22,
Thank you for contacting support.
Please check your results using the latest version of Aspose.Slides if it is possible. If the issue persists, please share the following additional data and information:
- code example that reproduces the problem
- output presentation file
- OS version on which the code was executed
- JDK version in your app
- Aspose.Slides version you used
We will then check the problem ASAP.
@mrajgopal.22,
Thank you for the additional information. Somehow you saw the wrong result. Could you please share your output presentation file?
@Andrey_Potapov , please find the output file .
title_issue.zip (38.1 KB)
@mrajgopal.22,
Thank you for the output file. Unfortunately, I have not managed to reproduce the same result. We need a code example.
@Andrey_Potapov , it is difficult for us to share our code base with you and also this issue do not happen in the local , and happens only via swagger or from the browser.
We can get into a call or can send you a video if needed.
Please suggest which one you would prefer so that we can proceed further
@mrajgopal.22,
We need to reproduce the problem on our end. After that, we could do our best to find the cause of the problem and help you. Please try to provide all the required data and information.
@Andrey_Potapov , I have noticed that this issue is happening when the ppt open in protected mode , I was trying to create a standalone code with the scenario, but I was not able to set attribute to make generated ppt as readonly
I am using presentation.getProtectionManager().setReadOnlyRecommended(true); .
Can you suggest how can we make the generated file protected via programme.
thanks.
@mrajgopal.22,
That code line works fine on my end. Please describe in more detail how to reproduce and check the problem you are experiencing.
HI @Andrey_Potapov ,
I have the sample where we have a sample api which will use code similar to our codebase .
But as I said it happens when its in the read-only mode and in the code I tried using the code to make it read-only but didn’t work .
presentation.getProtectionManager().setReadOnlyRecommended(true)
Can you use the spring boot app and modify to make the generated PPT read-only.
The logic is written in the StandAloneServiceImpl class.
Once you make this change and start the app , in the browser try accessing api from the browser
- http://localhost:8080/api/export/static
if it gets generated with a Read-only banner you will see the auto-fit not working for some of the columns
Sample Project:
Please use the below files and create a sample spring-boot app.
Sample service and controllers
Project structure (14.3 KB)
@mrajgopal.22,
Unfortunately, I was still unable to reproduce the problem you encountered. Besides, the column’s autofitting for the Excel document is managed using Aspose.Cells. I’ve moved this forum thread to Aspose.Total forum. My colleagues from Aspose.Cells team will reply to you soon.
@mrajgopal.22,
I think your issue may not be with Aspose.Cells API. I separated the scenario/case regarding Aspose.Cells part to try to trace the issue. I tested using the following sample code with your template Excel file. The output XLSX, PDF and image files (attached) are fine tuned.
e.g.
Sample code:
Workbook workbook = new Workbook("f:\\files\\Untitled Report - 2022-12-27T175125.754.xlsx");
Worksheet worksheet = workbook.getWorksheets().get(0);
worksheet.autoFitColumns();
worksheet.setGridlinesVisible(false);
worksheet.getPageSetup()
.setPrintArea(worksheet.getCells().get(4, 0).getName() + ":"
+ worksheet.getCells().get(50, 9).getName());
worksheet.getPageSetup()
.setPrintArea(worksheet.getCells().get(4, 0).getName() + ":"
+ worksheet.getCells().get(25 + 1, 9).getName());
workbook.getWorksheets().setOleSize(0, 25,0, 9);
workbook.save("f:\\files\\out1.xlsx", com.aspose.cells.SaveFormat.XLSX);
workbook.save("f:\\files\\out1.pdf", SaveFormat.PDF);
ImageOrPrintOptions imageOptions = new ImageOrPrintOptions();
imageOptions.setImageType(ImageType.EMF);
imageOptions.setOnlyArea(true);
imageOptions.setOnePagePerSheet(true);
SheetRender sheetRender = new SheetRender(worksheet, imageOptions);
sheetRender.toImage(0, "f:\\files\\out1.emf");
I am using latest version/fix: Aspose.Cells for Java v22.12 (Releases | Maven). Please try it for your scenario/case if it makes any difference. Also, add relevant lines of code (as I did it above) to generate output Excel, PDF and image files to file path. Check the output files generated by Aspose.Cells for Java if you find any issue with any of the files? Also, share the output files with us. We will check it further.
files1.zip (98.6 KB)
PS. please note, auto-fit rows and columns operations require relevant fonts to installed on the machine, so you should make sure if the underlying fonts (e.g., “Arial”, etc.) are installed on your environment.