Write Modify Paragraph Tabs
The ooodev.format.writer.modify.para.tabs.Tabs
, class is used to set the paragraph style font Fig. 1101.
Setting Tabs
from ooodev.format.writer.modify.para.tabs import Tabs, TabAlign
from ooodev.format.writer.modify.para.tabs import FillCharKind, StyleParaKind
from ooodev.format import Styler
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)
tb1 = Tabs(position=12.0, align=TabAlign.DECIMAL)
tb2 = Tabs(position=6.5, align=TabAlign.CENTER, fill_char="*")
tb3 = Tabs(position=11.3, align=TabAlign.LEFT, fill_char=FillCharKind.UNDER_SCORE)
Styler.apply(doc, tb1, tb2, tb3)
style_obj = Tabs.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())
Running the above code will produce the following results in the Writer dialog.
Getting tabs from a style
# ... other code
style_obj = Tabs.from_style(doc=doc, style_name=StyleParaKind.STANDARD)
assert style_obj.prop_style_name == str(StyleParaKind.STANDARD)