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

Write Modify Page Footer Area

Table of Contents

  • Setup

  • Area Color

    • Setting Area Color

    • Getting color from a style

  • Area Gradient

    • Setting Area Gradient

    • Getting gradient from a style

  • Area Image

    • Setting Area Image

    • Getting image from a style

  • Area Pattern

    • Setting Area Pattern

    • Getting pattern from a style

  • Area Hatch

    • Setting Area Hatch

    • Getting hatch from a style

  • Related Topics

The following classes are used to modify the Area style values seen in Fig. 1166 of a Page style.

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

  • ooodev.format.writer.modify.page.footer.area.Gradient

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

  • ooodev.format.writer.modify.page.footer.area.Pattern

  • ooodev.format.writer.modify.page.footer.area.Hatch

Default Page Style Dialog

Setup

General function used to run these examples.

Note that in order to apply a style, the document footer must be turned on as seen in Write Modify Page Footer.

from ooodev.format.writer.modify.page.header import Header, WriterStylePageKind
from ooodev.format.writer.modify.page.area import Color as FooterAreaColor
from ooodev.format import Styler
from ooodev.office.write import Write
from ooodev.utils.color import StandardColor
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_color_style = HeaderAreaColor(
            color=StandardColor.GOLD_LIGHT2, style_name=footer_style.prop_style_name
        )
        Styler.apply(doc, footer_style, footer_color_style)

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

Area Color

The Color class is used to modify the footer area color of a page style. The result are seen in Fig. 1151 and Fig. 1152.

Setting Area Color

from ooodev.format.writer.modify.page.footer.area import Color as FooterAreaColor
# ... other code

footer_color_style = FooterAreaColor(
    color=StandardColor.GOLD_LIGHT2, style_name=footer_style.prop_style_name
)
Styler.apply(doc, footer_style, footer_color_style)

Style results.

Writer Page Footer

Fig. 1151 Writer Page Footer

Writer dialog Footer Area style color set

Fig. 1152 Writer dialog Footer Area style color set

Getting color from a style

# ... other code

style_obj = FooterAreaColor.from_style(doc=doc, style_name=WriterStylePageKind.STANDARD)
assert style_obj.prop_style_name == str(WriterStylePageKind.STANDARD)

Area Gradient

Setting Area Gradient

The Gradient class is used to modify the footer area gradient of a page style. The result are seen in Fig. 1153 and Fig. 1154.

The PresetGradientKind class is used to look up the presets of gradient for convenience.

from ooodev.format.writer.modify.page.footer.area import Gradient, PresetGradientKind
# ... other code

gradient_style = Gradient.from_preset(
    preset=PresetGradientKind.DEEP_OCEAN, style_name=WriterStylePageKind.STANDARD
)
Styler.apply(doc, footer_style, gradient_style)

Style results.

Writer Page Footer

Fig. 1153 Writer Page Footer

Writer dialog Footer Area style gradient set

Fig. 1154 Writer dialog Footer Area style gradient set

Getting gradient from a style

# ... other code

style_obj = Gradient.from_style(doc=doc, style_name=WriterStylePageKind.STANDARD)
assert style_obj.prop_style_name == str(WriterStylePageKind.STANDARD)

Area Image

Setting Area Image

The Img class is used to modify the footer area image of a page style. The result are seen in Fig. 1155 and Fig. 1156.

The PresetImageKind class is used to look up the presets of image for convenience.

from ooodev.format.writer.modify.page.footer.area import Img as FooterAreaImg, PresetImageKind
# ... other code

img_style = FooterAreaImg.from_preset(
    preset=PresetImageKind.COLOR_STRIPES, style_name=WriterStylePageKind.STANDARD
)
Styler.apply(doc, footer_style, img_style)

Style results.

Writer Page Footer

Fig. 1155 Writer Page Footer

Writer dialog Footer Area style image set

Fig. 1156 Writer dialog Footer Area style image set

Getting image from a style

# ... other code

style_obj = FooterAreaImg.from_style(doc=doc, style_name=WriterStylePageKind.STANDARD)
assert style_obj.prop_style_name == str(WriterStylePageKind.STANDARD)

Area Pattern

Setting Area Pattern

The Pattern class is used to modify the footer area pattern of a page style. The result are seen in Fig. 1157 and Fig. 1158.

The PresetPatternKind class is used to look up the presets of pattern for convenience.

from ooodev.format.writer.modify.page.footer.area import Pattern as FooterStylePattern, PresetPatternKind
# ... other code

pattern_style = FooterStylePattern.from_preset(
    preset=PresetPatternKind.HORIZONTAL_BRICK, style_name=WriterStylePageKind.STANDARD
)
Styler.apply(doc, footer_style, pattern_style)

Style results.

Writer Page Footer

Fig. 1157 Writer Page Footer

Writer dialog Footer Area style pattern set

Fig. 1158 Writer dialog Footer Area style pattern set

Getting pattern from a style

# ... other code

style_obj = FooterStylePattern.from_style(doc=doc, style_name=WriterStylePageKind.STANDARD)
assert style_obj.prop_style_name == str(WriterStylePageKind.STANDARD)

Area Hatch

Setting Area Hatch

The Hatch class is used to modify the footer area hatch of a page style. The result are seen in Fig. 1159 and Fig. 1160.

The PresetHatchKind class is used to look up the presets of hatch for convenience.

from ooodev.format.writer.modify.page.footer.area import Hatch as FooterStyleHatch, PresetHatchKind
# ... other code

hatch_style = FooterStyleHatch.from_preset(
    preset=PresetHatchKind.RED_45_DEGREES_NEG_TRIPLE, style_name=WriterStylePageKind.STANDARD
)
Styler.apply(doc, footer_style, hatch_style)

Style results.

Writer Page Footer

Fig. 1159 Writer Page Footer

Writer dialog Footer Area style hatch set

Fig. 1160 Writer dialog Footer Area style hatch set

Getting hatch from a style

# ... other code

style_obj = FooterStyleHatch.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

  • Write Modify Page Header Area

  • GUI

  • Lo

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

  • ooodev.format.writer.modify.page.footer.area.Gradient

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

  • ooodev.format.writer.modify.page.footer.area.Pattern

  • ooodev.format.writer.modify.page.footer.area.Hatch

Previous Next

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

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