Write Modify Paragraph Area Hatch
The ooodev.format.writer.modify.para.area.Hatch
class is used to modify the values seen in Fig. 1073 of a paragraph style.
Setup
from ooodev.format.writer.modify.para.area import Pattern as ParaStylePattern
from ooodev.format.writer.modify.para.area import StyleParaKind, PresetPatternKind
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_area_hatch_style = ParaStyleHatch.from_preset(
preset=PresetHatchKind.GREEN_90_DEGREES_TRIPLE, style_name=StyleParaKind.STANDARD
)
para_area_hatch_style.apply(doc)
style_obj = ParaStyleHatch.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__":
sys.exit(main())
Apply image to a style
Before applying Style
Apply style
# ... other code
para_area_hatch_style = ParaStyleHatch.from_preset(
preset=PresetHatchKind.GREEN_90_DEGREES_TRIPLE, style_name=StyleParaKind.STANDARD
)
para_area_hatch_style.apply(doc)
After appling style
Getting the area hatch from a style
We can get the area hatch from the document.
# ... other code
style_obj = ParaStyleHatch.from_style(doc=doc, style_name=StyleParaKind.STANDARD)
assert style_obj.prop_style_name == str(StyleParaKind.STANDARD)