We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Category:Plugin::Data Conversion Category:Contributions::Plugins::Files
This is a simple plugin to create excel output.
[code]<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
/*
function to_excel($array, $filename='out') { header('Content-type: application/vnd.ms-excel'); header('Content-Disposition: attachment; filename='.$filename.'.xls');
// Filter all keys, they'll be table headers $h = array(); foreach($array as $row) foreach($row as $key=>$val) if(!in_array($key, $h)) $h[] = $key; echo '<table><tr>'; foreach($h as $key) { $key = ucwords($key); echo '<th>'.$key.'</th>'; } echo '</tr>'; foreach($array as $val) _writeRow($val, $h); echo '</table>';
}
function _writeRow($row, $h, $isHeader=false) { echo '
Example usage
[code]to_excel($this->model->getUsersAsArray());[/code]