Any updates on this please?
Please note when you render image from Excel spreadsheet, only the first page would be rendered. For your needs, you may render all the pages from the Excel sheet.
For your issues:
1). If you could take the print preview of the sheet in MS Excel, you will notice that there are 20 pages and not all columns would be rendered on the page. Aspose.Cells would work the same way as per the print preview of the sheet (MS Excel) when rendering to images or PDF. For your requirements, you may try to use all_columns_in_one_page_per_sheet Boolean option. You may try the following sample code:
import aspose.cells
from aspose.cells.drawing import ImageType
from aspose.cells.rendering import ImageOrPrintOptions, SheetRender
from aspose.cells import Workbook, WorksheetCollection, Worksheet, Cells, CellsHelper, License, PdfSaveOptions, HtmlSaveOptions, SaveFormat, PageSetup, HtmlHiddenColDisplayType, HtmlHiddenRowDisplayType
....
workbook = Workbook("e:\\test2\\Sample_Excel.xlsx")
sheet = workbook.worksheets[0]
options = ImageOrPrintOptions()
options.horizontal_resolution = 200
options.vertical_resolution = 200
options.image_type = ImageType.PNG
options.all_columns_in_one_page_per_sheet=True
# Sheet2Image By Page conversion
sr = SheetRender(sheet, options)
for j in range(sr.page_count):
sr.to_image(j, "e:\\test2\\outPage_" + str(j + 1) + ".png")
2). Please try the following sample code:
import aspose.cells
from aspose.cells import Workbook, WorksheetCollection, Worksheet, Cells, CellsHelper, License, PdfSaveOptions, HtmlSaveOptions, SaveFormat, PageSetup, HtmlHiddenColDisplayType, HtmlHiddenRowDisplayType
....
workbook = Workbook("e:\\test2\\Sample_Excel.xlsx")
pdfSaveOptions = PdfSaveOptions()
pdfSaveOptions.all_columns_in_one_page_per_sheet = True
workbook.save("e:\\test2\\Sample_Excel1.pdf", pdfSaveOptions)
3). Your screenshot does not match with the Excel file you provided. Please provide your input Excel file that you are converting to HTML via Aspose.Cells for Python via .NET. We will check your issue soon.
Thanks for the response.
As per the changes you mentioned, with that image and pdf part - is working fine, thanks!
We wanted to have the content on a single page. So additionally, we used this - options.one_page_per_sheet=True
For HTML part, please consider this updated screenshot:
Screenshot 2025-06-24 192948.png (94.9 KB)
Issue - Text within cell is touching the cell border while in excel there seem to be some padding.
Attaching sample excel again -
Sample_Excel.zip (9.9 KB)
It’s good to hear that the suggested code snippets are effective for converting your sheet to an image and for converting Excel to PDF.
I opened your template Excel file in MS Excel and observed a similar display/view as the HTML output rendered by Aspose.Cells for Python via .NET. Refer to the screenshot for details.
sc_shot_MS_Excel.jpg (625.8 KB)
Text within cell is touching the cell border in the generated HTML, while in excel there seem to be some padding
HTML: data is touching the cell border
Screenshot 2025-06-24 192948.png (94.9 KB)
Orignal Excel: there is some padding and data is not touching the cell border
image.png (7.7 KB)
Issue - Text within cell is touching the cell border while in excel there seem to be some padding
And one more thing,
although it pdf and image part is working correclty, getting warning for aspose.cells.drawing and aspose.cells.rendering
image.png (3.3 KB)
warnings:
Import “aspose.cells.drawing” could not be resolved from source
Import “aspose.cells.rendering” could not be resolved from source
I tried installing aspose-cells as well, still the same warning is there. Any suggestion on this as well please.
Thanks for the screenshots.
I noticed this issue what you have talked about. But when I tested your scenario/case in MS Excel manually, I got the same results. Please open the Excel file into MS Excel and save it as “Web Page”. Now open the HTML file and you will find almost same display. Aspose.Cells follows MS Excel standards/specifications when reading/parsing or rendering HTMLs, so it is not an issue.
Yes, I notice this behavior. You may simply ignore this, it won’t do anything bad. And, we will look into it in details and get back to you with info.
Okay, got it. Thanks for your help.
@NehaPawar
If you run your code using PyCharm, the warnings will not appear.
Pycharm-noWarnnings.png (6.0 KB)
However, if you use Visual Studio Code, the issue you mentioned does occur. Regarding this problem, we have created a ticket (CELLSPYTHONNET-289).
Issue ID(s): CELLSPYTHONNET-289
For now, if you want to avoid the warnings, you can use PyCharm as your IDE.
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.
Okay, sure will check this. Thanks!
You may try using PyCharm integrated development environment (IDE) for Python programming for the time being. And, we will be looking into the issue for Visual Studio code and try to fix it soon (if possible). Once we have an update on it, we will let you know here.
Sure, will try.
Thanks for all the support. A few more things I wanted to ask.
1. Execution time:
For the conversion of excel file mentioned earlier, it is taking time as:
excel to image → around 5 seconds
excel to pdf → around 2 seconds.
It includes just reading the file and then converting it to the required format, as mentioned in the earlier code. Is this the expected performance for these conversions? Or are there any recommended ways to optimize or speed up the conversion process?
2. Usage of Aspose.cells library in Lambda:
We are building an API (in python) using AWS Lambda and AWS API Gateway. And we want to use Aspose.cells for file conversion within the Lambda function.
Can you please guide us on:
- How to integrate and use Aspose.cells for python in an AWS Lambda environment?
- How to apply a temporary or permanent license in this setup?
- Are there any best practices or limitations we should be aware of when deploying Aspose in a serverless (Lambda) environment?
- If available, can you please share any official documentation or sample code related to this?
Thanks!
For the performance of rendering the template file to image or pdf, we will investigate it further to check whether there are some optimization can be made to improve it a bit.
For using the component in Lambda, there are some relevant topics:
How to Run Aspose.Cells in AWS Lambda|Documentation
How to Run Aspose.Cells for python via .NET in Docker|Documentation
We will investigate further to see whether we can provide some more specific information/documents about this topic for you and give feedback soon.
1). I tested your scenario/case with Aspose.Cells for Python via .NET v25.6 using your template Excel file and with the following sample code, it works instantly and it took 1 second for sheet to image(s). It took less than 1 second (.4 second) for Excel to PDF conversion.
Sheet to image(s):
# Record the start time
start_time = time.time()
print(start_time)
workbook = Workbook("e:\\test2\\Sample_Excel.xlsx")
sheet = workbook.worksheets[0]
options = ImageOrPrintOptions()
options.horizontal_resolution = 200
options.vertical_resolution = 200
options.image_type = ImageType.PNG
options.all_columns_in_one_page_per_sheet=True
# Sheet2Image By Page conversion
sr = SheetRender(sheet, options)
for j in range(sr.page_count):
sr.to_image(j, "e:\\test2\\outputImage_" + str(j + 1) + ".png")
# Record the end time
end_time = time.time()
# Calculate the elapsed time
elapsed_time = end_time - start_time
print(f"The operation took {elapsed_time:.4f} seconds.")
Excel to PDF:
# Record the start time
start_time = time.time()
print(start_time)
workbook = Workbook("e:\\test2\\Sample_Excel.xlsx")
pdfSaveOptions = PdfSaveOptions()
pdfSaveOptions.all_columns_in_one_page_per_sheet = True
workbook.save("e:\\test2\\out1.pdf", pdfSaveOptions)
# Record the end time
end_time = time.time()
# Calculate the elapsed time
elapsed_time = end_time - start_time
print(f"The operation took {elapsed_time:.4f} seconds.")
So, I got better and expected results regarding performance.
Hi @johnson.shi
Thanks for the links. But whatever links you have provided, those are for .net it seems.
Can you please provide me information on:
- How to integrate and use Aspose.cells for python in an AWS Lambda environment?
- How to apply a temporary or permanent license in this setup?
- Pease check Python | Tutorials, APIs, SDKs, Docs | AWS Developer Center
We will try to install Python product in an AWS Lambda environment later. - Licensing|Documentation
Hi All,
We tried to deploy the code in AWS lambda. Locally, it was working. But after deploying to lambda, we are getting this issue:
Process terminated. Couldn’t find a valid ICU package installed on the system. Set the configuration flag System.Globalization.Invariant to true if you want to run with no globalization support.
Any suggestion on this please?
Thanks!
The error indicates that Aspose.Cells for Python via .NET might rely on .NET globalization features, specifically ICU (International Components for Unicode), which are not available in your minimal AWS Lambda environment.
Could you please enable Invariant Globalization Mode it works fine. You can configure your Lambda function to run .NET in Invariant Mode by setting an environment variable, e.g., in your AWS Lambda configuration:
DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=true
You may also bundle the ICU libraries in your deployment package and ensure .NET can find them.
Hi @amjad.sahi
Yeah we tried to set this flag to true - DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=true in the code itself at the start.
After that, was able to read the excel file but then encountered an error while saving it as PDF using aspose on this line:
workbook.save(pdf_bytes, pdfSaveOptions)
Error after using DOTNET_SYSTEM_GLOBALIZATION_INVARIANT - just for the reference:
[ERROR] RuntimeError: Proxy error(CellsException): The type initializer for ‘’ threw an exception.
Traceback (most recent call last):
File “/var/task/VBCSwiftReportsGenerator.py”, line 113, in lambda_handler
workbook.save(pdf_bytes, pdfSaveOptions)
And our code is in python and deployed on lambda, so do you have any idea on how to bundle the ICU libraries in this scenario?
It’s good to hear that you’re able to read the Excel file successfully. When Aspose.Cells saves as PDF, it utilizes system fonts, globalization features (ICU), and GDI+/Skia rendering, which may require native .so
libraries. Since you’re working with Lambda + Python rather than a Docker container, you might consider the following steps to try:
- Manually download and include ICU libraries.
- Update the
LD_LIBRARY_PATH
environment variable. - Add fontconfig and relevant fonts for proper PDF rendering.
We’ll further review the specifics and may follow up with additional details.
@NehaPawar
Based on your first error message, “Couldn’t find a valid ICU package…”, we believe that you still need to install the appropriate ICU version in your environment. Although setting "DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=true"
can be used in scenarios where ICU is definitely not required, the garbled characters in your second error (‘’
) suggest that ICU is indeed needed.
Therefore, you should install a specific version of ICU — note that it must be lower than version 71. You can refer to the example of installing ICU in Docker and the Note section in the Docs for more details.