Package used:
pip install aspose-cells-python
Sample Excel file used for below conversions -
Sample_Excel.zip (9.9 KB)
Image conversion code –
from aspose.cells import Workbook
workbook = Workbook(“Sample_Excel.xlsx”)
workbook.save(“Sample_Excel.png”)
Output and issue – See below the attached image, the entire width of excel sheet is not exported to image.
image.png (14.9 KB)
PDF conversion code –
from aspose.cells import Workbook
workbook = Workbook(“Sample_Excel.xlsx”)
workbook.save(“Sample_Excel.pdf”)
Output and issue – See below the attached pdf, the entire width of excel sheet is not exported to pdf.
Sample_Excel.pdf (85.7 KB)
To resolve this width error we tried using ImageOrPrintOptions - but seems like it is not working in python code, getting error, even after installing the package with the above mentioned pip install command => ModuleNotFoundError: No module named ‘aspose.cells.ImageOrPrintOptions’; module ‘aspose.cells’ has no submodule ‘ImageOrPrintOptions’
HTML conversion code –
from aspose.cells import SaveFormat, Workbook
wb = Workbook(“Sample_Excel.xlsx”)
wb.save(“./Sample_Html.html”, SaveFormat.HTML)
Output and issue – See below the screenshot of html, the entire width of excel sheet is covered however, text within cell is touching the closed cell border while in excel there seem to be some padding.
image.jpg (60.0 KB)