Table of Contents
系统参数:
windows server 2012 R2, 64 位
Microsoft 2010套件。
问题描述
自从开始做网站,我就在被程序气死的边缘徘徊。
事情是这样的: 最近在开发一个项目,需要将ppt word等文件转换成pdf,在浏览器中显示。代码大概是这样的:
import sys
import comtypes.client as client
import pandas as pd
class FileConvertor:
def excel2pdf(self):
print(sys._getframe().f_code.co_name)
re = ''
try:
app = client.CreateObject("Excel.Application")
file_obj = app.Workbooks.Open(self.input_file)
file_obj.ExportAsFixedFormat(0, self.output_file)
except Exception as e:
print(e)
logger.error("error happened during excel convert to pdf: " + str(e))
re = str(e)