python docx 图片 居左_如何在word文件(.docx)python中将两张图片放在同一级别

我想把标志和条形码放在同一水平,而不是一个在上面其他。那个logo应该留在最左边,条形码在单词的最右边文件。这里是我的代码,谢谢:import uuid

import pandas as pd

import pyqrcode

from docx import Document

from docx.shared import Inches

qr=pyqrcode.create(str(uuid.uuid4()).replace('-',''))

qr.png('somecode.png')

df=pd.DataFrame(pd.read_excel('Komplette-

GastAccountFHZugangsdatenFertig.xlsx'))

Attributes=['Name', 'Vorname ', 'Geschlecht', 'Adresse (in Marokko)',

'Telefonnummer', 'E-Mailadresse', 'Studiengang', 'Semester']

document = Document()

document.add_heading('Informationen.',level=0)

document.add_picture('Informatik_Logo.png',height=Inches(1.0))

p = document.add_paragraph()

r = p.add_run()

p_format=p.paragraph_format

p_format.left_indent=Inches(4.5)

r.add_picture('somecode.png',width=Inches(1.0))

table=document.add_table(len(Attributes),2,style='LightGrid-Accent1')

for i in range(len(Attributes)):

row=table.rows[i]

row.cells[0].text=Attributes[i]

Infos=df[Attributes[i]]

string=str(Infos[49])

row.cells[1].text=string

document.save('sample.docx')

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值