Exemplo n.º 1
0
$excel = new excel_xml();
/**
* Add style to your worksheet, it's reference will be "header"
* You add it as an array with the key being the modifier and the value parameter.
* You can add:
*    - size in pt
*    - font like "Georgia"
*    - color in hex for font color
*    - bgcolor in hex for background color
*    - bold as boolean (bold => 1)
*    - italic as boolean
*    - strike as boolean
*/
$header_style = array('bold' => 1, 'size' => '12', 'color' => '#FFFFFF', 'bgcolor' => '#4F81BD');
$excel->add_style('header', $header_style);
$excel->debug();
/**
* Add row and attach the style "header" to it
*/
$excel->add_row(array('Username', 'First name', 'Last name'), 'header');
/**
* Add some rows, if you encapsulate the string inside asterisks,
* they will get bold using the predefined style "bold"
* If you append "|x" where x is a number, that cell will be
* merged with the x following cells
*/
$excel->add_row(array('Anorgan|2'));
$excel->add_row(array('*Marin*', 'Crnkovic'));
/**
* You don't like the arrays, or already have
* some form of csv generating script that uses strings?