python-3.x - 无法使用 docx 正确放置我的图像
问题描述
这是我的代码:
from docx import Document
from docx.shared import Inches
from datetime import date
import excel2img
excel2img.export_img("test.xlsx","image2.png", "Sheet1", "G13:J22")
document = Document('filename.docx')
paragraphs = document.paragraphs
paragraph = paragraphs[0]
run = paragraph.add_run()
run.add_picture('image2.png', width=Inches(6.65), height=Inches(2.02))
document.save('new.docx')
这是我的单词输出:
问题是:如何将图像放在粗体文本上方?我不能输入小于 0paragraph = paragraphs[0]
解决方案
推荐阅读
- php - 触发 URL 每天运行两次
- rust - 带有多队列的 tokio 有时会挂起,有时会工作
- reactjs - 未设置 React 16.6.3 上下文 API contextType
- r - 如何在不丢失名称的情况下向列表中的列表添加一列?
- php - 主文件夹和子文件夹的不同命名空间
- neo4j - 如何使用 java api 获取 Neo4j 集群状态
- python - 对 POS 标签列表的字符串应用 literal_eval 会产生 ValueError
- visual-studio-code - 从 VS Code 在资源管理器中打开文件夹
- php - PHP Session 数据文件不是由您的 uid (Vagrant CentOS) 创建的
- swift - typealias 无法使用产生无法调用初始化程序错误