Visitar URL original
Insert Picture Properties and change it to Top and Bottom · Issue #1547 · python-openxml/python-docx · GitHub
Skip to content

Insert Picture Properties and change it to Top and Bottom #1547

Description

@hengley

I'm adding several pictures of different sizes. After inserting the pictures, the spacing between them and the preceding and following paragraphs is quite large. I noticed that the inserted pictures are embedded type. Is there any way to modify them to the Top and Bottom type? Thank you. Insert Picture Properties and change it to Top and Bottom

Activity

  1. scanny commented on Apr 14, 2026

    @scanny
    Contributor

    Show the code you're using to insert the pictures. Just the lines where you're actually adding the pictures.

  2. hengley commented on Apr 15, 2026

    @hengley
    Author
    image_memfile = PI.get_image_io(BytesIO())
    if image_memfile is not None:
        run = para.add_run()
        run.add_picture(image_memfile,width=Pt(415.3)) 
        image_memfile.close()

    Similar to the TextWrappingStyle class in spire-doc](https://pypi.org/project/spire-doc/)

    # spire\doc\documents\TextWrappingStyle.py
    class TextWrappingStyle(Enum):
        """
        Enum class to specify text wrapping style for an object.
        """
        # Inline text wrapping style
        Inline = 0
        # TopAndBottom text wrapping style
        TopAndBottom = 1
        # Square text wrapping style
        Square = 2
        # No text wrapping style
        InFrontOfText = 3
        # Tight text wrapping style
        Tight = 4
        # Through text wrapping style
        Through = 5
        # Behind text wrapping style
        Behind = 6
        # None
        none = -1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions