PHP Classes

File: example.excel_xml.php

Recommend this page to a friend!
  Classes of Gianluca Zanferrari   PHP Excel XML Export   example.excel_xml.php   Download  
File: example.excel_xml.php
Role: Example script
Content type: text/plain
Description: example
Class: PHP Excel XML Export
Generate Excel spreadsheets in XML format
Author: By
Last change:
Date: 9 years ago
Size: 872 bytes
 

Contents

Class file image Download
<?php
require_once('class.excel_xml.php');

$xls = new excel_xml; // initiate the class

$xls->set_titles(array('title one','title two','title three')); // optional: sets the titles of the spreadsheet columns

// adding 6 rows to the spreadsheet

$xls->add_row(array('text',-22.2,'bla bla')); // first row

$xls->add_row(array('1500.3',14.5,'bingo!')); // second row

$xls->add_row(array('2014-11-01',14.5,'a date in cell A4!!')); // third row

$xls->add_row(array('Timestamp in cell C5',14.5,'2014-11-01 12:00:10','extra data, a longer text')); // fourth row

$xls->add_row(array()); // fifth (empty) row

$xls->add_row(array('Time in cell C7',14.5,'12:00:10'));// sixth row

// writes output to file.xml (check please write permissions)
//$xls->output('file'); // comment it out to enable writing

// send the data to the browser
$xls->output();