OOO Development Tools

Book:

  • Python LibreOffice Programming

Help:

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

Guides:

  • Guides

Misc:

  • Events
  • Version History
  • Credits and Acknowledgements

DEVELOPER API:

  • ooodev

DEVELOPING ODEV:

  • Dev Docs
OOO Development Tools
  • Help Documentation
  • Spreadsheets (Calc)
  • Calc Formatting and Style
  • Modify
  • Calc Format Modify Page
  • Calc Format Modify Page Footer
  • Calc Modify Page Footer
  • Edit on GitHub

Calc 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.calc.modify.page.footer.Footer class is used to modify the page footer values seen in Fig. 459 of a Calc document.

Setup

General function used to run these examples.

import uno
from ooodev.office.calc import Calc
from ooodev.gui import GUI
from ooodev.loader.lo import Lo
from ooodev.format.calc.modify.page.footer import Footer, CalcStylePageKind

def main() -> int:
    with Lo.Loader(connector=Lo.ConnectSocket()):
        doc = Calc.create_doc()
        GUI.set_visible(True, doc)
        Lo.delay(500)
        Calc.zoom_value(doc, 100)

        footer_style = Footer(
            on=True,
            shared_first=True,
            shared=True,
            height=10.0,
            spacing=3.0,
            margin_left=1.5,
            margin_right=2.0,
            style_name=CalcStylePageKind.DEFAULT,
        )
        footer_style.apply(doc)

        style_obj = Footer.from_style(doc=doc, style_name=CalcStylePageKind.DEFAULT)
        assert style_obj.prop_style_name == str(CalcStylePageKind.DEFAULT)

        Lo.delay(1_000)
        Lo.close_doc(doc)
    return 0

if __name__ == "__main__":
    SystemExit(main())

Applying Footer Style

Before applying style

Calc dialog Page Footer default

Fig. 459 Calc dialog Page Footer default

Apply Style

footer_style = Footer(
    on=True,
    shared_first=True,
    shared=True,
    height=10.0,
    spacing=3.0,
    margin_left=1.5,
    margin_right=2.0,
    style_name=CalcStylePageKind.DEFAULT,
)
footer_style.apply(doc)

After applying style

Calc dialog Page Footer set with Footer class

Fig. 460 Calc dialog Page Footer set with Footer class

Getting the Footer from a style

style_obj = Footer.from_style(doc=doc, style_name=CalcStylePageKind.DEFAULT)
assert style_obj.prop_style_name == str(CalcStylePageKind.DEFAULT)

Related Topics

See also

  • Formatting and Styling kinds

  • Format Coding Style

  • Calc Modify Page Header

  • GUI

  • Lo

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

  • Calc.set_head_foot()

Previous Next

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

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