Component appearance
This page provides an overview of OpenReport component appearance, including individual component styling and document-level default styles.
Individual component styling
Each component supports its own formatting properties. See the full details for each component:
Default styles
OpenReport allows to define default styles at the document level using the "document_style" instance. Default styles are applied to all corresponding components within the document, eliminating the need to repeat the same formatting on every component. Individual components can still override default styles via their own properties.
Usage
The "document_style" instance is specified at the document level:
document:
name: report.docx
document_style:
default_text_style:
font: Calibri
size: 11
alignment: justify
default_heading_style:
font: Calibri
bold: True
colour: dark blue
default_caption_style:
font: Calibri
size: 9
italic: True
structure:
# ...
This specification sets default formatting for all text, heading, and caption components in the document.
Available default styles
default_text_style
Sets the default style for all "text" instances within the document.
default_heading_style
Sets the default style for all "heading" instances within the document. Supports an additional "level" property to set the default heading level.
default_caption_style
Sets the default style for all "caption" instances within the document (used in tables and figures).
Supported properties
All three default styles support the same formatting properties:
default_text_style:
alignment:
bold:
colour:
first_line_indent:
font:
highlight_color:
italic:
keep_together:
keep_with_next:
left_indent:
line_spacing:
line_spacing_rule:
page_break_before:
right_indent:
size:
space_after:
space_before:
underline:
These are the same properties available on individual text, heading, and caption components. See Text, Heading, and Caption for full property descriptions.
Overriding defaults
Any property specified directly on a component overrides the default style. For example:
document:
name: report.docx
document_style:
default_text_style:
font: Calibri
size: 11
structure:
- text:
body: This uses the default Calibri size 11.
- text:
body: This overrides the default font.
font: Times New Roman
size: 14
The first text uses the default style (Calibri, size 11). The second text overrides both font and size.