$files = array(); foreach ($tFiles as $file) { $files[$file] = basename($file); } $excelFile = isset($_POST['file']) ? $_POST['file'] : (isset($_SESSION['file']) ? $_SESSION['file'] : $tFiles[0]); $_SESSION['file'] = $excelFile; if (isset($_POST['file'])) { $_SESSION['options'] = $sessionOptions = array(); } print formElement(formLabel('file', 'Load file'), formSelect('file', $excelFile, $files)); print formElement('', formSubmit('set-file', 'Change file')); print formEnd(); ######################################################################################################################## ## Options form ######################################################################################################## ######################################################################################################################## $reader = QExcel::createReaderForFile($excelFile); $options = $reader->getDefaultOptions(); $loadSheet = 0; echo '<h2>Options</h2>'; print formStart(); foreach ($options as $option => $defaultValue) { switch ($option) { case 'encoding': // Some random encodings found on iconvlib $tEncodings = array('ASCII', 'ISO-8859-1', 'ISO-8859-2', 'ISO-8859-3', 'ISO-8859-4', 'ISO-8859-5', 'ISO-8859-7', 'ISO-8859-9', 'ISO-8859-10', 'ISO-8859-13', 'ISO-8859-14', 'ISO-8859-15', 'ISO-8859-16', 'KOI8-R', 'KOI8-U', 'KOI8-RU', 'CP1250', 'CP1251', 'CP1252', 'CP1253', 'CP1254', 'CP1257', 'CP850', 'CP866', 'CP1131', 'MacRoman', 'MacCentralEurope', 'MacIceland', 'MacCroatian', 'MacRomania', 'MacCyrillic', 'MacUkraine', 'MacGreek', 'MacTurkish', 'Macintosh', 'UTF-8', 'UTF-16LE', 'UTF-16BE', 'UTF-32LE'); // We need a key value array for our formSelect 'view helper' $encodings = array(); foreach ($tEncodings as $encoding) { $encodings[$encoding] = $encoding; } // print the option
<?php /** * QExcel * * QExcel is heavily based on PHPExcel (http://www.codeplex.com/PHPExcel) * * @package QExcel * @license GNU LGPL (http://www.gnu.org/licenses/lgpl.txt) * @copyright 2012 Qronicle (http://www.qronicle.be) */ // Define the library's root directory and set up the autoloader if (!defined('QEXCEL_ROOT')) { define('QEXCEL_ROOT', dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR); require QEXCEL_ROOT . 'QExcel' . DIRECTORY_SEPARATOR . 'Autoloader.php'; QExcel::addReaderPath(QEXCEL_ROOT . '/QExcel/Reader/', 'QExcel_Reader_'); } /** * QExcel * * The QExcel class acts as a Reader Factory for QExcel. * It provides methods to dynamically create readers or load entire workbooks. * * By default QExcel will only load Readers from its own library. * This can be changed however, by adding custom reader paths and/or types. * * You will probably always need a custom reader path if you want to add additional (or extending) readers. * You can add a path by defining its location, and the class prefix that is used. * For example if you have your readers stored in 'library/MyLib/Reader' and you follow the PEAR naming conventions, * you should add 'library/MyLib/Readers/' with prefix 'MyLib_Reader_'. *