Write Modify Paragraph Text Flow
Specify hyphenation and pagination options.
The ooodev.format.writer.modify.para.text_flow.Breaks
, ooodev.format.writer.modify.para.text_flow.FlowOptions
and ooodev.format.writer.modify.para.text_flow.Hyphenation
classes is used to set the paragraph text flow.
Default Paragraph Text Flow Style Dialog

Fig. 1103 Writer dialog Paragraph Text Flow default
Setup
General function used to run these examples.
from ooodev.format.writer.modify.para.text_flow import Breaks, FlowOptions, Hyphenation
from ooodev.format.writer.modify.para.text_flow import StyleParaKind, BreakType
from ooodev.office.write import Write
from ooodev.gui import GUI
from ooodev.loader.lo import Lo
def main() -> int:
with Lo.Loader(Lo.ConnectPipe()):
doc = Write.create_doc()
GUI.set_visible(doc=doc)
Lo.delay(300)
GUI.zoom(GUI.ZoomEnum.ZOOM_150_PERCENT)
para_hy_style = Hyphenation(
auto=True, start_chars=3, end_chars=3, style_name=StyleParaKind.STANDARD
)
para_hy_style.apply(doc)
style_obj = Hyphenation.from_style(doc=doc, style_name=StyleParaKind.STANDARD)
assert style_obj.prop_style_name == str(StyleParaKind.STANDARD)
Lo.delay(1_000)
Lo.close_doc(doc)
return 0
if __name__ == "__main__":
SystemExit(main())
Hyphenation Class
Setting Hyphenation
# ... other code
para_hy_style = Hyphenation(
auto=True, start_chars=3, end_chars=3, style_name=StyleParaKind.STANDARD
)
para_hy_style.apply(doc)
Style results.

Fig. 1104 Writer dialog Paragraph Text Flow style changed hyphenation
Getting hyphenation from a style
# ... other code
style_obj = Hyphenation.from_style(doc=doc, style_name=StyleParaKind.STANDARD)
assert style_obj.prop_style_name == str(StyleParaKind.STANDARD)
FlowOptions Class
Setting Options
# ... other code
para_flow_style = FlowOptions(orphans=3, widows=4, keep=True, style_name=StyleParaKind.STANDARD)
para_flow_style.apply(doc)
Style results.

Fig. 1105 Writer dialog Paragraph Text Flow style changed flow options
Getting options from a style
# ... other code
style_obj = FlowOptions.from_style(doc=doc, style_name=StyleParaKind.STANDARD)
assert style_obj.prop_style_name == str(StyleParaKind.STANDARD)
Breaks Class
Setting Breaks Style
# ... other code
para_break_style = Breaks(
type=BreakType.PAGE_BEFORE, style="Right Page", style_name=StyleParaKind.STANDARD
)
para_break_style.apply(doc)
Style results.

Fig. 1106 Writer dialog Paragraph Text Flow style changed breaks
Getting breaks from a style
# ... other code
style_obj = Breaks.from_style(doc=doc, style_name=StyleParaKind.STANDARD)
assert style_obj.prop_style_name == str(StyleParaKind.STANDARD)