Write Modify Paragraph Position
The ooodev.format.writer.modify.para.font.FontPosition
, class is used to set the paragraph style font Fig. 1089.
Setting the font effects
from ooodev.format.writer.modify.para.font import FontPosition, FontScriptKind
from ooodev.format.writer.modify.para.font import CharSpacingKind, StyleParaKind
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_font_style = FontPosition(
script_kind=FontScriptKind.SUPERSCRIPT,
raise_lower=12,
rel_size=80,
rotation=90,
fit=True,
spacing=CharSpacingKind.LOOSE,
style_name=StyleParaKind.STANDARD,
)
para_font_style.apply(doc)
style_obj = FontPosition.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 font position from a style
# ... other code
style_obj = FontPosition.from_style(doc=doc, style_name=StyleParaKind.STANDARD)
assert style_obj.prop_style_name == str(StyleParaKind.STANDARD)