您好,我正在尝试使用python将excel工作表转换为pdf,转换了一个编写的脚本,用于word文档,该脚本工作正常,但下面出现了此错误
Traceback (most recent call last):
File "C:/Users/alank/Python training/Exceltopdf2.py", line 13, in <module>
xlxs.SaveAs(out_file, FileFormat=xlxsFormatPDF)
OSError: exception: access violation reading 0xFFFFFFFFFFFFFFFF
感谢您的帮助,下面是脚本
import sys
import os
import comtypes.client
xlxsFormatPDF = 17
in_file = (r'C:\Users\alank\Python training\Helloworld.xlsx')
out_file = (r'C:\Users\alank\Python training\Helloworld.pdf')
excel = comtypes.client.CreateObject('Excel.Application')
xlxs = excel.workbooks.Open(in_file)
xlxs.SaveAs(out_file, FileFormat=xlxsFormatPDF)
xlxs.Close()
excel.Quit()
您可以尝试使用^{}
像这样:
或者你可以像here (Andreas solution)那样做:
相关问题 更多 >
编程相关推荐