tsv2013 / open-office-generator
此包已被废弃,不再维护。作者建议使用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: 2024-04-15 17:32:33 UTC
README
Open Document Generator 库
允许创建和存储ODT文件。支持:
- 标题
- 段落
- 表格
- 目录表
- 样式:文本、段落、表格单元格、表格列
要求
- php.ini文件中启用了zip库
extension=zip
示例使用
ODT文件最小创建代码
$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文件最小创建代码
$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();
另请参阅
https://docs.oasis-open.org/office/v1.2/os/OpenDocument-v1.2-os-part1.html
https://getcomposer.org.cn/doc/articles/scripts.md
https://php.ac.cn/manual/en/function.xml-parse.php
https://php.ac.cn/manual/en/function.xml-parse-into-struct.php