Я не могу использовать python docx для вставки изображения в виде плавающей строки над текстом

def add_float_picture(p, image_path_or_stream, width=None, height=None, pos_x=0, pos_y=0):
    """Add float picture at fixed position `pos_x` and `pos_y` to the top-left point of page.
    run = p.add_run()
    anchor = new_pic_anchor(run.part, image_path_or_stream, width, height, pos_x, pos_y)

from docx import Document
from docx.shared import Inches, Pt
from add_float_picture import add_float_picture
if __name__ == '__main__':
    document = Document()
    # add a floating picture
    p = document.add_paragraph()
    p.add_run('Hello World '*50)
    add_float_picture(p, '001.png', width=Inches(5.0), pos_x=Pt(20), pos_y=Pt(30))
    # add text
Новый участник
秉勳溫 is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
  • Пожалуйста, дайте весь код.
    1 час назад