How to PHP export to Excel
How to PHP export to Excel export.php <?php require 'php-excel.class.php'; $xls = new Excel('Sheet1'); $xls->worksheets['Sheet']->addRow(array("col1"," col2 "," col3 ")); $xls->addsheet(' Sheet2 '); $xls->worksheets[' Sheet2 ']->addRow(array(" col1a "," col2a "," col3a ")); $xls->generate('export'); ?> php-excel.class.php <?php class WorkSheet { private $lines = array(); public $sWorksheetTitle; public function __construct($sWorksheetTitle) { $this->setWorksheetTitle($sWorksheetTitle); } public function setWorksheetTitle ($title) { $title = preg_replace ("/[\\\¦:¦\/¦\?¦\*¦\[¦\]]/", "", $title); $title = substr ($title, 0, 31); $this->sWorksheetTitle = $title; } public function addRow ($array) { $cells = ""; foreach ...
留言
張貼留言