Write Modify Page Footer
The ooodev.format.writer.modify.page.footer.Footer
class is used to modify the page footer values seen in Fig. 1166 of a Writer document.
Setup
General function used to run these examples.
from ooodev.format.writer.modify.page.footer import Footer, WriterStylePageKind
from ooodev.utils.color import StandardColor
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.ENTIRE_PAGE)
footer_style = Footer(
on=True,
shared_first=True,
shared=True,
height=10.0,
spacing=3.0,
spacing_dyn=True,
margin_left=1.5,
margin_right=2.0,
style_name=WriterStylePageKind.STANDARD,
)
footer_style.apply(doc)
style_obj = Footer.from_style(doc=doc, style_name=WriterStylePageKind.STANDARD)
assert style_obj.prop_style_name == str(WriterStylePageKind.STANDARD)
Lo.delay(1_000)
Lo.close_doc(doc)
return 0
if __name__ == "__main__":
SystemExit(main())
Applying Footer Style
Before applying style
![Writer dialog Page Footer default](https://user-images.githubusercontent.com/4193389/235278066-fcd9edde-360c-4010-8fed-6e14812d95b4.png)
Fig. 1166 Writer dialog Page Footer default
Apply Style
footer_style = Footer(
on=True,
shared_first=True,
shared=True,
height=10.0,
spacing=3.0,
spacing_dyn=True,
margin_left=1.5,
margin_right=2.0,
style_name=WriterStylePageKind.STANDARD,
)
footer_style.apply(doc)
After applying style
![Writer dialog Page Footer set with Footer class](https://user-images.githubusercontent.com/4193389/235278243-902386fe-8c10-40e3-b596-451d2c290160.png)
Fig. 1167 Writer dialog Page Footer set with Footer class
Getting the Footer from a style
style_obj = Footer.from_style(doc=doc, style_name=WriterStylePageKind.STANDARD)
assert style_obj.prop_style_name == str(WriterStylePageKind.STANDARD)