fix:实现配置功能,实现园长一键签名功能
This commit is contained in:
@@ -97,7 +97,15 @@ def replace_text_in_slide(prs, slide_index, placeholder, text):
|
||||
|
||||
|
||||
def replace_picture(prs, slide_index, placeholder, img_path):
|
||||
"""在指定幻灯片中替换指定占位符的图片(包含自动旋转修复)"""
|
||||
"""
|
||||
在指定幻灯片中替换指定占位符的图片(包含自动旋转修复)
|
||||
|
||||
参数:
|
||||
prs: Presentation 对象
|
||||
slide_index: 幻灯片索引 (从0开始)
|
||||
placeholder: 占位符名称 (例如 "signature")
|
||||
img_path: 图片路径
|
||||
"""
|
||||
if not os.path.exists(img_path):
|
||||
logger.warning(f"警告: 图片路径不存在 {img_path}")
|
||||
return
|
||||
@@ -129,4 +137,4 @@ def replace_picture(prs, slide_index, placeholder, img_path):
|
||||
new_shape = slide.shapes.add_picture(img_stream, left, top, width, height)
|
||||
|
||||
# 5. 恢复层级位置 (z-order)
|
||||
sp_tree.insert(target_index, new_shape._element)
|
||||
sp_tree.insert(target_index, new_shape._element)
|
||||
Reference in New Issue
Block a user