30 if (!
defined(
'PHPEXCEL_ROOT')) {
34 define(
'PHPEXCEL_ROOT', dirname(__FILE__) .
'/../');
35 require(PHPEXCEL_ROOT .
'PHPExcel/Autoloader.php');
55 array(
'type' =>
'IWriter',
'path' =>
'PHPExcel/Writer/{0}.php',
'class' =>
'PHPExcel_Writer_{0}' ),
56 array(
'type' =>
'IReader',
'path' =>
'PHPExcel/Reader/{0}.php',
'class' =>
'PHPExcel_Reader_{0}' )
90 return self::$_searchLocations;
102 if (is_array($value)) {
103 self::$_searchLocations = $value;
119 self::$_searchLocations[] =
array(
'type' =>
$type,
'path' =>
$location,
'class' => $classname );
134 $searchType =
'IWriter';
137 foreach (self::$_searchLocations as $searchLocation) {
138 if ($searchLocation[
'type'] == $searchType) {
139 $className = str_replace(
'{0}', $writerType, $searchLocation[
'class']);
141 $instance =
new $className($phpExcel);
142 if ($instance !== NULL) {
163 $searchType =
'IReader';
166 foreach (self::$_searchLocations as $searchLocation) {
167 if ($searchLocation[
'type'] == $searchType) {
168 $className = str_replace(
'{0}', $readerType, $searchLocation[
'class']);
170 $instance =
new $className();
171 if ($instance !== NULL) {
190 public static function load($pFilename) {
191 $reader = self::createReaderForFile($pFilename);
192 return $reader->load($pFilename);
205 $reader = self::createReaderForFile($pFilename);
206 $className = get_class(
$reader);
207 $classType = explode(
'_',$className);
209 return array_pop($classType);
224 $pathinfo = pathinfo($pFilename);
226 $extensionType = NULL;
227 if (isset($pathinfo[
'extension'])) {
228 switch (strtolower($pathinfo[
'extension'])) {
233 $extensionType =
'Excel2007';
237 $extensionType =
'Excel5';
241 $extensionType =
'OOCalc';
244 $extensionType =
'SYLK';
247 $extensionType =
'Excel2003XML';
250 $extensionType =
'Gnumeric';
254 $extensionType =
'HTML';
265 if ($extensionType !== NULL) {
266 $reader = self::createReader($extensionType);
276 foreach (self::$_autoResolveClasses as $autoResolveClass) {
278 if ($autoResolveClass !== $extensionType) {
279 $reader = self::createReader($autoResolveClass);
280 if (
$reader->canRead($pFilename)) {
static getSearchLocations()
Get search locations.
static $_autoResolveClasses
static identify($pFilename)
Identify file type using automatic PHPExcel_Reader_IReader resolution.
__construct()
Private constructor for PHPExcel_IOFactory.
static setSearchLocations($value)
Set search locations.
static load($pFilename)
Loads PHPExcel from file using automatic PHPExcel_Reader_IReader resolution.
static createReader($readerType='')
Create PHPExcel_Reader_IReader.
static createWriter(PHPExcel $phpExcel, $writerType='')
Create PHPExcel_Writer_IWriter.
static addSearchLocation($type='', $location='', $classname='')
Add search location.
Create styles array
The data for the language used.
static createReaderForFile($pFilename)
Create PHPExcel_Reader_IReader for file using automatic PHPExcel_Reader_IReader resolution.
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'