OOO Development Tools

Book:

  • Python LibreOffice Programming

Help:

  • Help Documentation
    • Spreadsheets (Calc)
    • Chart2
    • Draw Documents (Draw)
    • Text Documents (Writer)
      • Write Formatting and Style
        • Direct
        • Modify
        • Style
    • Common Help Topics

Guides:

  • Guides

Misc:

  • Events
  • Version History
  • Credits and Acknowledgements

DEVELOPER API:

  • ooodev

DEVELOPING ODEV:

  • Dev Docs
OOO Development Tools
  • Help Documentation
  • Text Documents (Writer)
  • Write Formatting and Style
  • Modify
  • Writer Format Modify Page
  • Writer Format Modify Page Footer
  • Write Modify Page Footer
  • Edit on GitHub

Write Modify Page Footer

Table of Contents

  • Setup

  • Applying Footer Style

    • Before applying style

    • Apply Style

    • After applying style

  • Getting the Footer from a style

  • Related Topics

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

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

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)

Related Topics

See also

  • Formatting and Styling kinds

  • Format Coding Style

  • GUI

  • Lo

  • ooodev.format.writer.modify.page.footer.Footer

Previous Next

© Copyright 2022-2024, :Barry-Thomas-Paul: Moss. Revision 308a4980.

Built with Sphinx using a theme provided by Read the Docs.