LibreOffice
Last updated at 10:57 am UTC on 14 January 2022
LibreOffice (LO) is a free and open-source office suite, a project of The Document Foundation. The LibreOffice suite comprises programs for word processing, the creation and editing of spreadsheets, slideshows, diagrams and drawings, working with databases, and composing mathematical formulae. It is available in 115 languages (Wikipedia).
It supports a "flat" XML file format which is based on well known web standards. This makes it useful for generating office documents from within Squeak. Later they may be converted to other office formats through a libreoffice command line call.
File formats
OpenDocument Format (ODF) Family, OASIS and ISO/IEC 26300
https://www.loc.gov/preservation/digital/formats/fdd/fdd000247.shtml#notes
https://www.loc.gov/preservation/digital/formats/fdd/fdd000428.shtml
LibreOffice Draw file format
OpenDocument Drawing Document Format (ODG), Version 1.2, ISO 26300-1:2015
Extending the Swiss Army knife - an overview about writing of filters for LibreOffice
https://help.libreoffice.org/latest/en-US/text/shared/main0108.html
LibreOffice applications also support a 'flat' XML file format. That format used well XML code from well-known standards (HTML,CSS, SVG, XSL formatting objects).
Such a flat file format is easy to generate, like a web page.
Styles
A LO document has styles.
Example:
<style:style style:name="P4" style:family="paragraph" style:parent-style-name="Standard">
<style:text-properties
style:font-name="DejaVu Serif"
fo:font-weight="bold"
style:font-weight-asian="bold" style:font-weight-complex="bold"/>
</style:style>
<style:style style:name="P5" style:family="paragraph" style:parent-style-name="Standard">
<style:paragraph-properties fo:break-before="page"/>
<style:text-properties style:font-name="DejaVu Serif" />
</style:style>
https://ask.libreoffice.org/en/question/32602/difference-between-styles-and-automatic-styles/
office:automatic-styles
corresponds to direct formatting of an object and office:styles
correspond to the settings via style&formatting window. Although automatic styles "are considered to be properties of the object" it is not forbidden to use the same automatic style for more than one object. You have no UI for doing so, but you can do it in the file itself.
'office:styles' are preferred when formatting a generated document because then the user can edit the document and format it in a consistent way. Automatic styles correspond to direct formatting of the text objects.
Document structure
<office:document>
<office:automatic-styles>
... styles created automatically based on direct user choices, e.g., for fill color for a particular shape, with references to fuller and named style specifications in styles.xml ...
</office:automatic-styles>
<office:body>
<office:drawing>
<draw:page >
... vector graphics elements, for example a rectangle filled with the solid color specified in the named style gr1
... <draw:rect draw:style-name="gr1" svg:width="12.1cm" svg:height="12.1cm" svg:x="4.635cm" svg:y="1.418cm"></draw:rect>
</draw:page>
</office:drawing>
</office:body>
</office:document>
Code examples
Minimal LibreOffice Writer document in 'flat XML' format (fodt)
Minimal LibreOffice Impress document in 'flat XML' format (fodg)
(paste it into a text-only file; make sure that there is no space before the xml tag; open it with LibreOffice)