mirror of
https://github.com/retailcrm/PHPExcel.git
synced 2025-02-21 17:03:17 +03:00
namespace examples
This commit is contained in:
parent
be4a1b9dca
commit
11e33b2307
@ -23,8 +23,25 @@
|
|||||||
* @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version ##VERSION##, ##DATE##
|
* @version ##VERSION##, ##DATE##
|
||||||
|
*
|
||||||
|
* SplClassLoader implementation that implements the technical interoperability
|
||||||
|
* standards for PHP 5.3 namespaces and class names.
|
||||||
|
*
|
||||||
|
* http://groups.google.com/group/php-standards/web/final-proposal
|
||||||
|
*
|
||||||
|
* // Example which loads classes for the Doctrine Common package in the
|
||||||
|
* // Doctrine\Common namespace.
|
||||||
|
* $classLoader = new SplClassLoader('Doctrine\Common', '/path/to/doctrine');
|
||||||
|
* $classLoader->register();
|
||||||
|
*
|
||||||
|
* @author Jonathan H. Wage <jonwage@gmail.com>
|
||||||
|
* @author Roman S. Borschel <roman@code-factory.org>
|
||||||
|
* @author Matthew Weier O'Phinney <matthew@zend.com>
|
||||||
|
* @author Kris Wallsmith <kris.wallsmith@gmail.com>
|
||||||
|
* @author Fabien Potencier <fabien.potencier@symfony-project.org>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
namespace PHPExcel;
|
namespace PHPExcel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -56,14 +56,14 @@ class CachedObjectStorageFactory
|
|||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private static $_cacheStorageMethod = NULL;
|
protected static $_cacheStorageMethod = NULL;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Name of the class used for cell cacheing
|
* Name of the class used for cell cacheing
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private static $_cacheStorageClass = NULL;
|
protected static $_cacheStorageClass = NULL;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -71,7 +71,7 @@ class CachedObjectStorageFactory
|
|||||||
*
|
*
|
||||||
* @var string[]
|
* @var string[]
|
||||||
*/
|
*/
|
||||||
private static $_storageMethods = array(
|
protected static $_storageMethods = array(
|
||||||
self::cache_in_memory,
|
self::cache_in_memory,
|
||||||
self::cache_in_memory_gzip,
|
self::cache_in_memory_gzip,
|
||||||
self::cache_in_memory_serialized,
|
self::cache_in_memory_serialized,
|
||||||
@ -91,7 +91,7 @@ class CachedObjectStorageFactory
|
|||||||
*
|
*
|
||||||
* @var array of mixed array
|
* @var array of mixed array
|
||||||
*/
|
*/
|
||||||
private static $_storageMethodDefaultParameters = array(
|
protected static $_storageMethodDefaultParameters = array(
|
||||||
self::cache_in_memory => array(
|
self::cache_in_memory => array(
|
||||||
),
|
),
|
||||||
self::cache_in_memory_gzip => array(
|
self::cache_in_memory_gzip => array(
|
||||||
@ -102,15 +102,19 @@ class CachedObjectStorageFactory
|
|||||||
),
|
),
|
||||||
self::cache_to_phpTemp => array( 'memoryCacheSize' => '1MB'
|
self::cache_to_phpTemp => array( 'memoryCacheSize' => '1MB'
|
||||||
),
|
),
|
||||||
self::cache_to_discISAM => array( 'dir' => NULL
|
self::cache_to_discISAM => array(
|
||||||
|
'dir' => NULL
|
||||||
),
|
),
|
||||||
self::cache_to_apc => array( 'cacheTime' => 600
|
self::cache_to_apc => array(
|
||||||
|
'cacheTime' => 600
|
||||||
),
|
),
|
||||||
self::cache_to_memcache => array( 'memcacheServer' => 'localhost',
|
self::cache_to_memcache => array(
|
||||||
|
'memcacheServer' => 'localhost',
|
||||||
'memcachePort' => 11211,
|
'memcachePort' => 11211,
|
||||||
'cacheTime' => 600
|
'cacheTime' => 600
|
||||||
),
|
),
|
||||||
self::cache_to_wincache => array( 'cacheTime' => 600
|
self::cache_to_wincache => array(
|
||||||
|
'cacheTime' => 600
|
||||||
),
|
),
|
||||||
self::cache_to_sqlite => array(
|
self::cache_to_sqlite => array(
|
||||||
),
|
),
|
||||||
@ -124,7 +128,7 @@ class CachedObjectStorageFactory
|
|||||||
*
|
*
|
||||||
* @var array of mixed array
|
* @var array of mixed array
|
||||||
*/
|
*/
|
||||||
private static $_storageMethodParameters = array();
|
protected static $_storageMethodParameters = array();
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -228,11 +228,11 @@ class Reader_CSV extends Reader_Abstract implements Reader_IReader
|
|||||||
* Loads PHPExcel from file into PHPExcel instance
|
* Loads PHPExcel from file into PHPExcel instance
|
||||||
*
|
*
|
||||||
* @param string $pFilename
|
* @param string $pFilename
|
||||||
* @param PHPExcel $objPHPExcel
|
* @param PHPExcel\Workbook $objPHPExcel
|
||||||
* @return PHPExcel
|
* @return PHPExcel
|
||||||
* @throws PHPExcel\Reader_Exception
|
* @throws PHPExcel\Reader_Exception
|
||||||
*/
|
*/
|
||||||
public function loadIntoExisting($pFilename, PHPExcel $objPHPExcel)
|
public function loadIntoExisting($pFilename, Workbook $objPHPExcel)
|
||||||
{
|
{
|
||||||
$lineEnding = ini_get('auto_detect_line_endings');
|
$lineEnding = ini_get('auto_detect_line_endings');
|
||||||
ini_set('auto_detect_line_endings', true);
|
ini_set('auto_detect_line_endings', true);
|
||||||
|
@ -41,70 +41,70 @@ class Workbook
|
|||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $_uniqueID;
|
protected $_uniqueID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Document properties
|
* Document properties
|
||||||
*
|
*
|
||||||
* @var PHPExcel\DocumentProperties
|
* @var PHPExcel\DocumentProperties
|
||||||
*/
|
*/
|
||||||
private $_properties;
|
protected $_properties;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Document security
|
* Document security
|
||||||
*
|
*
|
||||||
* @var PHPExcel\DocumentSecurity
|
* @var PHPExcel\DocumentSecurity
|
||||||
*/
|
*/
|
||||||
private $_security;
|
protected $_security;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Collection of Worksheet objects
|
* Collection of Worksheet objects
|
||||||
*
|
*
|
||||||
* @var PHPExcel\Worksheet[]
|
* @var PHPExcel\Worksheet[]
|
||||||
*/
|
*/
|
||||||
private $_workSheetCollection = array();
|
protected $_workSheetCollection = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calculation Engine
|
* Calculation Engine
|
||||||
*
|
*
|
||||||
* @var PHPExcel\Calculation
|
* @var PHPExcel\Calculation
|
||||||
*/
|
*/
|
||||||
private $_calculationEngine = NULL;
|
protected $_calculationEngine = NULL;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Active sheet index
|
* Active sheet index
|
||||||
*
|
*
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
private $_activeSheetIndex = 0;
|
protected $_activeSheetIndex = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Named ranges
|
* Named ranges
|
||||||
*
|
*
|
||||||
* @var PHPExcel\NamedRange[]
|
* @var PHPExcel\NamedRange[]
|
||||||
*/
|
*/
|
||||||
private $_namedRanges = array();
|
protected $_namedRanges = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CellXf supervisor
|
* CellXf supervisor
|
||||||
*
|
*
|
||||||
* @var PHPExcel\Style
|
* @var PHPExcel\Style
|
||||||
*/
|
*/
|
||||||
private $_cellXfSupervisor;
|
protected $_cellXfSupervisor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CellXf collection
|
* CellXf collection
|
||||||
*
|
*
|
||||||
* @var PHPExcel\Style[]
|
* @var PHPExcel\Style[]
|
||||||
*/
|
*/
|
||||||
private $_cellXfCollection = array();
|
protected $_cellXfCollection = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CellStyleXf collection
|
* CellStyleXf collection
|
||||||
*
|
*
|
||||||
* @var PHPExcel\Style[]
|
* @var PHPExcel\Style[]
|
||||||
*/
|
*/
|
||||||
private $_cellStyleXfCollection = array();
|
protected $_cellStyleXfCollection = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new PHPExcel with one Worksheet
|
* Create a new PHPExcel with one Worksheet
|
||||||
|
@ -37,7 +37,7 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
|
|||||||
require_once '../Classes/Bootstrap.php';
|
require_once '../Classes/Bootstrap.php';
|
||||||
|
|
||||||
|
|
||||||
// Create new PHPExcel object
|
// Create new PHPExcel Workbook object
|
||||||
echo date('H:i:s') , " Create new PHPExcel Workbook object" , EOL;
|
echo date('H:i:s') , " Create new PHPExcel Workbook object" , EOL;
|
||||||
$objPHPExcel = new PHPExcel\Workbook();
|
$objPHPExcel = new PHPExcel\Workbook();
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
|
|||||||
require_once '../Classes/Bootstrap.php';
|
require_once '../Classes/Bootstrap.php';
|
||||||
|
|
||||||
|
|
||||||
// Create new PHPExcel object
|
// Create new PHPExcel Workbook object
|
||||||
echo date('H:i:s') , " Create new PHPExcel Workbook object" , EOL;
|
echo date('H:i:s') , " Create new PHPExcel Workbook object" , EOL;
|
||||||
$objPHPExcel = new PHPExcel\Workbook();
|
$objPHPExcel = new PHPExcel\Workbook();
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
|
|||||||
require_once '../Classes/Bootstrap.php';
|
require_once '../Classes/Bootstrap.php';
|
||||||
|
|
||||||
|
|
||||||
// Create new PHPExcel object
|
// Create new PHPExcel Workbook object
|
||||||
echo date('H:i:s') , " Create new PHPExcel Workbook object" , EOL;
|
echo date('H:i:s') , " Create new PHPExcel Workbook object" , EOL;
|
||||||
$objPHPExcel = new PHPExcel\Workbook();
|
$objPHPExcel = new PHPExcel\Workbook();
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
|
|||||||
require_once '../Classes/Bootstrap.php';
|
require_once '../Classes/Bootstrap.php';
|
||||||
|
|
||||||
|
|
||||||
// Create new PHPExcel object
|
// Create new PHPExcel Workbook object
|
||||||
echo date('H:i:s') , " Create new PHPExcel Workbook object" , EOL;
|
echo date('H:i:s') , " Create new PHPExcel Workbook object" , EOL;
|
||||||
$objPHPExcel = new PHPExcel\Workbook();
|
$objPHPExcel = new PHPExcel\Workbook();
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ date_default_timezone_set('Europe/London');
|
|||||||
require_once '../Classes/Bootstrap.php';
|
require_once '../Classes/Bootstrap.php';
|
||||||
|
|
||||||
|
|
||||||
// Create new PHPExcel object
|
// Create new PHPExcel Workbook object
|
||||||
echo date('H:i:s') , " Create new PHPExcel Workbook object" , EOL;
|
echo date('H:i:s') , " Create new PHPExcel Workbook object" , EOL;
|
||||||
$objPHPExcel = new PHPExcel\Workbook();
|
$objPHPExcel = new PHPExcel\Workbook();
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ error_reporting(E_ALL);
|
|||||||
require_once '../Classes/Bootstrap.php';
|
require_once '../Classes/Bootstrap.php';
|
||||||
|
|
||||||
|
|
||||||
// Create new PHPExcel object
|
// Create new PHPExcel Workbook object
|
||||||
echo date('H:i:s') , " Create new PHPExcel Workbook object" , EOL;
|
echo date('H:i:s') , " Create new PHPExcel Workbook object" , EOL;
|
||||||
$objPHPExcel = new PHPExcel\Workbook();
|
$objPHPExcel = new PHPExcel\Workbook();
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ PHPExcel_Settings::setCacheStorageMethod($cacheMethod);
|
|||||||
echo date('H:i:s') , " Enable Cell Caching using " , $cacheMethod , " method" , EOL;
|
echo date('H:i:s') , " Enable Cell Caching using " , $cacheMethod , " method" , EOL;
|
||||||
|
|
||||||
|
|
||||||
// Create new PHPExcel object
|
// Create new PHPExcel Workbook object
|
||||||
echo date('H:i:s') , " Create new PHPExcel object" , EOL;
|
echo date('H:i:s') , " Create new PHPExcel object" , EOL;
|
||||||
$objPHPExcel = new PHPExcel();
|
$objPHPExcel = new PHPExcel();
|
||||||
|
|
||||||
|
@ -34,17 +34,17 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
|
|||||||
|
|
||||||
date_default_timezone_set('Europe/London');
|
date_default_timezone_set('Europe/London');
|
||||||
|
|
||||||
/** Include PHPExcel */
|
/** Include PHPExcel Bootstrap */
|
||||||
require_once '../Classes/PHPExcel.php';
|
require_once '../Classes/Bootstrap.php';
|
||||||
|
|
||||||
$cacheMethod = PHPExcel_CachedObjectStorageFactory::cache_to_sqlite3;
|
$cacheMethod = PHPExcel_CachedObjectStorageFactory::cache_to_sqlite3;
|
||||||
PHPExcel_Settings::setCacheStorageMethod($cacheMethod);
|
PHPExcel_Settings::setCacheStorageMethod($cacheMethod);
|
||||||
echo date('H:i:s') , " Enable Cell Caching using " , $cacheMethod , " method" , EOL;
|
echo date('H:i:s') , " Enable Cell Caching using " , $cacheMethod , " method" , EOL;
|
||||||
|
|
||||||
|
|
||||||
// Create new PHPExcel object
|
// Create new PHPExcel Workbook object
|
||||||
echo date('H:i:s') , " Create new PHPExcel object" , EOL;
|
echo date('H:i:s') , " Create new PHPExcel Workbook object" , EOL;
|
||||||
$objPHPExcel = new PHPExcel();
|
$objPHPExcel = new PHPExcel\Workbook();
|
||||||
|
|
||||||
// Set document properties
|
// Set document properties
|
||||||
echo date('H:i:s') , " Set properties" , EOL;
|
echo date('H:i:s') , " Set properties" , EOL;
|
||||||
|
@ -44,7 +44,7 @@ if (!PHPExcel\Settings::setCacheStorageMethod($cacheMethod)) {
|
|||||||
echo date('H:i:s') , " Enable Cell Caching using " , $cacheMethod , " method" , EOL;
|
echo date('H:i:s') , " Enable Cell Caching using " , $cacheMethod , " method" , EOL;
|
||||||
|
|
||||||
|
|
||||||
// Create new PHPExcel object
|
// Create new PHPExcel Workbook object
|
||||||
echo date('H:i:s') , " Create new PHPExcel Workbook object" , EOL;
|
echo date('H:i:s') , " Create new PHPExcel Workbook object" , EOL;
|
||||||
$objPHPExcel = new PHPExcel\Workbook();
|
$objPHPExcel = new PHPExcel\Workbook();
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ for writing to Excel2007:
|
|||||||
15000 465
|
15000 465
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Create new PHPExcel object
|
// Create new PHPExcel Workbook object
|
||||||
echo date('H:i:s') , " Create new PHPExcel Workbook object" , EOL;
|
echo date('H:i:s') , " Create new PHPExcel Workbook object" , EOL;
|
||||||
$objPHPExcel = new PHPExcel\Workbook();
|
$objPHPExcel = new PHPExcel\Workbook();
|
||||||
|
|
||||||
|
@ -34,13 +34,13 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
|
|||||||
|
|
||||||
date_default_timezone_set('Europe/London');
|
date_default_timezone_set('Europe/London');
|
||||||
|
|
||||||
/** Include PHPExcel */
|
/** Include PHPExcel Bootstrap */
|
||||||
require_once '../Classes/PHPExcel.php';
|
require_once '../Classes/Bootstrap.php';
|
||||||
|
|
||||||
|
|
||||||
// Create new PHPExcel object
|
// Create new PHPExcel Workbook object
|
||||||
echo date('H:i:s') , " Create new PHPExcel object" , EOL;
|
echo date('H:i:s') , " Create new PHPExcel Workbook object" , EOL;
|
||||||
$objPHPExcel = new PHPExcel();
|
$objPHPExcel = new PHPExcel\Workbook();
|
||||||
|
|
||||||
// Set document properties
|
// Set document properties
|
||||||
echo date('H:i:s') , " Set document properties" , EOL;
|
echo date('H:i:s') , " Set document properties" , EOL;
|
||||||
@ -86,30 +86,30 @@ $objPHPExcel->getActiveSheet()->getColumnDimension('B')->setWidth(12);
|
|||||||
|
|
||||||
// Add conditional formatting
|
// Add conditional formatting
|
||||||
echo date('H:i:s') , " Add conditional formatting" , EOL;
|
echo date('H:i:s') , " Add conditional formatting" , EOL;
|
||||||
$objConditional1 = new PHPExcel_Style_Conditional();
|
$objConditional1 = new PHPExcel\Style_Conditional();
|
||||||
$objConditional1->setConditionType(PHPExcel_Style_Conditional::CONDITION_CELLIS)
|
$objConditional1->setConditionType(PHPExcel\Style_Conditional::CONDITION_CELLIS)
|
||||||
->setOperatorType(PHPExcel_Style_Conditional::OPERATOR_BETWEEN)
|
->setOperatorType(PHPExcel\Style_Conditional::OPERATOR_BETWEEN)
|
||||||
->addCondition('200')
|
->addCondition('200')
|
||||||
->addCondition('400');
|
->addCondition('400');
|
||||||
$objConditional1->getStyle()->getFont()->getColor()->setARGB(PHPExcel_Style_Color::COLOR_YELLOW);
|
$objConditional1->getStyle()->getFont()->getColor()->setARGB(PHPExcel\Style_Color::COLOR_YELLOW);
|
||||||
$objConditional1->getStyle()->getFont()->setBold(true);
|
$objConditional1->getStyle()->getFont()->setBold(true);
|
||||||
$objConditional1->getStyle()->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE);
|
$objConditional1->getStyle()->getNumberFormat()->setFormatCode(PHPExcel\Style_NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE);
|
||||||
|
|
||||||
$objConditional2 = new PHPExcel_Style_Conditional();
|
$objConditional2 = new PHPExcel\Style_Conditional();
|
||||||
$objConditional2->setConditionType(PHPExcel_Style_Conditional::CONDITION_CELLIS)
|
$objConditional2->setConditionType(PHPExcel\Style_Conditional::CONDITION_CELLIS)
|
||||||
->setOperatorType(PHPExcel_Style_Conditional::OPERATOR_LESSTHAN)
|
->setOperatorType(PHPExcel\Style_Conditional::OPERATOR_LESSTHAN)
|
||||||
->addCondition('0');
|
->addCondition('0');
|
||||||
$objConditional2->getStyle()->getFont()->getColor()->setARGB(PHPExcel_Style_Color::COLOR_RED);
|
$objConditional2->getStyle()->getFont()->getColor()->setARGB(PHPExcel\Style_Color::COLOR_RED);
|
||||||
$objConditional2->getStyle()->getFont()->setItalic(true);
|
$objConditional2->getStyle()->getFont()->setItalic(true);
|
||||||
$objConditional2->getStyle()->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE);
|
$objConditional2->getStyle()->getNumberFormat()->setFormatCode(PHPExcel\Style_NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE);
|
||||||
|
|
||||||
$objConditional3 = new PHPExcel_Style_Conditional();
|
$objConditional3 = new PHPExcel\Style_Conditional();
|
||||||
$objConditional3->setConditionType(PHPExcel_Style_Conditional::CONDITION_CELLIS)
|
$objConditional3->setConditionType(PHPExcel\Style_Conditional::CONDITION_CELLIS)
|
||||||
->setOperatorType(PHPExcel_Style_Conditional::OPERATOR_GREATERTHANOREQUAL)
|
->setOperatorType(PHPExcel\Style_Conditional::OPERATOR_GREATERTHANOREQUAL)
|
||||||
->addCondition('0');
|
->addCondition('0');
|
||||||
$objConditional3->getStyle()->getFont()->getColor()->setARGB(PHPExcel_Style_Color::COLOR_GREEN);
|
$objConditional3->getStyle()->getFont()->getColor()->setARGB(PHPExcel\Style_Color::COLOR_GREEN);
|
||||||
$objConditional3->getStyle()->getFont()->setItalic(true);
|
$objConditional3->getStyle()->getFont()->setItalic(true);
|
||||||
$objConditional3->getStyle()->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE);
|
$objConditional3->getStyle()->getNumberFormat()->setFormatCode(PHPExcel\Style_NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE);
|
||||||
|
|
||||||
$conditionalStyles = $objPHPExcel->getActiveSheet()->getStyle('B2')->getConditionalStyles();
|
$conditionalStyles = $objPHPExcel->getActiveSheet()->getStyle('B2')->getConditionalStyles();
|
||||||
array_push($conditionalStyles, $objConditional1);
|
array_push($conditionalStyles, $objConditional1);
|
||||||
@ -142,8 +142,8 @@ $objPHPExcel->getActiveSheet()->getHeaderFooter()->setOddFooter('&L&B' . $objPHP
|
|||||||
|
|
||||||
// Set page orientation and size
|
// Set page orientation and size
|
||||||
echo date('H:i:s') , " Set page orientation and size" , EOL;
|
echo date('H:i:s') , " Set page orientation and size" , EOL;
|
||||||
$objPHPExcel->getActiveSheet()->getPageSetup()->setOrientation(PHPExcel_Worksheet_PageSetup::ORIENTATION_PORTRAIT);
|
$objPHPExcel->getActiveSheet()->getPageSetup()->setOrientation(PHPExcel\Worksheet_PageSetup::ORIENTATION_PORTRAIT);
|
||||||
$objPHPExcel->getActiveSheet()->getPageSetup()->setPaperSize(PHPExcel_Worksheet_PageSetup::PAPERSIZE_A4);
|
$objPHPExcel->getActiveSheet()->getPageSetup()->setPaperSize(PHPExcel\Worksheet_PageSetup::PAPERSIZE_A4);
|
||||||
|
|
||||||
|
|
||||||
// Rename worksheet
|
// Rename worksheet
|
||||||
@ -159,7 +159,7 @@ $objPHPExcel->setActiveSheetIndex(0);
|
|||||||
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
|
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
$objWriter = PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
||||||
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
||||||
$callEndTime = microtime(true);
|
$callEndTime = microtime(true);
|
||||||
$callTime = $callEndTime - $callStartTime;
|
$callTime = $callEndTime - $callStartTime;
|
||||||
@ -170,7 +170,7 @@ echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds"
|
|||||||
echo date('H:i:s') , " Write to Excel5 format" , EOL;
|
echo date('H:i:s') , " Write to Excel5 format" , EOL;
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
|
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
|
$objWriter = PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel5');
|
||||||
$objWriter->save(str_replace('.php', '.xls', __FILE__));
|
$objWriter->save(str_replace('.php', '.xls', __FILE__));
|
||||||
$callEndTime = microtime(true);
|
$callEndTime = microtime(true);
|
||||||
$callTime = $callEndTime - $callStartTime;
|
$callTime = $callEndTime - $callStartTime;
|
||||||
|
@ -34,13 +34,13 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
|
|||||||
|
|
||||||
date_default_timezone_set('Europe/London');
|
date_default_timezone_set('Europe/London');
|
||||||
|
|
||||||
/** Include PHPExcel */
|
/** Include PHPExcel Bootstrap */
|
||||||
require_once '../Classes/PHPExcel.php';
|
require_once '../Classes/Bootstrap.php';
|
||||||
|
|
||||||
|
|
||||||
// Create new PHPExcel object
|
// Create new PHPExcel Workbook object
|
||||||
echo date('H:i:s') , " Create new PHPExcel object" , EOL;
|
echo date('H:i:s') , " Create new PHPExcel Workbook object" , EOL;
|
||||||
$objPHPExcel = new PHPExcel();
|
$objPHPExcel = new PHPExcel\Workbook();
|
||||||
|
|
||||||
// Set document properties
|
// Set document properties
|
||||||
echo date('H:i:s') , " Set document properties" , EOL;
|
echo date('H:i:s') , " Set document properties" , EOL;
|
||||||
@ -70,23 +70,23 @@ $objPHPExcel->getActiveSheet()
|
|||||||
$objPHPExcel->getActiveSheet()->getStyle('A1:A8')
|
$objPHPExcel->getActiveSheet()->getStyle('A1:A8')
|
||||||
->getNumberFormat()
|
->getNumberFormat()
|
||||||
->setFormatCode(
|
->setFormatCode(
|
||||||
PHPExcel_Style_NumberFormat::FORMAT_PERCENTAGE_00
|
PHPExcel\Style_NumberFormat::FORMAT_PERCENTAGE_00
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
// Add conditional formatting
|
// Add conditional formatting
|
||||||
echo date('H:i:s') , " Add conditional formatting" , EOL;
|
echo date('H:i:s') , " Add conditional formatting" , EOL;
|
||||||
$objConditional1 = new PHPExcel_Style_Conditional();
|
$objConditional1 = new PHPExcel\Style_Conditional();
|
||||||
$objConditional1->setConditionType(PHPExcel_Style_Conditional::CONDITION_CELLIS)
|
$objConditional1->setConditionType(PHPExcel\Style_Conditional::CONDITION_CELLIS)
|
||||||
->setOperatorType(PHPExcel_Style_Conditional::OPERATOR_LESSTHAN)
|
->setOperatorType(PHPExcel\Style_Conditional::OPERATOR_LESSTHAN)
|
||||||
->addCondition('0');
|
->addCondition('0');
|
||||||
$objConditional1->getStyle()->getFont()->getColor()->setARGB(PHPExcel_Style_Color::COLOR_RED);
|
$objConditional1->getStyle()->getFont()->getColor()->setARGB(PHPExcel\Style_Color::COLOR_RED);
|
||||||
|
|
||||||
$objConditional3 = new PHPExcel_Style_Conditional();
|
$objConditional3 = new PHPExcel\Style_Conditional();
|
||||||
$objConditional3->setConditionType(PHPExcel_Style_Conditional::CONDITION_CELLIS)
|
$objConditional3->setConditionType(PHPExcel\Style_Conditional::CONDITION_CELLIS)
|
||||||
->setOperatorType(PHPExcel_Style_Conditional::OPERATOR_GREATERTHANOREQUAL)
|
->setOperatorType(PHPExcel\Style_Conditional::OPERATOR_GREATERTHANOREQUAL)
|
||||||
->addCondition('1');
|
->addCondition('1');
|
||||||
$objConditional3->getStyle()->getFont()->getColor()->setARGB(PHPExcel_Style_Color::COLOR_GREEN);
|
$objConditional3->getStyle()->getFont()->getColor()->setARGB(PHPExcel\Style_Color::COLOR_GREEN);
|
||||||
|
|
||||||
$conditionalStyles = $objPHPExcel->getActiveSheet()->getStyle('A1')->getConditionalStyles();
|
$conditionalStyles = $objPHPExcel->getActiveSheet()->getStyle('A1')->getConditionalStyles();
|
||||||
array_push($conditionalStyles, $objConditional1);
|
array_push($conditionalStyles, $objConditional1);
|
||||||
@ -106,7 +106,7 @@ $objPHPExcel->getActiveSheet()->duplicateConditionalStyle(
|
|||||||
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
|
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
$objWriter = PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
||||||
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
||||||
$callEndTime = microtime(true);
|
$callEndTime = microtime(true);
|
||||||
$callTime = $callEndTime - $callStartTime;
|
$callTime = $callEndTime - $callStartTime;
|
||||||
@ -117,7 +117,7 @@ echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds"
|
|||||||
echo date('H:i:s') , " Write to Excel5 format" , EOL;
|
echo date('H:i:s') , " Write to Excel5 format" , EOL;
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
|
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
|
$objWriter = PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel5');
|
||||||
$objWriter->save(str_replace('.php', '.xls', __FILE__));
|
$objWriter->save(str_replace('.php', '.xls', __FILE__));
|
||||||
$callEndTime = microtime(true);
|
$callEndTime = microtime(true);
|
||||||
$callTime = $callEndTime - $callStartTime;
|
$callTime = $callEndTime - $callStartTime;
|
||||||
|
@ -35,12 +35,13 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
|
|||||||
date_default_timezone_set('Europe/London');
|
date_default_timezone_set('Europe/London');
|
||||||
|
|
||||||
/** Include PHPExcel */
|
/** Include PHPExcel */
|
||||||
require_once '../Classes/PHPExcel.php';
|
/** Include PHPExcel Bootstrap */
|
||||||
|
require_once '../Classes/Bootstrap.php';
|
||||||
|
|
||||||
|
|
||||||
// Create new PHPExcel object
|
// Create new PHPExcel Workbook object
|
||||||
echo date('H:i:s') , " Create new PHPExcel object" , EOL;
|
echo date('H:i:s') , " Create new PHPExcel Workbook object" , EOL;
|
||||||
$objPHPExcel = new PHPExcel();
|
$objPHPExcel = new PHPExcel\Workbook();
|
||||||
|
|
||||||
// Set document properties
|
// Set document properties
|
||||||
echo date('H:i:s') , " Set document properties" , EOL;
|
echo date('H:i:s') , " Set document properties" , EOL;
|
||||||
@ -74,7 +75,7 @@ for ($i = 2; $i <= 50; $i++) {
|
|||||||
// Add page breaks every 10 rows
|
// Add page breaks every 10 rows
|
||||||
if ($i % 10 == 0) {
|
if ($i % 10 == 0) {
|
||||||
// Add a page break
|
// Add a page break
|
||||||
$objPHPExcel->getActiveSheet()->setBreak( 'A' . $i, PHPExcel_Worksheet::BREAK_ROW );
|
$objPHPExcel->getActiveSheet()->setBreak( 'A' . $i, PHPExcel\Worksheet::BREAK_ROW );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,7 +88,7 @@ $objPHPExcel->setActiveSheetIndex(0);
|
|||||||
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
|
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
$objWriter = PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
||||||
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
||||||
$callEndTime = microtime(true);
|
$callEndTime = microtime(true);
|
||||||
$callTime = $callEndTime - $callStartTime;
|
$callTime = $callEndTime - $callStartTime;
|
||||||
@ -102,7 +103,7 @@ echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024
|
|||||||
echo date('H:i:s') , " Write to Excel5 format" , EOL;
|
echo date('H:i:s') , " Write to Excel5 format" , EOL;
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
|
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
|
$objWriter = PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel5');
|
||||||
$objWriter->save(str_replace('.php', '.xls', __FILE__));
|
$objWriter->save(str_replace('.php', '.xls', __FILE__));
|
||||||
$callEndTime = microtime(true);
|
$callEndTime = microtime(true);
|
||||||
$callTime = $callEndTime - $callStartTime;
|
$callTime = $callEndTime - $callStartTime;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user