lapinator / ods-php-generator

Open Document Spreadsheet (.ods) 生成器

v0.0.3 2016-04-14 21:51 UTC

This package is not auto-updated.

Last update: 2024-09-26 00:15:14 UTC


README

odsPhpGenerator 是一个用 PHP 编写的库,用于生成 Open Document Spreadsheet (.ods)

Avatars in trending repos

功能

  • UTF-8 编码
  • 多表格
  • 合并单元格
  • 公式
  • 图片
  • 更多功能

安装

通过 composer

$ composer require lapinator/ods-php-generator

示例

use odsPhpGenerator\ods;
use odsPhpGenerator\odsTable;
use odsPhpGenerator\odsTableRow;
use odsPhpGenerator\odsTableCellString;

// Load library
require_once '../vendor/autoload.php';

// Create Ods object
$ods  = new ods();

// Create table named 'table 1'
$table = new odsTable('table 1');

// Create the first row
$row   = new odsTableRow();

// Create and add 2 cell 'Hello' and 'World'
$row->addCell( new odsTableCellString("Hello") );
$row->addCell( new odsTableCellString("World") );

// Attach row to table
$table->addRow($row);

// Attach talble to ods
$ods->addTable($table);

// Download the file
$ods->downloadOdsFile("HelloWorld.ods");

更多示例在目录 examples 中