将PDF插入Excel,Python [英] Insert PDF into Excel, Python

查看:178
本文介绍了将PDF插入Excel,Python的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写了一个python脚本,我用来创建一个spreasheet与各种计算。我想进一步将pdf插入spreadhseet(pdf是可取的,但jpeg是可用的)。我一直在翻阅xlwt,找不到任何东西。任何人都可以提出一种方法来实现这一点?

解决方案

要实际插入PDF,您可能需要使用Excel。自动化运行的Excel实例的最方便的方法可能是VBA或VBScript,但您仍然可以使用Python与 pywin32 pywinauto



如果重要的是坚持使用Python,生成 .xlsx 而不是 .xls 是可以接受的,您最好的选择是 XlsxWriter ,它可以导入JPEG或PNG(除了BMP)。以下是文档示例


I wrote a python script that I use to create a spreasheet with various calculations. I want to further insert a pdf into the spreadhseet (pdf is desireable, but a jpeg is useable). I've been flipping through xlwt and can't find anything. Can anyone suggest a way to accomplish this?

解决方案

To actually insert a PDF, you may need to just use Excel. The most convenient way to automate a running instance of Excel is probably VBA or VBScript, but you can still use Python with pywin32 or pywinauto.

If it's important to stick with Python and it's acceptable to generate .xlsx instead of .xls, your best bet is XlsxWriter, which lets you import JPEG or PNG (in addition to BMP). Here's documentation and an example for inserting images with XlsxWriter.

这篇关于将PDF插入Excel,Python的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆