Skip to content

auto_size not working #982

@xlar8or

Description

@xlar8or

Hello, I'm creating a textbox and I want it to be sized so it fits the whole text in the TextFrame. I'm doing the following code:

textbox = slide.shapes.add_textbox(0, 0, Inches(3), Inches(1))
text_frame = textbox.text_frame
text_frame.text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
text_frame.auto_size = MSO_AUTO_SIZE.SHAPE_TO_FIT_TEXT
text_frame.word_wrap = True

This is what I get:

image

If i go to the Textbox properties I have the following:

image

If I click again on the Resize shape to fit text then I get the correct behavior:

image

FYI: I don't have PowerPoint, I'm using WPS, could that contribute to the problem?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions