Calc Modify Page Header
The ooodev.format.calc.modify.page.header.Header
class is used to modify the page header values seen in Fig. 451 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.header import Header, 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)
header_style = Header(
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,
)
header_style.apply(doc)
style_obj = Header.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 Header Style
Before applying style

Fig. 451 Calc dialog Page Header default
Apply Style
header_style = Header(
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,
)
header_style.apply(doc)
After applying style

Fig. 452 Calc dialog Page Header set with Header class
Getting the Header from a style
style_obj = Header.from_style(doc=doc, style_name=CalcStylePageKind.DEFAULT)
assert style_obj.prop_style_name == str(CalcStylePageKind.DEFAULT)