MCPcopy Index your code
hub / github.com/python-openxml/python-docx / add_break

Method add_break

src/docx/text/run.py:38–57  ·  view source on GitHub ↗

Add a break element of `break_type` to this run. `break_type` can take the values `WD_BREAK.LINE`, `WD_BREAK.PAGE`, and `WD_BREAK.COLUMN` where `WD_BREAK` is imported from `docx.enum.text`. `break_type` defaults to `WD_BREAK.LINE`.

(self, break_type: WD_BREAK = WD_BREAK.LINE)

Source from the content-addressed store, hash-verified

36 self._r = self._element = self.element = r
37
38 def add_break(self, break_type: WD_BREAK = WD_BREAK.LINE):
39 """Add a break element of `break_type` to this run.
40
41 `break_type` can take the values `WD_BREAK.LINE`, `WD_BREAK.PAGE`, and
42 `WD_BREAK.COLUMN` where `WD_BREAK` is imported from `docx.enum.text`.
43 `break_type` defaults to `WD_BREAK.LINE`.
44 """
45 type_, clear = {
46 WD_BREAK.LINE: (None, None),
47 WD_BREAK.PAGE: ("page", None),
48 WD_BREAK.COLUMN: ("column", None),
49 WD_BREAK.LINE_CLEAR_LEFT: ("textWrapping", "left"),
50 WD_BREAK.LINE_CLEAR_RIGHT: ("textWrapping", "right"),
51 WD_BREAK.LINE_CLEAR_ALL: ("textWrapping", "all"),
52 }[break_type]
53 br = self._r.add_br()
54 if type_ is not None:
55 br.type = type_
56 if clear is not None:
57 br.clear = clear
58
59 def add_picture(
60 self,

Callers 5

it_can_add_a_breakMethod · 0.95
when_add_column_breakFunction · 0.80
when_add_line_breakFunction · 0.80
when_add_page_breakFunction · 0.80
add_page_breakMethod · 0.80

Calls

no outgoing calls

Tested by 1

it_can_add_a_breakMethod · 0.76