简体   繁体   English

将 Excel 文件导出到 pdf 包括打印标题

[英]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?我在 excel 文件中有一张发票,我需要将其转换为 pdf。问题是,我将一些打印标题设置为在每一页上重复,但如果我使用我的代码,这些不会显示在 pdf 中。我怎么能让他们表演?

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您可以在此处获取更多信息和 function

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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