Home > Programming > Create OpenDocument spreadsheets in PHP.

Create OpenDocument spreadsheets in PHP.

December 10th, 2009 Jimmy Leave a comment Go to comments

The odsPhpGenerator has been released. The generator is a small and easy library written in PHP 5.0 to make the creation of Open Document Spreadsheets easy. This first version requires PHp5.0. Below is a simple example of how you would use this library.

// Load library

require_once('ods/ods.php');

 

// Create Ods object

$ods  = new ods();

$ods->setPath2OdsFiles('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"); 

Homepage

Download

Digg: DIGG ME
  1. No comments yet.
  1. No trackbacks yet.