python pptx表格里的字体怎么调整,Python-PPTX:更改表格样式或向单元格添加边框...

本文介绍了如何使用Python库python-pptx将Pandas数据导入PowerPoint幻灯片,并调整表格样式,包括字体大小、颜色、背景色以及单元格边框。虽然默认样式无法直接更改单元格边框,但通过操作XML的方式,实现了对所有单元格边框的颜色和宽度的调整。
摘要由CSDN通过智能技术生成

I've started putting together some code to take Pandas data and put it into a PowerPoint slide. The template I'm using defaults to Medium Style 2 - Accent 1 which would be fine as changing the font and background are fairly easy, but there doesn't appear to be an implemented portion to python-pptx that allows for changing cell borders. Below is my code, open to any solution. (Altering the XML or changing the template default to populate a better style would be good options for me, but haven't found good documentation on how to do either). Medium Style 4 would be ideal for me as it has exactly the borders I'm looking for.

import pandas

import numpy

from pptx import Presentation

from pptx.util import Inches, Pt

from pptx.dml.color import RGBColor

#Template Location

tmplLoc = 'C:/Desktop/'

#Read in Template

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值