Qu

docx.format_text

Builtin index · File I/O

result = docx.format_text(doc, i, [on=], [all=false], [bold=], [italic=], [underline=], [strike=], [size=], [color=], [font=])

Input: doc, i, on, all, bold, italic, underline, strike, size, color, font · Output: result

What it is

Formats existing text in body paragraph i: the first occurrence of on, every occurrence with all=true, or the whole paragraph when on is omitted. Runs are cut at the edges of the span -- even inside a hyperlink or a tracked insertion -- so the text outside keeps its formatting exactly, and only the properties given change inside it. bold=false switches an inherited bold off. size in points, color #rrggbb.

Overloads

One call shape — this function is not overloaded.

CodeInputOutputDescription
result = docx.format_text(doc, i, [on=], [all=false], [bold=], [italic=], [underline=], [strike=], [size=], [color=], [font=])
doc —not documented yet
i —Formats existing text in body paragraph i: the first occurrence of on, every occurrence with all=true, or the whole paragraph when on is omitted.
on optionalFormats existing text in body paragraph i: the first occurrence of on, every occurrence with all=true, or the whole paragraph when on is omitted.
all optional (default false)Formats existing text in body paragraph i: the first occurrence of on, every occurrence with all=true, or the whole paragraph when on is omitted.
bold optionalbold=false switches an inherited bold off.
italic optionalnot documented yet
underline optionalnot documented yet
strike optionalnot documented yet
size optionalsize in points, color #rrggbb.
color optionalsize in points, color #rrggbb.
font optionalnot documented yet
result —
Returns how many spans were formatted. *Added in v0.4.7*

Examples

No documentation example calls this form yet. The File I/O chapter is where one belongs.