简体   繁体   中英

Export Excel file to pdf including Print titles

I have an invoice in an excel file that I need to convert into a pdf. The problem is, that I set some Print titles to repeat on every page but if I use my code these don't show in the pdf. How can I make them show?

This is my current code:

from win32com import client
excel = client.Dispatch(EXCEL_APP)
sheets = excel.Workbooks.Open(invoice.xlsx")
work_sheets = sheets.Worksheets[0]
work_sheets.ExportAsFixedFormat(0,invoice.pdf")
sheets.Close(True)

All help is greatly appreciated, Thank you.

You can try with this:

ip install aspose-cells

pip install -Iv jpype1==0.7.0

#Load Excel file
workbook = Workbook("Book1.xlsx")

#Convert Excel to PDF
workbook.save("xlsx-to-pdf.pdf", SaveFormat.PDF)

You can fine more information and function here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM