Home/ Reference/ Layer & Shapes

layer.CreateParagraphText(left, top, right, bottom, text, lang, charset, font, size, bold, italic, underline, align)

Creates paragraph text that wraps inside a box. Requirement: top > bottom. The code uses it for the intro heading, align = 4.

Signature

layer.CreateParagraphText(left, top, right, bottom, text, lang, charset, font, size, bold, italic, underline, align)

Notes

Creates paragraph text that wraps inside a box. Requirement: top > bottom. The code uses it for the intro heading, align = 4.

Python example (runnable)

Requires pywin32. The example assumes app / doc / page / layer are already connected. See Connection & Init
Python
layer = doc.ActivePage.ActiveLayer

# CreateParagraphText(left, top, right, bottom, text, langID, charset, font, size_pt, bold, italic, underline, align)
# key point: the frame TOP y must be greater than BOTTOM y (Y points up)
body = layer.CreateParagraphText(
    100/25.4, 200/25.4,          # top-left
    200/25.4, 120/25.4,          # bottom-right
    "This paragraph wraps automatically as it fills the frame.",
    0, -1,
    "Source Han Sans Bold",
    18,                          # 18pt
    0, 0, 0,
    4                            # 4 = justified
)

body.Fill.UniformColor.RGBAssign(20, 20, 20)
print("Paragraph text created, lines: ", body.Text.Story.Lines.Count)

About this section: Layer & Shapes

Layer & Shapes — layers and shape creation.

Other entries in this section