Home/ Reference/ Text

shape.Text.Contents

Plain text, read/write. strip() before you compare — CDR often leaves trailing spaces and your condition quietly fails.

Signature

shape.Text.Contents

Notes

Plain text, read/write. strip() before you compare — CDR often leaves trailing spaces and your condition quietly fails.

Python example (runnable)

Requires pywin32. The example assumes app / doc / page / layer are already connected. See Connection & Init
Python
shape = app.ActiveSelectionRange(1)

text_obj = shape.Text
print("Original: ", repr(text_obj.Contents))      # repr reveals stray trailing spaces

text_obj.Contents = "the replacement text"             # assigning replaces the string
print("After edit: ", text_obj.Contents)

About this section: Text

Text — artistic and paragraph text.

Other entries in this section