MCPcopy Create free account
hub / github.com/Paper2Poster/Paper2Poster / set_shape_text

Function set_shape_text

utils/pptx_utils.py:1704–1717  ·  view source on GitHub ↗

Set or replace the text of an existing shape (commonly a textbox). :param shape: The shape (textbox) whose text needs to be updated. :param text: The new text content. :param clear_first: Whether to clear existing paragraphs before adding.

(shape, text, clear_first=True)

Source from the content-addressed store, hash-verified

1702 shape.top = new_top
1703
1704def set_shape_text(shape, text, clear_first=True):
1705 """
1706 Set or replace the text of an existing shape (commonly a textbox).
1707
1708 :param shape: The shape (textbox) whose text needs to be updated.
1709 :param text: The new text content.
1710 :param clear_first: Whether to clear existing paragraphs before adding.
1711 """
1712 text_frame = shape.text_frame
1713 text_frame.auto_size = MSO_AUTO_SIZE.NONE
1714 if clear_first:
1715 text_frame.clear()
1716 p = text_frame.add_paragraph()
1717 p.text = text
1718
1719def _set_run_font_color(run, rgb_tuple):
1720 """

Callers

nothing calls this directly

Calls 1

clearMethod · 0.45

Tested by

no test coverage detected