tsv2013 / open-document-generator
dev-main
2024-04-15 17:32 UTC
Requires (Dev)
- phpunit/phpunit: ^10.5
This package is auto-updated.
Last update: 2025-06-15 20:04:37 UTC
README
Open Document Generator library
Allows to create and store an ODT file. Supports:
- headers
- paragraphs
- tables
- tables of content
- styles: text, paragraph, table cell, table column
Requirements:
- zip library enabled in php.ini file
extension=zip
Sample usage
ODT file minimal creation code:
$fileName = dirname(__FILE__) . "/document1.odt"; $docFile = new ODFile($fileName); $document = $docFile->document; $document->add_heading("Test heading"); $document->add_para("Lorem ipsum"); $docFile->create();
ODS file minimal creation code:
$fileName = dirname(__FILE__) . "/document1.ods"; $docFile = new ODFile($fileName); $document = $docFile->document; $table = new ODTable([10, 7]); $document->add($table); $row = $table->create_row(); $row->add_cell_with_text("Column 1"); $row->add_cell_with_text("Column 2"); $row = $table->create_row(); $row->add_cell_with_text("val 1"); $row->add_cell_with_text("val 2"); $docFile->create();
See also
https://docs.oasis-open.org/office/v1.2/os/OpenDocument-v1.2-os-part1.html
https://getcomposer.org/doc/articles/scripts.md
https://www.php.net/manual/en/function.xml-parse.php
https://www.php.net/manual/en/function.xml-parse-into-struct.php