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 Background
  • Edit on GitHub

Calc Modify Page Footer Background

Table of Contents

  • Overview

  • Setup

  • Footer Background Color

    • Setting the Page Footer Background Color

    • Getting the background Footer color from a style

  • Footer Background Image

    • Setting the Page Footer Background Image

  • Related Topics

Overview

The ooodev.format.calc.modify.page.footer.area.Color and ooodev.format.calc.modify.page.footer.area.Img classes sets the background options for the Calc page.

Setup

General function used to run these examples.

import uno
from ooodev.format import Styler
from ooodev.format.calc.modify.page.footer import Footer, CalcStylePageKind
from ooodev.format.calc.modify.page.footer.area import Color as FooterColor
from ooodev.format.calc.modify.page.footer.area import Img as FooterImg, PresetImageKind
from ooodev.office.calc import Calc
from ooodev.utils.color import StandardColor
from ooodev.gui import GUI
from ooodev.loader.lo import Lo

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_color_style = FooterColor(
            color=StandardColor.GREEN_LIGHT2, style_name=CalcStylePageKind.DEFAULT
        )
        Styler.apply(doc, footer_style, footer_color_style)

        style_obj = FooterColor.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())

Footer Background Color

Setting the Page Footer Background Color

# .. other code
footer_color_style = FooterColor(
    color=StandardColor.GREEN_LIGHT2, style_name=CalcStylePageKind.DEFAULT
)
Styler.apply(doc, footer_style, footer_color_style)

Style results.

Calc dialog Page Footer Background style color modified

Fig. 453 Calc dialog Page Footer Background style color modified

Getting the background Footer color from a style

# .. other code
style_obj = FooterColor.from_style(
    doc=doc, style_name=CalcStylePageKind.DEFAULT
)
assert style_obj.prop_style_name == str(CalcStylePageKind.DEFAULT)

Footer Background Image

Setting the Page Footer Background Image

# .. other code
footer_img_style = FooterImg.from_preset(
    preset=PresetImageKind.COFFEE_BEANS, style_name=CalcStylePageKind.DEFAULT
)
Styler.apply(doc, footer_style, footer_img_style)

Style results.

Calc dialog Page Footer Background style image modified

Fig. 454 Calc dialog Page Footer Background style image modified

Related Topics

See also

  • Formatting and Styling kinds

  • Format Coding Style

  • Calc Modify Page Header Background

  • GUI

  • Lo

  • ooodev.format.calc.modify.page.footer.area.Color

  • ooodev.format.calc.modify.page.footer.area.Img

Previous Next

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

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