python - 控制ROUNDED_RECTANGLE的圆角,python + pptx
问题描述
在幻灯片上添加 ROUNDED_RECTANGLE 时,通过使用 pptx,我有下面的行并生成了一张幻灯片。
from pptx import Presentation
from pptx.enum.shapes import MSO_SHAPE
from pptx.util import Inches
prs = Presentation()
title_only_slide_layout = prs.slide_layouts[0]
slide = prs.slides.add_slide(title_only_slide_layout)
shapes = slide.shapes
shape = shapes.add_shape(MSO_SHAPE.ROUNDED_RECTANGLE, Inches(1), Inches(0.5), Inches(8), Inches(2))
prs.save('c:\\PPT\\round rectangle.pptx')
如果是手动的,可以调整圆角(红色箭头指向的地方)。
有没有办法从脚本中控制它?谢谢你。
解决方案
像这样的形状有一个或多个 .Adjustments 属性。
你需要修改 .Adjustments(1) ,我记得它可以取 0 到 1 之间的值。例如,值 0.5 会将黄色调整菱形移动 0.5,即角与形状中点之间的距离。
推荐阅读
- ios - iOS Auto Renewable Subscription 最低功能和 StoreKit 之外的免费试用
- algorithm - 桶排序与归并排序相结合的可能性
- laravel-6 - 自定义电子邮件验证 getFromJson 不存在
- java - 私有嵌套类是否是静态的有关系吗?
- javascript - 如何使用 Discord API 代表用户添加对消息的反应?
- mysql - 连接数据库时出现多个错误-python3.7
- javascript - 当我尝试将包含与 EJS 文件一起使用时,编译失败。(错误:子编译失败。)
- xamarin.forms - HybridWebView 充当整页浏览器
- python-3.x - 日期时间模块,时间
- c# - 从公历转换为波斯历不起作用