Detailed Description
Definition at line 45 of file IOFactory.php.
Constructor & Destructor Documentation
PHPExcel_IOFactory::__construct |
( |
| ) |
|
|
private |
Member Function Documentation
static PHPExcel_IOFactory::addSearchLocation |
( |
|
$type = '' , |
|
|
|
$location = '' , |
|
|
|
$classname = '' |
|
) |
| |
|
static |
Add search location.
public
- Parameters
-
string | $type | Example: IWriter |
string | $location | Example: PHPExcel/Writer/{0}.php |
string | $classname | Example: PHPExcel_Writer_{0} |
Definition at line 117 of file IOFactory.php.
References $location, and $type.
{
self::$_searchLocations[] = array(
'type' =>
$type,
'path' =>
$location,
'class' => $classname );
}
static PHPExcel_IOFactory::createReader |
( |
|
$readerType = '' | ) |
|
|
static |
Create PHPExcel_Reader_IReader.
public
- Parameters
-
string | $readerType | Example: Excel2007 |
- Returns
- PHPExcel_Reader_IReader
- Exceptions
-
Definition at line 161 of file IOFactory.php.
Referenced by createReaderForFile().
{
$searchType = 'IReader';
foreach (self::$_searchLocations as $searchLocation) {
if ($searchLocation['type'] == $searchType) {
$className = str_replace('{0}', $readerType, $searchLocation['class']);
$classFile = str_replace('{0}', $readerType, $searchLocation['path']);
$instance = new $className();
if (!is_null($instance)) {
return $instance;
}
}
}
throw new Exception(
"No $searchType found for type $readerType");
}
static PHPExcel_IOFactory::createReaderForFile |
( |
|
$pFilename | ) |
|
|
static |
Create PHPExcel_Reader_IReader for file using automatic PHPExcel_Reader_IReader resolution.
public
- Parameters
-
- Returns
- PHPExcel_Reader_IReader
- Exceptions
-
Definition at line 222 of file IOFactory.php.
References $reader, and createReader().
Referenced by identify(), and load().
{
$pathinfo = pathinfo($pFilename);
if (isset($pathinfo['extension'])) {
switch (strtolower($pathinfo['extension'])) {
case 'xlsx':
break;
case 'xls':
break;
case 'ods':
break;
case 'slk':
break;
case 'xml':
break;
case 'gnumeric':
break;
case 'csv':
break;
default:
break;
}
}
}
foreach (self::$_autoResolveClasses as $autoResolveClass) {
if (
$reader->canRead($pFilename)) {
}
}
}
static PHPExcel_IOFactory::createWriter |
( |
PHPExcel |
$phpExcel, |
|
|
|
$writerType = '' |
|
) |
| |
|
static |
Create PHPExcel_Writer_IWriter.
public
- Parameters
-
PHPExcel | $phpExcel | |
string | $writerType | Example: Excel2007 |
- Returns
- PHPExcel_Writer_IWriter
- Exceptions
-
Definition at line 131 of file IOFactory.php.
{
$searchType = 'IWriter';
foreach (self::$_searchLocations as $searchLocation) {
if ($searchLocation['type'] == $searchType) {
$className = str_replace('{0}', $writerType, $searchLocation['class']);
$classFile = str_replace('{0}', $writerType, $searchLocation['path']);
$instance = new $className($phpExcel);
if (!is_null($instance)) {
return $instance;
}
}
}
throw new Exception(
"No $searchType found for type $writerType");
}
static PHPExcel_IOFactory::getSearchLocations |
( |
| ) |
|
|
static |
static PHPExcel_IOFactory::identify |
( |
|
$pFilename | ) |
|
|
static |
static PHPExcel_IOFactory::load |
( |
|
$pFilename | ) |
|
|
static |
static PHPExcel_IOFactory::setSearchLocations |
( |
|
$value | ) |
|
|
static |
Set search locations.
public
- Parameters
-
- Exceptions
-
Definition at line 100 of file IOFactory.php.
{
if (is_array($value)) {
self::$_searchLocations = $value;
} else {
throw new Exception(
'Invalid parameter passed.');
}
}
Field Documentation
PHPExcel_IOFactory::$_autoResolveClasses |
|
staticprivate |
Initial value: array(
'Excel2007',
'Excel5',
'Excel2003XML',
'OOCalc',
'SYLK',
'Gnumeric',
'CSV',
)
Definition at line 66 of file IOFactory.php.
PHPExcel_IOFactory::$_searchLocations |
|
staticprivate |
Initial value: array(
array( 'type' => 'IWriter', 'path' => 'PHPExcel/Writer/{0}.php', 'class' => 'PHPExcel_Writer_{0}' ),
array( 'type' => 'IReader', 'path' => 'PHPExcel/Reader/{0}.php', 'class' => 'PHPExcel_Reader_{0}' )
)
Definition at line 54 of file IOFactory.php.
Referenced by getSearchLocations().
The documentation for this class was generated from the following file: