初始上传

This commit is contained in:
2026-04-04 17:27:12 +08:00
parent 4d80d28eb4
commit b7e11774ee
11191 changed files with 1588469 additions and 0 deletions

View File

@@ -0,0 +1,90 @@
<?php
error_reporting(E_ALL);
set_time_limit(0);
date_default_timezone_set('Europe/London');
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>PHPExcel Calculation Examples</title>
</head>
<body>
<h1>DAVERAGE</h1>
<h2>Returns the average of selected database entries.</h2>
<?php
/** Include path **/
set_include_path(get_include_path() . PATH_SEPARATOR . '../../../../Classes/');
/** Include PHPExcel */
include 'PHPExcel.php';
// Create new PHPExcel object
$objPHPExcel = new PHPExcel();
$worksheet = $objPHPExcel->getActiveSheet();
// Add some data
$database = array( array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ),
array( 'Apple', 18, 20, 14, 105.00 ),
array( 'Pear', 12, 12, 10, 96.00 ),
array( 'Cherry', 13, 14, 9, 105.00 ),
array( 'Apple', 14, 15, 10, 75.00 ),
array( 'Pear', 9, 8, 8, 76.80 ),
array( 'Apple', 8, 9, 6, 45.00 ),
);
$criteria = array( array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ),
array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ),
array( '="=Pear"', NULL, NULL, NULL, NULL, NULL )
);
$worksheet->fromArray( $criteria, NULL, 'A1' );
$worksheet->fromArray( $database, NULL, 'A4' );
$worksheet->setCellValue('A12', 'The Average yield of Apple trees over 10\' in height');
$worksheet->setCellValue('B12', '=DAVERAGE(A4:E10,"Yield",A1:B2)');
$worksheet->setCellValue('A13', 'The Average age of all Apple and Pear trees in the orchard');
$worksheet->setCellValue('B13', '=DAVERAGE(A4:E10,3,A1:A3)');
echo '<hr />';
echo '<h4>Database</h4>';
$databaseData = $worksheet->rangeToArray('A4:E10',null,true,true,true);
var_dump($databaseData);
echo '<hr />';
// Test the formulae
echo '<h4>Criteria</h4>';
$criteriaData = $worksheet->rangeToArray('A1:B2',null,true,true,true);
var_dump($criteriaData);
echo $worksheet->getCell("A12")->getValue() .'<br />';
echo 'DAVERAGE() Result is ' . $worksheet->getCell("B12")->getCalculatedValue() .'<br /><br />';
echo '<h4>Criteria</h4>';
$criteriaData = $worksheet->rangeToArray('A1:A3',null,true,true,true);
var_dump($criteriaData);
echo $worksheet->getCell("A13")->getValue() .'<br />';
echo 'DAVERAGE() Result is ' . $worksheet->getCell("B13")->getCalculatedValue();
?>
<body>
</html>

View File

@@ -0,0 +1,90 @@
<?php
error_reporting(E_ALL);
set_time_limit(0);
date_default_timezone_set('Europe/London');
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>PHPExcel Calculation Examples</title>
</head>
<body>
<h1>DCOUNT</h1>
<h2>Counts the cells that contain numbers in a database.</h2>
<?php
/** Include path **/
set_include_path(get_include_path() . PATH_SEPARATOR . '../../../../Classes/');
/** Include PHPExcel */
include 'PHPExcel.php';
// Create new PHPExcel object
$objPHPExcel = new PHPExcel();
$worksheet = $objPHPExcel->getActiveSheet();
// Add some data
$database = array( array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ),
array( 'Apple', 18, 20, 14, 105.00 ),
array( 'Pear', 12, 12, 10, 96.00 ),
array( 'Cherry', 13, 14, 9, 105.00 ),
array( 'Apple', 14, 15, 10, 75.00 ),
array( 'Pear', 9, 8, 8, 76.80 ),
array( 'Apple', 8, 9, 6, 45.00 ),
);
$criteria = array( array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ),
array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ),
array( '="=Pear"', NULL, NULL, NULL, NULL, NULL )
);
$worksheet->fromArray( $criteria, NULL, 'A1' );
$worksheet->fromArray( $database, NULL, 'A4' );
$worksheet->setCellValue('A12', 'The Number of Apple trees over 10\' in height');
$worksheet->setCellValue('B12', '=DCOUNT(A4:E10,"Yield",A1:B2)');
$worksheet->setCellValue('A13', 'The Number of Apple and Pear trees in the orchard');
$worksheet->setCellValue('B13', '=DCOUNT(A4:E10,3,A1:A3)');
echo '<hr />';
echo '<h4>Database</h4>';
$databaseData = $worksheet->rangeToArray('A4:E10',null,true,true,true);
var_dump($databaseData);
echo '<hr />';
// Test the formulae
echo '<h4>Criteria</h4>';
$criteriaData = $worksheet->rangeToArray('A1:B2',null,true,true,true);
var_dump($criteriaData);
echo $worksheet->getCell("A12")->getValue() .'<br />';
echo 'DCOUNT() Result is ' . $worksheet->getCell("B12")->getCalculatedValue() .'<br /><br />';
echo '<h4>Criteria</h4>';
$criteriaData = $worksheet->rangeToArray('A1:A3',null,true,true,true);
var_dump($criteriaData);
echo $worksheet->getCell("A13")->getValue() .'<br />';
echo 'DCOUNT() Result is ' . $worksheet->getCell("B13")->getCalculatedValue();
?>
<body>
</html>

View File

@@ -0,0 +1,86 @@
<?php
error_reporting(E_ALL);
set_time_limit(0);
date_default_timezone_set('Europe/London');
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>PHPExcel Calculation Examples</title>
</head>
<body>
<h1>DGET</h1>
<h2>Extracts a single value from a column of a list or database that matches conditions that you specify.</h2>
<?php
/** Include path **/
set_include_path(get_include_path() . PATH_SEPARATOR . '../../../../Classes/');
/** Include PHPExcel */
include 'PHPExcel.php';
// Create new PHPExcel object
$objPHPExcel = new PHPExcel();
$worksheet = $objPHPExcel->getActiveSheet();
// Add some data
$database = array( array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ),
array( 'Apple', 18, 20, 14, 105.00 ),
array( 'Pear', 12, 12, 10, 96.00 ),
array( 'Cherry', 13, 14, 9, 105.00 ),
array( 'Apple', 14, 15, 10, 75.00 ),
array( 'Pear', 9, 8, 8, 76.80 ),
array( 'Apple', 8, 9, 6, 45.00 ),
);
$criteria = array( array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ),
array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ),
array( '="=Pear"', NULL, NULL, NULL, NULL, NULL )
);
$worksheet->fromArray( $criteria, NULL, 'A1' );
$worksheet->fromArray( $database, NULL, 'A4' );
$worksheet->setCellValue('A12', 'The height of the Apple tree between 10\' and 16\' tall');
$worksheet->setCellValue('B12', '=DGET(A4:E10,"Height",A1:F2)');
echo '<hr />';
echo '<h4>Database</h4>';
$databaseData = $worksheet->rangeToArray('A4:E10',null,true,true,true);
var_dump($databaseData);
echo '<hr />';
// Test the formulae
echo '<h4>Criteria</h4>';
echo 'ALL' . '<br /><br />';
echo $worksheet->getCell("A12")->getValue() .'<br />';
echo 'DMAX() Result is ' . $worksheet->getCell("B12")->getCalculatedValue() .'<br /><br />';
echo '<h4>Criteria</h4>';
$criteriaData = $worksheet->rangeToArray('A1:A2',null,true,true,true);
var_dump($criteriaData);
echo $worksheet->getCell("A13")->getValue() .'<br />';
echo 'DMAX() Result is ' . $worksheet->getCell("B13")->getCalculatedValue();
?>
<body>
</html>

View File

@@ -0,0 +1,89 @@
<?php
error_reporting(E_ALL);
set_time_limit(0);
date_default_timezone_set('Europe/London');
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>PHPExcel Calculation Examples</title>
</head>
<body>
<h1>DMAX</h1>
<h2>Returns the maximum value from selected database entries.</h2>
<?php
/** Include path **/
set_include_path(get_include_path() . PATH_SEPARATOR . '../../../../Classes/');
/** Include PHPExcel */
include 'PHPExcel.php';
// Create new PHPExcel object
$objPHPExcel = new PHPExcel();
$worksheet = $objPHPExcel->getActiveSheet();
// Add some data
$database = array( array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ),
array( 'Apple', 18, 20, 14, 105.00 ),
array( 'Pear', 12, 12, 10, 96.00 ),
array( 'Cherry', 13, 14, 9, 105.00 ),
array( 'Apple', 14, 15, 10, 75.00 ),
array( 'Pear', 9, 8, 8, 76.80 ),
array( 'Apple', 8, 9, 6, 45.00 ),
);
$criteria = array( array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ),
array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ),
array( '="=Pear"', NULL, NULL, NULL, NULL, NULL )
);
$worksheet->fromArray( $criteria, NULL, 'A1' );
$worksheet->fromArray( $database, NULL, 'A4' );
$worksheet->setCellValue('A12', 'The tallest tree in the orchard');
$worksheet->setCellValue('B12', '=DMAX(A4:E10,"Height",A4:E10)');
$worksheet->setCellValue('A13', 'The Oldest apple tree in the orchard');
$worksheet->setCellValue('B13', '=DMAX(A4:E10,3,A1:A2)');
echo '<hr />';
echo '<h4>Database</h4>';
$databaseData = $worksheet->rangeToArray('A4:E10',null,true,true,true);
var_dump($databaseData);
echo '<hr />';
// Test the formulae
echo '<h4>Criteria</h4>';
echo 'ALL' . '<br /><br />';
echo $worksheet->getCell("A12")->getValue() .'<br />';
echo 'DMAX() Result is ' . $worksheet->getCell("B12")->getCalculatedValue() .'<br /><br />';
echo '<h4>Criteria</h4>';
$criteriaData = $worksheet->rangeToArray('A1:A2',null,true,true,true);
var_dump($criteriaData);
echo $worksheet->getCell("A13")->getValue() .'<br />';
echo 'DMAX() Result is ' . $worksheet->getCell("B13")->getCalculatedValue();
?>
<body>
</html>

View File

@@ -0,0 +1,89 @@
<?php
error_reporting(E_ALL);
set_time_limit(0);
date_default_timezone_set('Europe/London');
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>PHPExcel Calculation Examples</title>
</head>
<body>
<h1>DMIN</h1>
<h2>Returns the minimum value from selected database entries.</h2>
<?php
/** Include path **/
set_include_path(get_include_path() . PATH_SEPARATOR . '../../../../Classes/');
/** Include PHPExcel */
include 'PHPExcel.php';
// Create new PHPExcel object
$objPHPExcel = new PHPExcel();
$worksheet = $objPHPExcel->getActiveSheet();
// Add some data
$database = array( array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ),
array( 'Apple', 18, 20, 14, 105.00 ),
array( 'Pear', 12, 12, 10, 96.00 ),
array( 'Cherry', 13, 14, 9, 105.00 ),
array( 'Apple', 14, 15, 10, 75.00 ),
array( 'Pear', 9, 8, 8, 76.80 ),
array( 'Apple', 8, 9, 6, 45.00 ),
);
$criteria = array( array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ),
array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ),
array( '="=Pear"', NULL, NULL, NULL, NULL, NULL )
);
$worksheet->fromArray( $criteria, NULL, 'A1' );
$worksheet->fromArray( $database, NULL, 'A4' );
$worksheet->setCellValue('A12', 'The shortest tree in the orchard');
$worksheet->setCellValue('B12', '=DMIN(A4:E10,"Height",A4:E10)');
$worksheet->setCellValue('A13', 'The Youngest apple tree in the orchard');
$worksheet->setCellValue('B13', '=DMIN(A4:E10,3,A1:A2)');
echo '<hr />';
echo '<h4>Database</h4>';
$databaseData = $worksheet->rangeToArray('A4:E10',null,true,true,true);
var_dump($databaseData);
echo '<hr />';
// Test the formulae
echo '<h4>Criteria</h4>';
echo 'ALL' . '<br /><br />';
echo $worksheet->getCell("A12")->getValue() .'<br />';
echo 'DMIN() Result is ' . $worksheet->getCell("B12")->getCalculatedValue() .'<br /><br />';
echo '<h4>Criteria</h4>';
$criteriaData = $worksheet->rangeToArray('A1:A2',null,true,true,true);
var_dump($criteriaData);
echo $worksheet->getCell("A13")->getValue() .'<br />';
echo 'DMIN() Result is ' . $worksheet->getCell("B13")->getCalculatedValue();
?>
<body>
</html>

View File

@@ -0,0 +1,87 @@
<?php
error_reporting(E_ALL);
set_time_limit(0);
date_default_timezone_set('Europe/London');
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>PHPExcel Calculation Examples</title>
</head>
<body>
<h1>DPRODUCT</h1>
<h2>Multiplies the values in a column of a list or database that match conditions that you specify.</h2>
<?php
/** Include path **/
set_include_path(get_include_path() . PATH_SEPARATOR . '../../../../Classes/');
/** Include PHPExcel */
include 'PHPExcel.php';
// Create new PHPExcel object
$objPHPExcel = new PHPExcel();
$worksheet = $objPHPExcel->getActiveSheet();
// Add some data
$database = array( array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ),
array( 'Apple', 18, 20, 14, 105.00 ),
array( 'Pear', 12, 12, 10, 96.00 ),
array( 'Cherry', 13, 14, 9, 105.00 ),
array( 'Apple', 14, 15, 10, 75.00 ),
array( 'Pear', 9, 8, 8, 76.80 ),
array( 'Apple', 8, 9, 6, 45.00 ),
);
$criteria = array( array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ),
array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ),
array( '="=Pear"', NULL, NULL, NULL, NULL, NULL )
);
$worksheet->fromArray( $criteria, NULL, 'A1' );
$worksheet->fromArray( $database, NULL, 'A4' );
$worksheet->setCellValue('A12', 'The product of the yields of all Apple trees over 10\' in the orchard');
$worksheet->setCellValue('B12', '=DPRODUCT(A4:E10,"Yield",A1:B2)');
echo '<hr />';
echo '<h4>Database</h4>';
$databaseData = $worksheet->rangeToArray('A4:E10',null,true,true,true);
var_dump($databaseData);
echo '<hr />';
// Test the formulae
echo '<h4>Criteria</h4>';
echo 'ALL' . '<br /><br />';
echo $worksheet->getCell("A12")->getValue() .'<br />';
echo 'DMAX() Result is ' . $worksheet->getCell("B12")->getCalculatedValue() .'<br /><br />';
echo '<h4>Criteria</h4>';
$criteriaData = $worksheet->rangeToArray('A1:A2',null,true,true,true);
var_dump($criteriaData);
echo $worksheet->getCell("A13")->getValue() .'<br />';
echo 'DMAX() Result is ' . $worksheet->getCell("B13")->getCalculatedValue();
?>
<body>
</html>

View File

@@ -0,0 +1,90 @@
<?php
error_reporting(E_ALL);
set_time_limit(0);
date_default_timezone_set('Europe/London');
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>PHPExcel Calculation Examples</title>
</head>
<body>
<h1>DSTDEV</h1>
<h2>Estimates the standard deviation based on a sample of selected database entries.</h2>
<?php
/** Include path **/
set_include_path(get_include_path() . PATH_SEPARATOR . '../../../../Classes/');
/** Include PHPExcel */
include 'PHPExcel.php';
// Create new PHPExcel object
$objPHPExcel = new PHPExcel();
$worksheet = $objPHPExcel->getActiveSheet();
// Add some data
$database = array( array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ),
array( 'Apple', 18, 20, 14, 105.00 ),
array( 'Pear', 12, 12, 10, 96.00 ),
array( 'Cherry', 13, 14, 9, 105.00 ),
array( 'Apple', 14, 15, 10, 75.00 ),
array( 'Pear', 9, 8, 8, 76.80 ),
array( 'Apple', 8, 9, 6, 45.00 ),
);
$criteria = array( array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ),
array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ),
array( '="=Pear"', NULL, NULL, NULL, NULL, NULL )
);
$worksheet->fromArray( $criteria, NULL, 'A1' );
$worksheet->fromArray( $database, NULL, 'A4' );
$worksheet->setCellValue('A12', 'The estimated standard deviation in the yield of Apple and Pear trees');
$worksheet->setCellValue('B12', '=DSTDEV(A4:E10,"Yield",A1:A3)');
$worksheet->setCellValue('A13', 'The estimated standard deviation in height of Apple and Pear trees');
$worksheet->setCellValue('B13', '=DSTDEV(A4:E10,2,A1:A3)');
echo '<hr />';
echo '<h4>Database</h4>';
$databaseData = $worksheet->rangeToArray('A4:E10',null,true,true,true);
var_dump($databaseData);
echo '<hr />';
// Test the formulae
echo '<h4>Criteria</h4>';
$criteriaData = $worksheet->rangeToArray('A1:A3',null,true,true,true);
var_dump($criteriaData);
echo $worksheet->getCell("A12")->getValue() .'<br />';
echo 'DSTDEV() Result is ' . $worksheet->getCell("B12")->getCalculatedValue() .'<br /><br />';
echo '<h4>Criteria</h4>';
$criteriaData = $worksheet->rangeToArray('A1:A3',null,true,true,true);
var_dump($criteriaData);
echo $worksheet->getCell("A13")->getValue() .'<br />';
echo 'DSTDEV() Result is ' . $worksheet->getCell("B13")->getCalculatedValue();
?>
<body>
</html>

View File

@@ -0,0 +1,90 @@
<?php
error_reporting(E_ALL);
set_time_limit(0);
date_default_timezone_set('Europe/London');
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>PHPExcel Calculation Examples</title>
</head>
<body>
<h1>DSTDEVP</h1>
<h2>Calculates the standard deviation based on the entire population of selected database entries.</h2>
<?php
/** Include path **/
set_include_path(get_include_path() . PATH_SEPARATOR . '../../../../Classes/');
/** Include PHPExcel */
include 'PHPExcel.php';
// Create new PHPExcel object
$objPHPExcel = new PHPExcel();
$worksheet = $objPHPExcel->getActiveSheet();
// Add some data
$database = array( array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ),
array( 'Apple', 18, 20, 14, 105.00 ),
array( 'Pear', 12, 12, 10, 96.00 ),
array( 'Cherry', 13, 14, 9, 105.00 ),
array( 'Apple', 14, 15, 10, 75.00 ),
array( 'Pear', 9, 8, 8, 76.80 ),
array( 'Apple', 8, 9, 6, 45.00 ),
);
$criteria = array( array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ),
array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ),
array( '="=Pear"', NULL, NULL, NULL, NULL, NULL )
);
$worksheet->fromArray( $criteria, NULL, 'A1' );
$worksheet->fromArray( $database, NULL, 'A4' );
$worksheet->setCellValue('A12', 'The standard deviation in the yield of Apple and Pear trees');
$worksheet->setCellValue('B12', '=DSTDEVP(A4:E10,"Yield",A1:A3)');
$worksheet->setCellValue('A13', 'The standard deviation in height of Apple and Pear trees');
$worksheet->setCellValue('B13', '=DSTDEVP(A4:E10,2,A1:A3)');
echo '<hr />';
echo '<h4>Database</h4>';
$databaseData = $worksheet->rangeToArray('A4:E10',null,true,true,true);
var_dump($databaseData);
echo '<hr />';
// Test the formulae
echo '<h4>Criteria</h4>';
$criteriaData = $worksheet->rangeToArray('A1:A3',null,true,true,true);
var_dump($criteriaData);
echo $worksheet->getCell("A12")->getValue() .'<br />';
echo 'DSTDEVP() Result is ' . $worksheet->getCell("B12")->getCalculatedValue() .'<br /><br />';
echo '<h4>Criteria</h4>';
$criteriaData = $worksheet->rangeToArray('A1:A3',null,true,true,true);
var_dump($criteriaData);
echo $worksheet->getCell("A13")->getValue() .'<br />';
echo 'DSTDEVP() Result is ' . $worksheet->getCell("B13")->getCalculatedValue();
?>
<body>
</html>

View File

@@ -0,0 +1,90 @@
<?php
error_reporting(E_ALL);
set_time_limit(0);
date_default_timezone_set('Europe/London');
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>PHPExcel Calculation Examples</title>
</head>
<body>
<h1>DVAR</h1>
<h2>Estimates variance based on a sample from selected database entries.</h2>
<?php
/** Include path **/
set_include_path(get_include_path() . PATH_SEPARATOR . '../../../../Classes/');
/** Include PHPExcel */
include 'PHPExcel.php';
// Create new PHPExcel object
$objPHPExcel = new PHPExcel();
$worksheet = $objPHPExcel->getActiveSheet();
// Add some data
$database = array( array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ),
array( 'Apple', 18, 20, 14, 105.00 ),
array( 'Pear', 12, 12, 10, 96.00 ),
array( 'Cherry', 13, 14, 9, 105.00 ),
array( 'Apple', 14, 15, 10, 75.00 ),
array( 'Pear', 9, 8, 8, 76.80 ),
array( 'Apple', 8, 9, 6, 45.00 ),
);
$criteria = array( array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ),
array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ),
array( '="=Pear"', NULL, NULL, NULL, NULL, NULL )
);
$worksheet->fromArray( $criteria, NULL, 'A1' );
$worksheet->fromArray( $database, NULL, 'A4' );
$worksheet->setCellValue('A12', 'The estimated variance in the yield of Apple and Pear trees');
$worksheet->setCellValue('B12', '=DVAR(A4:E10,"Yield",A1:A3)');
$worksheet->setCellValue('A13', 'The estimated variance in height of Apple and Pear trees');
$worksheet->setCellValue('B13', '=DVAR(A4:E10,2,A1:A3)');
echo '<hr />';
echo '<h4>Database</h4>';
$databaseData = $worksheet->rangeToArray('A4:E10',null,true,true,true);
var_dump($databaseData);
echo '<hr />';
// Test the formulae
echo '<h4>Criteria</h4>';
$criteriaData = $worksheet->rangeToArray('A1:A3',null,true,true,true);
var_dump($criteriaData);
echo $worksheet->getCell("A12")->getValue() .'<br />';
echo 'DVAR() Result is ' . $worksheet->getCell("B12")->getCalculatedValue() .'<br /><br />';
echo '<h4>Criteria</h4>';
$criteriaData = $worksheet->rangeToArray('A1:A3',null,true,true,true);
var_dump($criteriaData);
echo $worksheet->getCell("A13")->getValue() .'<br />';
echo 'DVAR() Result is ' . $worksheet->getCell("B13")->getCalculatedValue();
?>
<body>
</html>

View File

@@ -0,0 +1,90 @@
<?php
error_reporting(E_ALL);
set_time_limit(0);
date_default_timezone_set('Europe/London');
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>PHPExcel Calculation Examples</title>
</head>
<body>
<h1>DVARP</h1>
<h2>Calculates variance based on the entire population of selected database entries,</h2>
<?php
/** Include path **/
set_include_path(get_include_path() . PATH_SEPARATOR . '../../../../Classes/');
/** Include PHPExcel */
include 'PHPExcel.php';
// Create new PHPExcel object
$objPHPExcel = new PHPExcel();
$worksheet = $objPHPExcel->getActiveSheet();
// Add some data
$database = array( array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ),
array( 'Apple', 18, 20, 14, 105.00 ),
array( 'Pear', 12, 12, 10, 96.00 ),
array( 'Cherry', 13, 14, 9, 105.00 ),
array( 'Apple', 14, 15, 10, 75.00 ),
array( 'Pear', 9, 8, 8, 76.80 ),
array( 'Apple', 8, 9, 6, 45.00 ),
);
$criteria = array( array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ),
array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ),
array( '="=Pear"', NULL, NULL, NULL, NULL, NULL )
);
$worksheet->fromArray( $criteria, NULL, 'A1' );
$worksheet->fromArray( $database, NULL, 'A4' );
$worksheet->setCellValue('A12', 'The variance in the yield of Apple and Pear trees');
$worksheet->setCellValue('B12', '=DVARP(A4:E10,"Yield",A1:A3)');
$worksheet->setCellValue('A13', 'The variance in height of Apple and Pear trees');
$worksheet->setCellValue('B13', '=DVARP(A4:E10,2,A1:A3)');
echo '<hr />';
echo '<h4>Database</h4>';
$databaseData = $worksheet->rangeToArray('A4:E10',null,true,true,true);
var_dump($databaseData);
echo '<hr />';
// Test the formulae
echo '<h4>Criteria</h4>';
$criteriaData = $worksheet->rangeToArray('A1:A3',null,true,true,true);
var_dump($criteriaData);
echo $worksheet->getCell("A12")->getValue() .'<br />';
echo 'DVARP() Result is ' . $worksheet->getCell("B12")->getCalculatedValue() .'<br /><br />';
echo '<h4>Criteria</h4>';
$criteriaData = $worksheet->rangeToArray('A1:A3',null,true,true,true);
var_dump($criteriaData);
echo $worksheet->getCell("A13")->getValue() .'<br />';
echo 'DVARP() Result is ' . $worksheet->getCell("B13")->getCalculatedValue();
?>
<body>
</html>

View File

@@ -0,0 +1,83 @@
<?php
error_reporting(E_ALL);
set_time_limit(0);
date_default_timezone_set('Europe/London');
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>PHPExcel Calculation Examples</title>
</head>
<body>
<h1>DATE</h1>
<h2>Returns the serial number of a particular date.</h2>
<?php
/** Include path **/
set_include_path(get_include_path() . PATH_SEPARATOR . '../../../../Classes/');
/** Include PHPExcel */
include 'PHPExcel.php';
// Create new PHPExcel object
$objPHPExcel = new PHPExcel();
$worksheet = $objPHPExcel->getActiveSheet();
// Add some data
$testDates = array( array(2012,3,26), array(2012,2,29), array(2012,4,1), array(2012,12,25),
array(2012,10,31), array(2012,11,5), array(2012,1,1), array(2012,3,17),
array(2011,2,29), array(7,5,3), array(2012,13,1), array(2012,11,45),
array(2012,0,0), array(2012,1,0), array(2012,0,1),
array(2012,-2,2), array(2012,2,-2), array(2012,-2,-2),
);
$testDateCount = count($testDates);
$worksheet->fromArray($testDates,NULL,'A1',true);
for ($row = 1; $row <= $testDateCount; ++$row) {
$worksheet->setCellValue('D'.$row, '=DATE(A'.$row.',B'.$row.',C'.$row.')');
$worksheet->setCellValue('E'.$row, '=D'.$row);
}
$worksheet->getStyle('E1:E'.$testDateCount)
->getNumberFormat()
->setFormatCode('yyyy-mmm-dd');
echo '<hr />';
// Test the formulae
?>
<table border="1" cellspacing="0">
<tr>
<th colspan="3">Date Value</th>
<th rowspan="2" valign="bottom">Formula</th>
<th rowspan="2" valign="bottom">Excel DateStamp</th>
<th rowspan="2" valign="bottom">Formatted DateStamp</th>
</tr>
<tr>
<th>Year</th>
<th>Month</th>
<th>Day</th>
<tr>
<?php
for ($row = 1; $row <= $testDateCount; ++$row) {
echo '<tr>';
echo '<td>' , $worksheet->getCell('A'.$row)->getFormattedValue() , '</td>';
echo '<td>' , $worksheet->getCell('B'.$row)->getFormattedValue() , '</td>';
echo '<td>' , $worksheet->getCell('C'.$row)->getFormattedValue() , '</td>';
echo '<td>' , $worksheet->getCell('D'.$row)->getValue() , '</td>';
echo '<td>' , $worksheet->getCell('D'.$row)->getFormattedValue() , '</td>';
echo '<td>' , $worksheet->getCell('E'.$row)->getFormattedValue() , '</td>';
echo '</tr>';
}
?>
</table>

View File

@@ -0,0 +1,76 @@
<?php
error_reporting(E_ALL);
set_time_limit(0);
date_default_timezone_set('Europe/London');
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>PHPExcel Calculation Examples</title>
</head>
<body>
<h1>DATEVALUE</h1>
<h2>Converts a date in the form of text to a serial number.</h2>
<?php
/** Include path **/
set_include_path(get_include_path() . PATH_SEPARATOR . '../../../../Classes/');
/** Include PHPExcel */
include 'PHPExcel.php';
// Create new PHPExcel object
$objPHPExcel = new PHPExcel();
$worksheet = $objPHPExcel->getActiveSheet();
// Add some data
$testDates = array( '26 March 2012', '29 Feb 2012', 'April 1, 2012', '25/12/2012',
'2012-Oct-31', '5th November', 'January 1st', 'April 2012',
'17-03', '03-2012', '29 Feb 2011', '03-05-07',
'03-MAY-07', '03-13-07',
);
$testDateCount = count($testDates);
for($row = 1; $row <= $testDateCount; ++$row) {
$worksheet->setCellValue('A'.$row, $testDates[$row-1]);
$worksheet->setCellValue('B'.$row, '=DATEVALUE(A'.$row.')');
$worksheet->setCellValue('C'.$row, '=B'.$row);
}
$worksheet->getStyle('C1:C'.$testDateCount)
->getNumberFormat()
->setFormatCode('yyyy-mmm-dd');
echo '<hr />';
// Test the formulae
?>
<p><strong>Warning: </strong>The PHPExcel DATEVALUE() function accepts a wider range of date formats than MS Excel's DATEFORMAT() function.</p>
<table border="1" cellspacing="0">
<tr>
<th>Date String</th>
<th>Formula</th>
<th>Excel DateStamp</th>
<th>Formatted DateStamp</th>
</tr>
<?php
for ($row = 1; $row <= $testDateCount; ++$row) {
echo '<tr>';
echo '<td>' , $worksheet->getCell('A'.$row)->getFormattedValue() , '</td>';
echo '<td>' , $worksheet->getCell('B'.$row)->getValue() , '</td>';
echo '<td>' , $worksheet->getCell('B'.$row)->getFormattedValue() , '</td>';
echo '<td>' , $worksheet->getCell('C'.$row)->getFormattedValue() , '</td>';
echo '</tr>';
}
?>
</table>

View File

@@ -0,0 +1,81 @@
<?php
error_reporting(E_ALL);
set_time_limit(0);
date_default_timezone_set('Europe/London');
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>PHPExcel Calculation Examples</title>
</head>
<body>
<h1>TIME</h1>
<h2>Returns the serial number of a particular time.</h2>
<?php
/** Include path **/
set_include_path(get_include_path() . PATH_SEPARATOR . '../../../../Classes/');
/** Include PHPExcel */
include 'PHPExcel.php';
// Create new PHPExcel object
$objPHPExcel = new PHPExcel();
$worksheet = $objPHPExcel->getActiveSheet();
// Add some data
$testDates = array( array(3,15), array(13,15), array(15,15,15), array(3,15,30),
array(15,15,15), array(5), array(9,15,0), array(9,15,-1),
array(13,-14,-15), array(0,0,-1)
);
$testDateCount = count($testDates);
$worksheet->fromArray($testDates,NULL,'A1',true);
for ($row = 1; $row <= $testDateCount; ++$row) {
$worksheet->setCellValue('D'.$row, '=TIME(A'.$row.',B'.$row.',C'.$row.')');
$worksheet->setCellValue('E'.$row, '=D'.$row);
}
$worksheet->getStyle('E1:E'.$testDateCount)
->getNumberFormat()
->setFormatCode('hh:mm:ss');
echo '<hr />';
// Test the formulae
?>
<table border="1" cellspacing="0">
<tr>
<th colspan="3">Date Value</th>
<th rowspan="2" valign="bottom">Formula</th>
<th rowspan="2" valign="bottom">Excel TimeStamp</th>
<th rowspan="2" valign="bottom">Formatted TimeStamp</th>
</tr>
<tr>
<th>Hour</th>
<th>Minute</th>
<th>Second</th>
<tr>
<?php
for ($row = 1; $row <= $testDateCount; ++$row) {
echo '<tr>';
echo '<td>' , $worksheet->getCell('A'.$row)->getFormattedValue() , '</td>';
echo '<td>' , $worksheet->getCell('B'.$row)->getFormattedValue() , '</td>';
echo '<td>' , $worksheet->getCell('C'.$row)->getFormattedValue() , '</td>';
echo '<td>' , $worksheet->getCell('D'.$row)->getValue() , '</td>';
echo '<td>' , $worksheet->getCell('D'.$row)->getFormattedValue() , '</td>';
echo '<td>' , $worksheet->getCell('E'.$row)->getFormattedValue() , '</td>';
echo '</tr>';
}
?>
</table>

View File

@@ -0,0 +1,72 @@
<?php
error_reporting(E_ALL);
set_time_limit(0);
date_default_timezone_set('Europe/London');
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>PHPExcel Calculation Examples</title>
</head>
<body>
<h1>TIMEVALUE</h1>
<h2>Converts a time in the form of text to a serial number.</h2>
<?php
/** Include path **/
set_include_path(get_include_path() . PATH_SEPARATOR . '../../../../Classes/');
/** Include PHPExcel */
include 'PHPExcel.php';
// Create new PHPExcel object
$objPHPExcel = new PHPExcel();
$worksheet = $objPHPExcel->getActiveSheet();
// Add some data
$testDates = array( '3:15', '13:15', '15:15:15', '3:15 AM', '3:15 PM', '5PM', '9:15AM', '13:15AM'
);
$testDateCount = count($testDates);
for($row = 1; $row <= $testDateCount; ++$row) {
$worksheet->setCellValue('A'.$row, $testDates[$row-1]);
$worksheet->setCellValue('B'.$row, '=TIMEVALUE(A'.$row.')');
$worksheet->setCellValue('C'.$row, '=B'.$row);
}
$worksheet->getStyle('C1:C'.$testDateCount)
->getNumberFormat()
->setFormatCode('hh:mm:ss');
echo '<hr />';
// Test the formulae
?>
<table border="1" cellspacing="0">
<tr>
<th>Time String</th>
<th>Formula</th>
<th>Excel TimeStamp</th>
<th>Formatted TimeStamp</th>
</tr>
<?php
for ($row = 1; $row <= $testDateCount; ++$row) {
echo '<tr>';
echo '<td>' , $worksheet->getCell('A'.$row)->getFormattedValue() , '</td>';
echo '<td>' , $worksheet->getCell('B'.$row)->getValue() , '</td>';
echo '<td>' , $worksheet->getCell('B'.$row)->getFormattedValue() , '</td>';
echo '<td>' , $worksheet->getCell('C'.$row)->getFormattedValue() , '</td>';
echo '</tr>';
}
?>
</table>

View File

@@ -0,0 +1,51 @@
<?php
error_reporting(E_ALL);
set_time_limit(0);
date_default_timezone_set('Europe/London');
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>PHPExcel Calculation Function Examples</title>
</head>
<body>
<?php
echo '<h1>PHPExcel Calculation Function Examples</h1>';
$exampleTypeList = glob('./*',GLOB_ONLYDIR);
foreach($exampleTypeList as $exampleType) {
echo '<h2>' . pathinfo($exampleType,PATHINFO_BASENAME) . ' Function Examples</h2>';
$exampleList = glob('./'.$exampleType.'/*.php');
foreach($exampleList as $exampleFile) {
$fileData = file_get_contents($exampleFile);
$h1Pattern = '#<h1>(.*?)</h1>#';
$h2Pattern = '#<h2>(.*?)</h2>#';
if (preg_match($h1Pattern, $fileData, $out)) {
$h1Text = $out[1];
$h2Text = (preg_match($h2Pattern, $fileData, $out)) ? $out[1] : '';
echo '<a href="',$exampleFile,'">',$h1Text,'</a><br />';
if ($h2Text > '') {
echo $h2Text,'<br />';
}
}
}
}
?>
<body>
</html>

View File

@@ -0,0 +1,42 @@
<?php
error_reporting(E_ALL);
set_time_limit(0);
date_default_timezone_set('Europe/London');
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>PHPExcel Reader Example #01</title>
</head>
<body>
<h1>PHPExcel Reader Example #01</h1>
<h2>Simple File Reader using PHPExcel_IOFactory::load()</h2>
<?php
/** Include path **/
set_include_path(get_include_path() . PATH_SEPARATOR . '../../../Classes/');
/** PHPExcel_IOFactory */
include 'PHPExcel/IOFactory.php';
$inputFileName = './sampleData/example1.xls';
echo 'Loading file ',pathinfo($inputFileName,PATHINFO_BASENAME),' using IOFactory to identify the format<br />';
$objPHPExcel = PHPExcel_IOFactory::load($inputFileName);
echo '<hr />';
$sheetData = $objPHPExcel->getActiveSheet()->toArray(null,true,true,true);
var_dump($sheetData);
?>
<body>
</html>

View File

@@ -0,0 +1,50 @@
<?php
error_reporting(E_ALL);
set_time_limit(0);
date_default_timezone_set('Europe/London');
/** Include path **/
set_include_path(get_include_path() . PATH_SEPARATOR . '../../../Classes/');
/** PHPExcel_IOFactory */
include 'PHPExcel/IOFactory.php';
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>PHPExcel Reader Example #02</title>
</head>
<body>
<h1>PHPExcel Reader Example #02</h1>
<h2>Simple File Reader using a Specified Reader</h2>
<?php
$inputFileName = './sampleData/example1.xls';
echo 'Loading file ',pathinfo($inputFileName,PATHINFO_BASENAME),' using PHPExcel_Reader_Excel5<br />';
$objReader = new PHPExcel_Reader_Excel5();
// $objReader = new PHPExcel_Reader_Excel2007();
// $objReader = new PHPExcel_Reader_Excel2003XML();
// $objReader = new PHPExcel_Reader_OOCalc();
// $objReader = new PHPExcel_Reader_SYLK();
// $objReader = new PHPExcel_Reader_Gnumeric();
// $objReader = new PHPExcel_Reader_CSV();
$objPHPExcel = $objReader->load($inputFileName);
echo '<hr />';
$sheetData = $objPHPExcel->getActiveSheet()->toArray(null,true,true,true);
var_dump($sheetData);
?>
<body>
</html>

View File

@@ -0,0 +1,51 @@
<?php
error_reporting(E_ALL);
set_time_limit(0);
date_default_timezone_set('Europe/London');
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>PHPExcel Reader Example #03</title>
</head>
<body>
<h1>PHPExcel Reader Example #03</h1>
<h2>Simple File Reader using the PHPExcel_IOFactory to Return a Reader</h2>
<?php
/** Include path **/
set_include_path(get_include_path() . PATH_SEPARATOR . '../../../Classes/');
/** PHPExcel_IOFactory */
include 'PHPExcel/IOFactory.php';
$inputFileType = 'Excel5';
// $inputFileType = 'Excel2007';
// $inputFileType = 'Excel2003XML';
// $inputFileType = 'OOCalc';
// $inputFileType = 'SYLK';
// $inputFileType = 'Gnumeric';
// $inputFileType = 'CSV';
$inputFileName = './sampleData/example1.xls';
echo 'Loading file ',pathinfo($inputFileName,PATHINFO_BASENAME),' using IOFactory with a defined reader type of ',$inputFileType,'<br />';
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
$objPHPExcel = $objReader->load($inputFileName);
echo '<hr />';
$sheetData = $objPHPExcel->getActiveSheet()->toArray(null,true,true,true);
var_dump($sheetData);
?>
<body>
</html>

View File

@@ -0,0 +1,47 @@
<?php
error_reporting(E_ALL);
set_time_limit(0);
date_default_timezone_set('Europe/London');
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>PHPExcel Reader Example #04</title>
</head>
<body>
<h1>PHPExcel Reader Example #04</h1>
<h2>Simple File Reader using the PHPExcel_IOFactory to Identify a Reader to Use</h2>
<?php
/** Include path **/
set_include_path(get_include_path() . PATH_SEPARATOR . '../../../Classes/');
/** PHPExcel_IOFactory */
include 'PHPExcel/IOFactory.php';
$inputFileName = './sampleData/example1.xls';
$inputFileType = PHPExcel_IOFactory::identify($inputFileName);
echo 'File ',pathinfo($inputFileName,PATHINFO_BASENAME),' has been identified as an ',$inputFileType,' file<br />';
echo 'Loading file ',pathinfo($inputFileName,PATHINFO_BASENAME),' using IOFactory with the identified reader type<br />';
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
$objPHPExcel = $objReader->load($inputFileName);
echo '<hr />';
$sheetData = $objPHPExcel->getActiveSheet()->toArray(null,true,true,true);
var_dump($sheetData);
?>
<body>
</html>

View File

@@ -0,0 +1,51 @@
<?php
error_reporting(E_ALL);
set_time_limit(0);
date_default_timezone_set('Europe/London');
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>PHPExcel Reader Example #05</title>
</head>
<body>
<h1>PHPExcel Reader Example #05</h1>
<h2>Simple File Reader using the "Read Data Only" Option</h2>
<?php
/** Include path **/
set_include_path(get_include_path() . PATH_SEPARATOR . '../../../Classes/');
/** PHPExcel_IOFactory */
include 'PHPExcel/IOFactory.php';
$inputFileType = 'Excel5';
// $inputFileType = 'Excel2007';
// $inputFileType = 'Excel2003XML';
// $inputFileType = 'OOCalc';
// $inputFileType = 'Gnumeric';
$inputFileName = './sampleData/example1.xls';
echo 'Loading file ',pathinfo($inputFileName,PATHINFO_BASENAME),' using IOFactory with a defined reader type of ',$inputFileType,'<br />';
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
echo 'Turning Formatting off for Load<br />';
$objReader->setReadDataOnly(true);
$objPHPExcel = $objReader->load($inputFileName);
echo '<hr />';
$sheetData = $objPHPExcel->getActiveSheet()->toArray(null,true,true,true);
var_dump($sheetData);
?>
<body>
</html>

View File

@@ -0,0 +1,54 @@
<?php
error_reporting(E_ALL);
set_time_limit(0);
date_default_timezone_set('Europe/London');
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>PHPExcel Reader Example #06</title>
</head>
<body>
<h1>PHPExcel Reader Example #06</h1>
<h2>Simple File Reader Loading All WorkSheets</h2>
<?php
/** Include path **/
set_include_path(get_include_path() . PATH_SEPARATOR . '../../../Classes/');
/** PHPExcel_IOFactory */
include 'PHPExcel/IOFactory.php';
$inputFileType = 'Excel5';
// $inputFileType = 'Excel2007';
// $inputFileType = 'Excel2003XML';
// $inputFileType = 'OOCalc';
// $inputFileType = 'Gnumeric';
$inputFileName = './sampleData/example1.xls';
echo 'Loading file ',pathinfo($inputFileName,PATHINFO_BASENAME),' using IOFactory with a defined reader type of ',$inputFileType,'<br />';
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
echo 'Loading all WorkSheets<br />';
$objReader->setLoadAllSheets();
$objPHPExcel = $objReader->load($inputFileName);
echo '<hr />';
echo $objPHPExcel->getSheetCount(),' worksheet',(($objPHPExcel->getSheetCount() == 1) ? '' : 's'),' loaded<br /><br />';
$loadedSheetNames = $objPHPExcel->getSheetNames();
foreach($loadedSheetNames as $sheetIndex => $loadedSheetName) {
echo $sheetIndex,' -> ',$loadedSheetName,'<br />';
}
?>
<body>
</html>

View File

@@ -0,0 +1,55 @@
<?php
error_reporting(E_ALL);
set_time_limit(0);
date_default_timezone_set('Europe/London');
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>PHPExcel Reader Example #07</title>
</head>
<body>
<h1>PHPExcel Reader Example #07</h1>
<h2>Simple File Reader Loading a Single Named WorkSheet</h2>
<?php
/** Include path **/
set_include_path(get_include_path() . PATH_SEPARATOR . '../../../Classes/');
/** PHPExcel_IOFactory */
include 'PHPExcel/IOFactory.php';
$inputFileType = 'Excel5';
// $inputFileType = 'Excel2007';
// $inputFileType = 'Excel2003XML';
// $inputFileType = 'OOCalc';
// $inputFileType = 'Gnumeric';
$inputFileName = './sampleData/example1.xls';
$sheetname = 'Data Sheet #2';
echo 'Loading file ',pathinfo($inputFileName,PATHINFO_BASENAME),' using IOFactory with a defined reader type of ',$inputFileType,'<br />';
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
echo 'Loading Sheet "',$sheetname,'" only<br />';
$objReader->setLoadSheetsOnly($sheetname);
$objPHPExcel = $objReader->load($inputFileName);
echo '<hr />';
echo $objPHPExcel->getSheetCount(),' worksheet',(($objPHPExcel->getSheetCount() == 1) ? '' : 's'),' loaded<br /><br />';
$loadedSheetNames = $objPHPExcel->getSheetNames();
foreach($loadedSheetNames as $sheetIndex => $loadedSheetName) {
echo $sheetIndex,' -> ',$loadedSheetName,'<br />';
}
?>
<body>
</html>

View File

@@ -0,0 +1,55 @@
<?php
error_reporting(E_ALL);
set_time_limit(0);
date_default_timezone_set('Europe/London');
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>PHPExcel Reader Example #08</title>
</head>
<body>
<h1>PHPExcel Reader Example #08</h1>
<h2>Simple File Reader Loading Several Named WorkSheets</h2>
<?php
/** Include path **/
set_include_path(get_include_path() . PATH_SEPARATOR . '../../../Classes/');
/** PHPExcel_IOFactory */
include 'PHPExcel/IOFactory.php';
$inputFileType = 'Excel5';
// $inputFileType = 'Excel2007';
// $inputFileType = 'Excel2003XML';
// $inputFileType = 'OOCalc';
// $inputFileType = 'Gnumeric';
$inputFileName = './sampleData/example1.xls';
$sheetnames = array('Data Sheet #1','Data Sheet #3');
echo 'Loading file ',pathinfo($inputFileName,PATHINFO_BASENAME),' using IOFactory with a defined reader type of ',$inputFileType,'<br />';
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
echo 'Loading Sheet',((count($sheetnames) == 1) ? '' : 's'),' "',implode('" and "',$sheetnames),'" only<br />';
$objReader->setLoadSheetsOnly($sheetnames);
$objPHPExcel = $objReader->load($inputFileName);
echo '<hr />';
echo $objPHPExcel->getSheetCount(),' worksheet',(($objPHPExcel->getSheetCount() == 1) ? '' : 's'),' loaded<br /><br />';
$loadedSheetNames = $objPHPExcel->getSheetNames();
foreach($loadedSheetNames as $sheetIndex => $loadedSheetName) {
echo $sheetIndex,' -> ',$loadedSheetName,'<br />';
}
?>
<body>
</html>

View File

@@ -0,0 +1,71 @@
<?php
error_reporting(E_ALL);
set_time_limit(0);
date_default_timezone_set('Europe/London');
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>PHPExcel Reader Example #09</title>
</head>
<body>
<h1>PHPExcel Reader Example #09</h1>
<h2>Simple File Reader Using a Read Filter</h2>
<?php
/** Include path **/
set_include_path(get_include_path() . PATH_SEPARATOR . '../../../Classes/');
/** PHPExcel_IOFactory */
include 'PHPExcel/IOFactory.php';
$inputFileType = 'Excel5';
// $inputFileType = 'Excel2007';
// $inputFileType = 'Excel2003XML';
// $inputFileType = 'OOCalc';
// $inputFileType = 'Gnumeric';
$inputFileName = './sampleData/example1.xls';
$sheetname = 'Data Sheet #3';
class MyReadFilter implements PHPExcel_Reader_IReadFilter
{
public function readCell($column, $row, $worksheetName = '') {
// Read rows 1 to 7 and columns A to E only
if ($row >= 1 && $row <= 7) {
if (in_array($column,range('A','E'))) {
return true;
}
}
return false;
}
}
$filterSubset = new MyReadFilter();
echo 'Loading file ',pathinfo($inputFileName,PATHINFO_BASENAME),' using IOFactory with a defined reader type of ',$inputFileType,'<br />';
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
echo 'Loading Sheet "',$sheetname,'" only<br />';
$objReader->setLoadSheetsOnly($sheetname);
echo 'Loading Sheet using filter<br />';
$objReader->setReadFilter($filterSubset);
$objPHPExcel = $objReader->load($inputFileName);
echo '<hr />';
$sheetData = $objPHPExcel->getActiveSheet()->toArray(null,true,true,true);
var_dump($sheetData);
?>
<body>
</html>

View File

@@ -0,0 +1,82 @@
<?php
error_reporting(E_ALL);
set_time_limit(0);
date_default_timezone_set('Europe/London');
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>PHPExcel Reader Example #10</title>
</head>
<body>
<h1>PHPExcel Reader Example #10</h1>
<h2>Simple File Reader Using a Configurable Read Filter</h2>
<?php
/** Include path **/
set_include_path(get_include_path() . PATH_SEPARATOR . '../../../Classes/');
/** PHPExcel_IOFactory */
include 'PHPExcel/IOFactory.php';
$inputFileType = 'Excel5';
// $inputFileType = 'Excel2007';
// $inputFileType = 'Excel2003XML';
// $inputFileType = 'OOCalc';
// $inputFileType = 'Gnumeric';
$inputFileName = './sampleData/example1.xls';
$sheetname = 'Data Sheet #3';
class MyReadFilter implements PHPExcel_Reader_IReadFilter
{
private $_startRow = 0;
private $_endRow = 0;
private $_columns = array();
public function __construct($startRow, $endRow, $columns) {
$this->_startRow = $startRow;
$this->_endRow = $endRow;
$this->_columns = $columns;
}
public function readCell($column, $row, $worksheetName = '') {
if ($row >= $this->_startRow && $row <= $this->_endRow) {
if (in_array($column,$this->_columns)) {
return true;
}
}
return false;
}
}
$filterSubset = new MyReadFilter(9,15,range('G','K'));
echo 'Loading file ',pathinfo($inputFileName,PATHINFO_BASENAME),' using IOFactory with a defined reader type of ',$inputFileType,'<br />';
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
echo 'Loading Sheet "',$sheetname,'" only<br />';
$objReader->setLoadSheetsOnly($sheetname);
echo 'Loading Sheet using configurable filter<br />';
$objReader->setReadFilter($filterSubset);
$objPHPExcel = $objReader->load($inputFileName);
echo '<hr />';
$sheetData = $objPHPExcel->getActiveSheet()->toArray(null,true,true,true);
var_dump($sheetData);
?>
<body>
</html>

View File

@@ -0,0 +1,91 @@
<?php
error_reporting(E_ALL);
set_time_limit(0);
date_default_timezone_set('Europe/London');
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>PHPExcel Reader Example #11</title>
</head>
<body>
<h1>PHPExcel Reader Example #11</h1>
<h2>Reading a Workbook in "Chunks" Using a Configurable Read Filter (Version 1)</h2>
<?php
/** Include path **/
set_include_path(get_include_path() . PATH_SEPARATOR . '../../../Classes/');
/** PHPExcel_IOFactory */
include 'PHPExcel/IOFactory.php';
$inputFileType = 'Excel5';
// $inputFileType = 'Excel2007';
// $inputFileType = 'Excel2003XML';
// $inputFileType = 'OOCalc';
// $inputFileType = 'Gnumeric';
$inputFileName = './sampleData/example2.xls';
/** Define a Read Filter class implementing PHPExcel_Reader_IReadFilter */
class chunkReadFilter implements PHPExcel_Reader_IReadFilter
{
private $_startRow = 0;
private $_endRow = 0;
/** We expect a list of the rows that we want to read to be passed into the constructor */
public function __construct($startRow, $chunkSize) {
$this->_startRow = $startRow;
$this->_endRow = $startRow + $chunkSize;
}
public function readCell($column, $row, $worksheetName = '') {
// Only read the heading row, and the rows that were configured in the constructor
if (($row == 1) || ($row >= $this->_startRow && $row < $this->_endRow)) {
return true;
}
return false;
}
}
echo 'Loading file ',pathinfo($inputFileName,PATHINFO_BASENAME),' using IOFactory with a defined reader type of ',$inputFileType,'<br />';
/** Create a new Reader of the type defined in $inputFileType **/
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
echo '<hr />';
/** Define how many rows we want for each "chunk" **/
$chunkSize = 20;
/** Loop to read our worksheet in "chunk size" blocks **/
for ($startRow = 2; $startRow <= 240; $startRow += $chunkSize) {
echo 'Loading WorkSheet using configurable filter for headings row 1 and for rows ',$startRow,' to ',($startRow+$chunkSize-1),'<br />';
/** Create a new Instance of our Read Filter, passing in the limits on which rows we want to read **/
$chunkFilter = new chunkReadFilter($startRow,$chunkSize);
/** Tell the Reader that we want to use the new Read Filter that we've just Instantiated **/
$objReader->setReadFilter($chunkFilter);
/** Load only the rows that match our filter from $inputFileName to a PHPExcel Object **/
$objPHPExcel = $objReader->load($inputFileName);
// Do some processing here
$sheetData = $objPHPExcel->getActiveSheet()->toArray(null,true,true,true);
var_dump($sheetData);
echo '<br /><br />';
}
?>
<body>
</html>

View File

@@ -0,0 +1,94 @@
<?php
error_reporting(E_ALL);
set_time_limit(0);
date_default_timezone_set('Europe/London');
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>PHPExcel Reader Example #12</title>
</head>
<body>
<h1>PHPExcel Reader Example #12</h1>
<h2>Reading a Workbook in "Chunks" Using a Configurable Read Filter (Version 2)</h2>
<?php
/** Set Include path to point at the PHPExcel Classes folder **/
set_include_path(get_include_path() . PATH_SEPARATOR . '../../../Classes/');
/** Include PHPExcel_IOFactory **/
include 'PHPExcel/IOFactory.php';
$inputFileType = 'Excel5';
// $inputFileType = 'Excel2007';
// $inputFileType = 'Excel2003XML';
// $inputFileType = 'OOCalc';
// $inputFileType = 'Gnumeric';
$inputFileName = './sampleData/example2.xls';
/** Define a Read Filter class implementing PHPExcel_Reader_IReadFilter */
class chunkReadFilter implements PHPExcel_Reader_IReadFilter
{
private $_startRow = 0;
private $_endRow = 0;
/** Set the list of rows that we want to read */
public function setRows($startRow, $chunkSize) {
$this->_startRow = $startRow;
$this->_endRow = $startRow + $chunkSize;
}
public function readCell($column, $row, $worksheetName = '') {
// Only read the heading row, and the rows that are configured in $this->_startRow and $this->_endRow
if (($row == 1) || ($row >= $this->_startRow && $row < $this->_endRow)) {
return true;
}
return false;
}
}
echo 'Loading file ',pathinfo($inputFileName,PATHINFO_BASENAME),' using IOFactory with a defined reader type of ',$inputFileType,'<br />';
/** Create a new Reader of the type defined in $inputFileType **/
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
echo '<hr />';
/** Define how many rows we want to read for each "chunk" **/
$chunkSize = 20;
/** Create a new Instance of our Read Filter **/
$chunkFilter = new chunkReadFilter();
/** Tell the Reader that we want to use the Read Filter that we've Instantiated **/
$objReader->setReadFilter($chunkFilter);
/** Loop to read our worksheet in "chunk size" blocks **/
for ($startRow = 2; $startRow <= 240; $startRow += $chunkSize) {
echo 'Loading WorkSheet using configurable filter for headings row 1 and for rows ',$startRow,' to ',($startRow+$chunkSize-1),'<br />';
/** Tell the Read Filter, the limits on which rows we want to read this iteration **/
$chunkFilter->setRows($startRow,$chunkSize);
/** Load only the rows that match our filter from $inputFileName to a PHPExcel Object **/
$objPHPExcel = $objReader->load($inputFileName);
// Do some processing here
$sheetData = $objPHPExcel->getActiveSheet()->toArray(null,true,true,true);
var_dump($sheetData);
echo '<br /><br />';
}
?>
<body>
</html>

View File

@@ -0,0 +1,60 @@
<?php
error_reporting(E_ALL);
set_time_limit(0);
date_default_timezone_set('Europe/London');
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>PHPExcel Reader Example #13</title>
</head>
<body>
<h1>PHPExcel Reader Example #13</h1>
<h2>Simple File Reader for Multiple CSV Files</h2>
<?php
/** Include path **/
set_include_path(get_include_path() . PATH_SEPARATOR . '../../../Classes/');
/** PHPExcel_IOFactory */
include 'PHPExcel/IOFactory.php';
$inputFileType = 'CSV';
$inputFileNames = array('./sampleData/example1.csv','./sampleData/example2.csv');
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
$inputFileName = array_shift($inputFileNames);
echo 'Loading file ',pathinfo($inputFileName,PATHINFO_BASENAME),' into WorkSheet #1 using IOFactory with a defined reader type of ',$inputFileType,'<br />';
$objPHPExcel = $objReader->load($inputFileName);
$objPHPExcel->getActiveSheet()->setTitle(pathinfo($inputFileName,PATHINFO_BASENAME));
foreach($inputFileNames as $sheet => $inputFileName) {
echo 'Loading file ',pathinfo($inputFileName,PATHINFO_BASENAME),' into WorkSheet #',($sheet+2),' using IOFactory with a defined reader type of ',$inputFileType,'<br />';
$objReader->setSheetIndex($sheet+1);
$objReader->loadIntoExisting($inputFileName,$objPHPExcel);
$objPHPExcel->getActiveSheet()->setTitle(pathinfo($inputFileName,PATHINFO_BASENAME));
}
echo '<hr />';
echo $objPHPExcel->getSheetCount(),' worksheet',(($objPHPExcel->getSheetCount() == 1) ? '' : 's'),' loaded<br /><br />';
$loadedSheetNames = $objPHPExcel->getSheetNames();
foreach($loadedSheetNames as $sheetIndex => $loadedSheetName) {
echo '<b>Worksheet #',$sheetIndex,' -> ',$loadedSheetName,'</b><br />';
$objPHPExcel->setActiveSheetIndexByName($loadedSheetName);
$sheetData = $objPHPExcel->getActiveSheet()->toArray(null,true,true,true);
var_dump($sheetData);
echo '<br /><br />';
}
?>
<body>
</html>

View File

@@ -0,0 +1,105 @@
<?php
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>PHPExcel Reader Example #15</title>
</head>
<body>
<h1>PHPExcel Reader Example #14</h1>
<h2>Reading a Large CSV file in "Chunks" to split across multiple Worksheets</h2>
<?php
/** Include path **/
set_include_path(get_include_path() . PATH_SEPARATOR . '../../../Classes/');
/** PHPExcel_IOFactory */
include 'PHPExcel/IOFactory.php';
$inputFileType = 'CSV';
$inputFileName = './sampleData/example2.csv';
/** Define a Read Filter class implementing PHPExcel_Reader_IReadFilter */
class chunkReadFilter implements PHPExcel_Reader_IReadFilter
{
private $_startRow = 0;
private $_endRow = 0;
/** Set the list of rows that we want to read */
public function setRows($startRow, $chunkSize) {
$this->_startRow = $startRow;
$this->_endRow = $startRow + $chunkSize;
}
public function readCell($column, $row, $worksheetName = '') {
// Only read the heading row, and the rows that are configured in $this->_startRow and $this->_endRow
if (($row == 1) || ($row >= $this->_startRow && $row < $this->_endRow)) {
return true;
}
return false;
}
}
echo 'Loading file ',pathinfo($inputFileName,PATHINFO_BASENAME),' using IOFactory with a defined reader type of ',$inputFileType,'<br />';
/** Create a new Reader of the type defined in $inputFileType **/
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
echo '<hr />';
/** Define how many rows we want to read for each "chunk" **/
$chunkSize = 100;
/** Create a new Instance of our Read Filter **/
$chunkFilter = new chunkReadFilter();
/** Tell the Reader that we want to use the Read Filter that we've Instantiated **/
/** and that we want to store it in contiguous rows/columns **/
$objReader->setReadFilter($chunkFilter)
->setContiguous(true);
/** Instantiate a new PHPExcel object manually **/
$objPHPExcel = new PHPExcel();
/** Set a sheet index **/
$sheet = 0;
/** Loop to read our worksheet in "chunk size" blocks **/
/** $startRow is set to 2 initially because we always read the headings in row #1 **/
for ($startRow = 2; $startRow <= 240; $startRow += $chunkSize) {
echo 'Loading WorkSheet #',($sheet+1),' using configurable filter for headings row 1 and for rows ',$startRow,' to ',($startRow+$chunkSize-1),'<br />';
/** Tell the Read Filter, the limits on which rows we want to read this iteration **/
$chunkFilter->setRows($startRow,$chunkSize);
/** Increment the worksheet index pointer for the Reader **/
$objReader->setSheetIndex($sheet);
/** Load only the rows that match our filter into a new worksheet in the PHPExcel Object **/
$objReader->loadIntoExisting($inputFileName,$objPHPExcel);
/** Set the worksheet title (to reference the "sheet" of data that we've loaded) **/
/** and increment the sheet index as well **/
$objPHPExcel->getActiveSheet()->setTitle('Country Data #'.(++$sheet));
}
echo '<hr />';
echo $objPHPExcel->getSheetCount(),' worksheet',(($objPHPExcel->getSheetCount() == 1) ? '' : 's'),' loaded<br /><br />';
$loadedSheetNames = $objPHPExcel->getSheetNames();
foreach($loadedSheetNames as $sheetIndex => $loadedSheetName) {
echo '<b>Worksheet #',$sheetIndex,' -> ',$loadedSheetName,'</b><br />';
$objPHPExcel->setActiveSheetIndexByName($loadedSheetName);
$sheetData = $objPHPExcel->getActiveSheet()->toArray(null,false,false,true);
var_dump($sheetData);
echo '<br />';
}
?>
<body>
</html>

View File

@@ -0,0 +1,71 @@
<?php
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>PHPExcel Reader Example #15</title>
</head>
<body>
<h1>PHPExcel Reader Example #15</h1>
<h2>Simple File Reader for Tab-Separated Value File using the Advanced Value Binder</h2>
<?php
/** Include path **/
set_include_path(get_include_path() . PATH_SEPARATOR . '../../../Classes/');
/** PHPExcel_IOFactory */
include 'PHPExcel/IOFactory.php';
PHPExcel_Cell::setValueBinder( new PHPExcel_Cell_AdvancedValueBinder() );
$inputFileType = 'CSV';
$inputFileName = './sampleData/example1.tsv';
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
echo 'Loading file ',pathinfo($inputFileName,PATHINFO_BASENAME),' into WorkSheet #1 using IOFactory with a defined reader type of ',$inputFileType,'<br />';
$objReader->setDelimiter("\t");
$objPHPExcel = $objReader->load($inputFileName);
$objPHPExcel->getActiveSheet()->setTitle(pathinfo($inputFileName,PATHINFO_BASENAME));
echo '<hr />';
echo $objPHPExcel->getSheetCount(),' worksheet',(($objPHPExcel->getSheetCount() == 1) ? '' : 's'),' loaded<br /><br />';
$loadedSheetNames = $objPHPExcel->getSheetNames();
foreach($loadedSheetNames as $sheetIndex => $loadedSheetName) {
echo '<b>Worksheet #',$sheetIndex,' -> ',$loadedSheetName,' (Formatted)</b><br />';
$objPHPExcel->setActiveSheetIndexByName($loadedSheetName);
$sheetData = $objPHPExcel->getActiveSheet()->toArray(null,true,true,true);
var_dump($sheetData);
echo '<br />';
}
echo '<hr />';
foreach($loadedSheetNames as $sheetIndex => $loadedSheetName) {
echo '<b>Worksheet #',$sheetIndex,' -> ',$loadedSheetName,' (Unformatted)</b><br />';
$objPHPExcel->setActiveSheetIndexByName($loadedSheetName);
$sheetData = $objPHPExcel->getActiveSheet()->toArray(null,true,false,true);
var_dump($sheetData);
echo '<br />';
}
echo '<hr />';
foreach($loadedSheetNames as $sheetIndex => $loadedSheetName) {
echo '<b>Worksheet #',$sheetIndex,' -> ',$loadedSheetName,' (Raw)</b><br />';
$objPHPExcel->setActiveSheetIndexByName($loadedSheetName);
$sheetData = $objPHPExcel->getActiveSheet()->toArray(null,false,false,true);
var_dump($sheetData);
echo '<br />';
}
?>
<body>
</html>

View File

@@ -0,0 +1,46 @@
<?php
error_reporting(E_ALL);
set_time_limit(0);
date_default_timezone_set('Europe/London');
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>PHPExcel Reader Example #16</title>
</head>
<body>
<h1>PHPExcel Reader Example #16</h1>
<h2>Handling Loader Exceptions using Try/Catch</h2>
<?php
/** Include path **/
set_include_path(get_include_path() . PATH_SEPARATOR . '../../../Classes/');
/** PHPExcel_IOFactory */
include 'PHPExcel/IOFactory.php';
$inputFileName = './sampleData/example_1.xls';
echo 'Loading file ',pathinfo($inputFileName,PATHINFO_BASENAME),' using IOFactory to identify the format<br />';
try {
$objPHPExcel = PHPExcel_IOFactory::load($inputFileName);
} catch(PHPExcel_Reader_Exception $e) {
die('Error loading file "'.pathinfo($inputFileName,PATHINFO_BASENAME).'": '.$e->getMessage());
}
echo '<hr />';
$sheetData = $objPHPExcel->getActiveSheet()->toArray(null,true,true,true);
var_dump($sheetData);
?>
<body>
</html>

View File

@@ -0,0 +1,52 @@
<?php
error_reporting(E_ALL);
set_time_limit(0);
date_default_timezone_set('Europe/London');
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>PHPExcel Reader Example #17</title>
</head>
<body>
<h1>PHPExcel Reader Example #17</h1>
<h2>Simple File Reader Loading Several Named WorkSheets</h2>
<?php
/** Include path **/
set_include_path(get_include_path() . PATH_SEPARATOR . '../../../Classes/');
/** PHPExcel_IOFactory */
include 'PHPExcel/IOFactory.php';
$inputFileType = 'Excel5';
// $inputFileType = 'Excel2007';
// $inputFileType = 'Excel2003XML';
// $inputFileType = 'OOCalc';
// $inputFileType = 'Gnumeric';
$inputFileName = './sampleData/example1.xls';
echo 'Loading file ',pathinfo($inputFileName,PATHINFO_BASENAME),' using IOFactory with a defined reader type of ',$inputFileType,'<br />';
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
/** Read the list of Worksheet Names from the Workbook file **/
echo 'Read the list of Worksheets in the WorkBook<br />';
$worksheetNames = $objReader->listWorksheetNames($inputFileName);
echo 'There are ',count($worksheetNames),' worksheet',((count($worksheetNames) == 1) ? '' : 's'),' in the workbook<br /><br />';
foreach($worksheetNames as $worksheetName) {
echo $worksheetName,'<br />';
}
?>
<body>
</html>

View File

@@ -0,0 +1,50 @@
<?php
error_reporting(E_ALL);
set_time_limit(0);
date_default_timezone_set('Europe/London');
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>PHPExcel Reader Example #18</title>
</head>
<body>
<h1>PHPExcel Reader Example #18</h1>
<h2>Reading list of WorkSheets without loading entire file</h2>
<?php
/** Include path **/
set_include_path(get_include_path() . PATH_SEPARATOR . '../../../Classes/');
/** PHPExcel_IOFactory */
include 'PHPExcel/IOFactory.php';
$inputFileType = 'Excel5';
// $inputFileType = 'Excel2007';
// $inputFileType = 'Excel2003XML';
// $inputFileType = 'OOCalc';
// $inputFileType = 'Gnumeric';
$inputFileName = './sampleData/example1.xls';
echo 'Loading file ',pathinfo($inputFileName,PATHINFO_BASENAME),' information using IOFactory with a defined reader type of ',$inputFileType,'<br />';
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
$worksheetNames = $objReader->listWorksheetNames($inputFileName);
echo '<h3>Worksheet Names</h3>';
echo '<ol>';
foreach ($worksheetNames as $worksheetName) {
echo '<li>', $worksheetName, '</li>';
}
echo '</ol>';
?>
<body>
</html>

View File

@@ -0,0 +1,53 @@
<?php
error_reporting(E_ALL);
set_time_limit(0);
date_default_timezone_set('Europe/London');
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>PHPExcel Reader Example #19</title>
</head>
<body>
<h1>PHPExcel Reader Example #19</h1>
<h2>Reading WorkSheet information without loading entire file</h2>
<?php
/** Include path **/
set_include_path(get_include_path() . PATH_SEPARATOR . '../../../Classes/');
/** PHPExcel_IOFactory */
include 'PHPExcel/IOFactory.php';
$inputFileType = 'Excel5';
// $inputFileType = 'Excel2007';
// $inputFileType = 'Excel2003XML';
// $inputFileType = 'OOCalc';
// $inputFileType = 'Gnumeric';
$inputFileName = './sampleData/example1.xls';
echo 'Loading file ',pathinfo($inputFileName,PATHINFO_BASENAME),' information using IOFactory with a defined reader type of ',$inputFileType,'<br />';
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
$worksheetData = $objReader->listWorksheetInfo($inputFileName);
echo '<h3>Worksheet Information</h3>';
echo '<ol>';
foreach ($worksheetData as $worksheet) {
echo '<li>', $worksheet['worksheetName'], '<br />';
echo 'Rows: ', $worksheet['totalRows'], ' Columns: ', $worksheet['totalColumns'], '<br />';
echo 'Cell Range: A1:', $worksheet['lastColumnLetter'], $worksheet['totalRows'];
echo '</li>';
}
echo '</ol>';
?>
<body>
</html>

View File

@@ -0,0 +1,4 @@
First Name,Last Name,Nationality,Gender,Date of Birth,Time of Birth,Date/Time,PHP Coder,Sanity %Age
Mark,Baker,British,M,19-Dec-1960,01:30,=E2+F2,TRUE,32%
Toni,Baker,British,F,24-Nov-1950,20:00,=E3+F3,FALSE,95%
Rachel,Baker,British,F,7-Dec-1982,00:15,=E4+F4,FALSE,100%
1 First Name Last Name Nationality Gender Date of Birth Time of Birth Date/Time PHP Coder Sanity %Age
2 Mark Baker British M 19-Dec-1960 01:30 =E2+F2 TRUE 32%
3 Toni Baker British F 24-Nov-1950 20:00 =E3+F3 FALSE 95%
4 Rachel Baker British F 7-Dec-1982 00:15 =E4+F4 FALSE 100%

View File

@@ -0,0 +1,4 @@
First Name Last Name Nationality Gender Date of Birth Time of Birth Date/Time PHP Coder Sanity %Age
Mark Baker British M 19-Dec-1960 01:30 =E2+F2 TRUE 32%
Toni Baker British F 24-Nov-1950 20:00 =E3+F3 FALSE 95%
Rachel Baker British F 7-Dec-1982 00:15 =E4+F4 FALSE 100%
1 First Name Last Name Nationality Gender Date of Birth Time of Birth Date/Time PHP Coder Sanity %Age
2 Mark Baker British M 19-Dec-1960 01:30 =E2+F2 TRUE 32%
3 Toni Baker British F 24-Nov-1950 20:00 =E3+F3 FALSE 95%
4 Rachel Baker British F 7-Dec-1982 00:15 =E4+F4 FALSE 100%

View File

@@ -0,0 +1,223 @@
"City","Country","Latitude","Longitude"
"Kabul","Afghanistan",34.528455,69.171703
"Tirane","Albania",41.33,19.82
"Algiers","Algeria",36.752887,3.042048
"Pago Pago","American Samoa",-14.27933,-170.700897
"Andorra la Vella","Andorra",42.507531,1.521816
"Luanda","Angola",-8.838333,13.234444
"Buenos Aires","Argentina",-34.608417,-58.373161
"Yerevan","Armenia",40.183333,44.516667
"Oranjestad","Aruba",12.52458,-70.026459
"Canberra","Australia",-35.3075,149.124417
"Vienna","Austria",48.208333,16.373056
"Baku","Azerbaijan",40.379571,49.891233
"Nassau","Bahamas",25.06,-77.345
"Manama","Bahrain",26.216667,50.583333
"Dhaka","Bangladesh",23.709921,90.407143
"Bridgetown","Barbados",13.096111,-59.608333
"Minsk","Belarus",53.9,27.566667
"Brussels","Belgium",50.846281,4.354727
"Belmopan","Belize",17.251389,-88.766944
"Thimphu","Bhutan",27.466667,89.641667
"La Paz","Bolivia",-16.49901,-68.146248
"Sarajevo","Bosnia and Herzegovina",43.8476,18.3564
"Gaborone","Botswana",-24.65411,25.908739
"Brasilia","Brazil",-15.780148,-47.92917
"Road Town","British Virgin Islands",18.433333,-64.616667
"Bandar Seri Begawan","Brunei Darussalam",4.9431,114.9425
"Sofia","Bulgaria",42.697626,23.322284
"Ouagadougou","Burkina Faso",12.364637,-1.533864
"Bujumbura","Burundi",-3.361378,29.359878
"Phnom Penh","Cambodia",11.55,104.916667
"Yaounde","Cameroon",3.866667,11.516667
"Ottawa","Canada",45.423494,-75.697933
"Praia","Cape Verde",14.920833,-23.508333
"George Town","Cayman Islands",19.286932,-81.367439
"Bangui","Central African Republic",4.361698,18.555975
"N'Djamena","Chad",12.104797,15.044506
"Santiago","Chile",-33.42536,-70.566466
"Beijing","China",39.904667,116.408198
"Bogota","Colombia",4.647302,-74.096268
"Moroni","Comoros",-11.717216,43.247315
"Brazzaville","Congo",-4.266667,15.283333
"San Jose","Costa Rica",9.933333,-84.083333
"Yamoussoukro","Cote d'Ivoire",6.816667,-5.283333
"Zagreb","Croatia",45.814912,15.978515
"Havana","Cuba",23.133333,-82.366667
"Nicosia","Cyprus",35.166667,33.366667
"Prague","Czech Republic",50.087811,14.42046
"Kinshasa","Congo",-4.325,15.322222
"Copenhagen","Denmark",55.676294,12.568116
"Djibouti","Djibouti",11.588,43.145
"Roseau","Dominica",15.301389,-61.388333
"Santo Domingo","Dominican Republic",18.5,-69.983333
"Dili","East Timor",-8.566667,125.566667
"Quito","Ecuador",-0.229498,-78.524277
"Cairo","Egypt",30.064742,31.249509
"San Salvador","El Salvador",13.69,-89.190003
"Malabo","Equatorial Guinea",3.75,8.783333
"Asmara","Eritrea",15.33236,38.92617
"Tallinn","Estonia",59.438862,24.754472
"Addis Ababa","Ethiopia",9.022736,38.746799
"Stanley","Falkland Islands",-51.700981,-57.84919
"Torshavn","Faroe Islands",62.017707,-6.771879
"Suva","Fiji",-18.1416,178.4419
"Helsinki","Finland",60.169813,24.93824
"Paris","France",48.856667,2.350987
"Cayenne","French Guiana",4.9227,-52.3269
"Papeete","French Polynesia",-17.535021,-149.569595
"Libreville","Gabon",0.390841,9.453644
"Banjul","Gambia",13.453056,-16.5775
"T'bilisi","Georgia",41.716667,44.783333
"Berlin","Germany",52.523405,13.4114
"Accra","Ghana",5.555717,-0.196306
"Athens","Greece",37.97918,23.716647
"Nuuk","Greenland",64.18362,-51.721407
"Basse-Terre","Guadeloupe",15.998503,-61.72202
"Guatemala","Guatemala",14.641389,-90.513056
"St. Peter Port","Guernsey",49.458858,-2.534752
"Conakry","Guinea",9.537029,-13.67847
"Bissau","Guinea-Bissau",11.866667,-15.6
"Georgetown","Guyana",6.804611,-58.154831
"Port-au-Prince","Haiti",18.539269,-72.336408
"Tegucigalpa","Honduras",14.082054,-87.206285
"Budapest","Hungary",47.498406,19.040758
"Reykjavik","Iceland",64.135338,-21.89521
"New Delhi","India",28.635308,77.22496
"Jakarta","Indonesia",-6.211544,106.845172
"Tehran","Iran",35.696216,51.422945
"Baghdad","Iraq",33.3157,44.3922
"Dublin","Ireland",53.344104,-6.267494
"Jerusalem","Israel",31.7857,35.2007
"Rome","Italy",41.895466,12.482324
"Kingston","Jamaica",17.992731,-76.792009
"St. Helier","Jersey",49.190278,-2.108611
"Amman","Jordan",31.956578,35.945695
"Astana","Kazakhstan",51.10,71.30
"Nairobi","Kenya",-01.17,36.48
"Tarawa","Kiribati",01.30,173.00
"Seoul","South Korea",37.31,126.58
"Kuwait City","Kuwait",29.30,48.00
"Bishkek","Kyrgyzstan",42.54,74.46
"Riga","Latvia",56.53,24.08
"Beirut","Lebanon",33.53,35.31
"Maseru","Lesotho",-29.18,27.30
"Monrovia","Liberia",06.18,-10.47
"Vaduz","Liechtenstein",47.08,09.31
"Vilnius","Lithuania",54.38,25.19
"Luxembourg","Luxembourg",49.37,06.09
"Antananarivo","Madagascar",-18.55,47.31
"Lilongwe","Malawi",-14.00,33.48
"Kuala Lumpur","Malaysia",03.09,101.41
"Male","Maldives",04.00,73.28
"Bamako","Mali",12.34,-07.55
"Valletta","Malta",35.54,14.31
"Fort-de-France","Martinique",14.36,-61.02
"Nouakchott","Mauritania",-20.10,57.30
"Mamoudzou","Mayotte",-12.48,45.14
"Mexico City","Mexico",19.20,-99.10
"Palikir","Micronesia",06.55,158.09
"Chisinau","Moldova",47.02,28.50
"Maputo","Mozambique",-25.58,32.32
"Yangon","Myanmar",16.45,96.20
"Windhoek","Namibia",-22.35,17.04
"Kathmandu","Nepal",27.45,85.20
"Amsterdam","Netherlands",52.23,04.54
"Willemstad","Netherlands Antilles",12.05,-69.00
"Noumea","New Caledonia",-22.17,166.30
"Wellington","New Zealand",-41.19,174.46
"Managua","Nicaragua",12.06,-86.20
"Niamey","Niger",13.27,02.06
"Abuja","Nigeria",09.05,07.32
"Kingston","Norfolk Island",-45.20,168.43
"Saipan","Northern Mariana Islands",15.12,145.45
"Oslo","Norway",59.55,10.45
"Masqat","Oman",23.37,58.36
"Islamabad","Pakistan",33.40,73.10
"Koror","Palau",07.20,134.28
"Panama City","Panama",09.00,-79.25
"Port Moresby","Papua New Guinea",-09.24,147.08
"Asuncion","Paraguay",-25.10,-57.30
"Lima","Peru",-12.00,-77.00
"Manila","Philippines",14.40,121.03
"Warsaw","Poland",52.13,21.00
"Lisbon","Portugal",38.42,-09.10
"San Juan","Puerto Rico",18.28,-66.07
"Doha","Qatar",25.15,51.35
"Bucuresti","Romania",44.27,26.10
"Moskva","Russian Federation",55.45,37.35
"Kigali","Rawanda",-01.59,30.04
"Basseterre","Saint Kitts and Nevis",17.17,-62.43
"Castries","Saint Lucia",14.02,-60.58
"Saint-Pierre","Saint Pierre and Miquelon",46.46,-56.12
"Apia","Samoa",-13.50,-171.50
"San Marino","San Marino",43.55,12.30
"Sao Tome","Sao Tome and Principe",00.10,06.39
"Riyadh","Saudi Arabia",24.41,46.42
"Dakar","Senegal",14.34,-17.29
"Freetown","Sierra Leone",08.30,-13.17
"Bratislava","Slovakia",48.10,17.07
"Ljubljana","Slovenia",46.04,14.33
"Honiara","Solomon Islands",-09.27,159.57
"Mogadishu","Somalia",02.02,45.25
"Pretoria","South Africa",-25.44,28.12
"Madrid","Spain",40.25,-03.45
"Khartoum","Sudan",15.31,32.35
"Paramaribo","Suriname",05.50,-55.10
"Mbabane","Swaziland",-26.18,31.06
"Stockholm","Sweden",59.20,18.03
"Bern","Switzerland",46.57,07.28
"Damascus","Syrian Arab Republic",33.30,36.18
"Dushanbe","Tajikistan",38.33,68.48
"Bangkok","Thailand",13.45,100.35
"Lome","Togo",06.09,01.20
"Nuku'alofa","Tonga",-21.10,-174.00
"Tunis","Tunisia",36.50,10.11
"Ankara","Turkey",39.57,32.54
"Ashgabat","Turkmenistan",38.00,57.50
"Funafuti","Tuvalu",-08.31,179.13
"Kampala","Uganda",00.20,32.30
"Kiev","Ukraine",50.30,30.28
"Abu Dhabi","United Arab Emirates",24.28,54.22
"London","United Kingdom",51.36,-00.05
"Dodoma","Tanzania",-06.08,35.45
"Washington DC","United States of America",39.91,-77.02
"Montevideo","Uruguay",-34.50,-56.11
"Tashkent","Uzbekistan",41.20,69.10
"Port-Vila","Vanuatu",-17.45,168.18
"Caracas","Venezuela",10.30,-66.55
"Hanoi","Viet Nam",21.05,105.55
"Belgrade","Yugoslavia",44.50,20.37
"Lusaka","Zambia",-15.28,28.16
"Harare","Zimbabwe",-17.43,31.02
"St. John's","Antigua and Barbuda",17.08,-61.50
"Porto Novo","Benin",06.30,02.47
"Hamilton","Bermuda"","32.18,-64.48
"Avarua","Cook Islands",-21.12,-159.46
"St. George's","Grenada",12.04,-61.44
"Aga<EFBFBD>a","Guam",13.28,144.45
"Victoria","Hong Kong",22.16,114.13
"Tokyo","Japan",35.40,139.45
"Pyongyang","North Korea",39.00,125.47
"Vientiane","Laos",17.59,102.38
"Tripoli","Libya",32.54,013.11
"Skopje","Macedonia",42.00,021.28
"Majuro","Marshall Islands",07.05,171.08
"Port Louis","Mauritius",-20.10,57.30
"Monaco","Monaco",43.44,007.25
"Ulan Bator","Mongolia",47.54,106.52
"Plymouth","Montserrat",16.44,-62.14
"Rabat","Morocco",34.02,-06.51
"Alofi","Niue",-14.27,-178.05
"Saint-Denis","R<EFBFBD>union",-20.52,55.27
"Victoria","Seychelles",-04.38,55.28
"Singapore","Singapore",01.18,103.50
"Colombo","Sri Lanka",06.55,79.52
"Kingstown","St Vincent and the Grenadines",13.12,-61.14
"Taipei","Taiwan",25.50,121.32
"Port-of-Spain","Trinidad and Tobago",10.38,-61.31
"Cockburn Harbour","Turks and Caicos Islands",21.30,-71.30
"Charlotte Amalie","US Virgin Islands",18.22,-64.56
"Vatican City","Vatican State",41.54,12.27
"La<EFBFBD>youne","Western Sahara",27.10,-13.11
"San'a","Yemen",15.24,44.14
Can't render this file because it contains an unexpected character in line 195 and column 23.

View File

@@ -0,0 +1,93 @@
<?php
error_reporting(E_ALL);
set_time_limit(0);
date_default_timezone_set('Europe/London');
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>PHPExcel Reading WorkBook Data Example #01</title>
</head>
<body>
<h1>PHPExcel Reading WorkBook Data Example #01</h1>
<h2>Read the WorkBook Properties</h2>
<?php
/** Include path **/
set_include_path(get_include_path() . PATH_SEPARATOR . '../../../Classes/');
/** PHPExcel_IOFactory */
include 'PHPExcel/IOFactory.php';
$inputFileType = 'Excel5';
$inputFileName = './sampleData/example1.xls';
/** Create a new Reader of the type defined in $inputFileType **/
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
/** Load $inputFileName to a PHPExcel Object **/
$objPHPExcel = $objReader->load($inputFileName);
echo '<hr />';
/** Read the document's creator property **/
$creator = $objPHPExcel->getProperties()->getCreator();
echo '<b>Document Creator: </b>',$creator,'<br />';
/** Read the Date when the workbook was created (as a PHP timestamp value) **/
$creationDatestamp = $objPHPExcel->getProperties()->getCreated();
/** Format the date and time using the standard PHP date() function **/
$creationDate = date('l, d<\s\up>S</\s\up> F Y',$creationDatestamp);
$creationTime = date('g:i A',$creationDatestamp);
echo '<b>Created On: </b>',$creationDate,' at ',$creationTime,'<br />';
/** Read the name of the last person to modify this workbook **/
$modifiedBy = $objPHPExcel->getProperties()->getLastModifiedBy();
echo '<b>Last Modified By: </b>',$modifiedBy,'<br />';
/** Read the Date when the workbook was last modified (as a PHP timestamp value) **/
$modifiedDatestamp = $objPHPExcel->getProperties()->getModified();
/** Format the date and time using the standard PHP date() function **/
$modifiedDate = date('l, d<\s\up>S</\s\up> F Y',$modifiedDatestamp);
$modifiedTime = date('g:i A',$modifiedDatestamp);
echo '<b>Last Modified On: </b>',$modifiedDate,' at ',$modifiedTime,'<br />';
/** Read the workbook title property **/
$workbookTitle = $objPHPExcel->getProperties()->getTitle();
echo '<b>Title: </b>',$workbookTitle,'<br />';
/** Read the workbook description property **/
$description = $objPHPExcel->getProperties()->getDescription();
echo '<b>Description: </b>',$description,'<br />';
/** Read the workbook subject property **/
$subject = $objPHPExcel->getProperties()->getSubject();
echo '<b>Subject: </b>',$subject,'<br />';
/** Read the workbook keywords property **/
$keywords = $objPHPExcel->getProperties()->getKeywords();
echo '<b>Keywords: </b>',$keywords,'<br />';
/** Read the workbook category property **/
$category = $objPHPExcel->getProperties()->getCategory();
echo '<b>Category: </b>',$category,'<br />';
/** Read the workbook company property **/
$company = $objPHPExcel->getProperties()->getCompany();
echo '<b>Company: </b>',$company,'<br />';
/** Read the workbook manager property **/
$manager = $objPHPExcel->getProperties()->getManager();
echo '<b>Manager: </b>',$manager,'<br />';
?>
<body>
</html>

View File

@@ -0,0 +1,52 @@
<?php
error_reporting(E_ALL);
set_time_limit(0);
date_default_timezone_set('Europe/London');
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>PHPExcel Reading WorkBook Data Example #02</title>
</head>
<body>
<h1>PHPExcel Reading WorkBook Data Example #02</h1>
<h2>Read a list of Custom Properties for a WorkBook</h2>
<?php
/** Include path **/
set_include_path(get_include_path() . PATH_SEPARATOR . '../../../Classes/');
/** PHPExcel_IOFactory */
include 'PHPExcel/IOFactory.php';
$inputFileType = 'Excel2007';
$inputFileName = './sampleData/example1.xlsx';
/** Create a new Reader of the type defined in $inputFileType **/
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
/** Load $inputFileName to a PHPExcel Object **/
$objPHPExcel = $objReader->load($inputFileName);
echo '<hr />';
/** Read an array list of any custom properties for this document **/
$customPropertyList = $objPHPExcel->getProperties()->getCustomProperties();
echo '<b>Custom Property names: </b><br />';
foreach($customPropertyList as $customPropertyName) {
echo $customPropertyName,'<br />';
}
?>
<body>
</html>

View File

@@ -0,0 +1,80 @@
<?php
error_reporting(E_ALL);
set_time_limit(0);
date_default_timezone_set('Europe/London');
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>PHPExcel Reading WorkBook Data Example #03</title>
</head>
<body>
<h1>PHPExcel Reading WorkBook Data Example #03</h1>
<h2>Read Custom Property Values for a WorkBook</h2>
<?php
/** Include path **/
set_include_path(get_include_path() . PATH_SEPARATOR . '../../../Classes/');
/** PHPExcel_IOFactory */
include 'PHPExcel/IOFactory.php';
$inputFileType = 'Excel2007';
$inputFileName = './sampleData/example1.xlsx';
/** Create a new Reader of the type defined in $inputFileType **/
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
/** Load $inputFileName to a PHPExcel Object **/
$objPHPExcel = $objReader->load($inputFileName);
echo '<hr />';
/** Read an array list of any custom properties for this document **/
$customPropertyList = $objPHPExcel->getProperties()->getCustomProperties();
echo '<b>Custom Properties: </b><br />';
/** Loop through the list of custom properties **/
foreach($customPropertyList as $customPropertyName) {
echo '<b>',$customPropertyName,': </b>';
/** Retrieve the property value **/
$propertyValue = $objPHPExcel->getProperties()->getCustomPropertyValue($customPropertyName);
/** Retrieve the property type **/
$propertyType = $objPHPExcel->getProperties()->getCustomPropertyType($customPropertyName);
/** Manipulate properties as appropriate for display purposes **/
switch($propertyType) {
case 'i' : // integer
$propertyType = 'integer number';
break;
case 'f' : // float
$propertyType = 'floating point number';
break;
case 's' : // string
$propertyType = 'string';
break;
case 'd' : // date
$propertyValue = date('l, d<\s\up>S</\s\up> F Y g:i A',$propertyValue);
$propertyType = 'date';
break;
case 'b' : // boolean
$propertyValue = ($propertyValue) ? 'TRUE' : 'FALSE';
$propertyType = 'boolean';
break;
}
echo $propertyValue,' (',$propertyType,')<br />';
}
?>
<body>
</html>

View File

@@ -0,0 +1,55 @@
<?php
error_reporting(E_ALL);
set_time_limit(0);
date_default_timezone_set('Europe/London');
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>PHPExcel Reading WorkBook Data Example #04</title>
</head>
<body>
<h1>PHPExcel Reading WorkBook Data Example #04</h1>
<h2>Get a List of the Worksheets in a WorkBook</h2>
<?php
/** Include path **/
set_include_path(get_include_path() . PATH_SEPARATOR . '../../../Classes/');
/** PHPExcel_IOFactory */
include 'PHPExcel/IOFactory.php';
$inputFileType = 'Excel5';
$inputFileName = './sampleData/example2.xls';
/** Create a new Reader of the type defined in $inputFileType **/
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
/** Load $inputFileName to a PHPExcel Object **/
$objPHPExcel = $objReader->load($inputFileName);
echo '<hr />';
echo 'Reading the number of Worksheets in the WorkBook<br />';
/** Use the PHPExcel object's getSheetCount() method to get a count of the number of WorkSheets in the WorkBook */
$sheetCount = $objPHPExcel->getSheetCount();
echo 'There ',(($sheetCount == 1) ? 'is' : 'are'),' ',$sheetCount,' WorkSheet',(($sheetCount == 1) ? '' : 's'),' in the WorkBook<br /><br />';
echo 'Reading the names of Worksheets in the WorkBook<br />';
/** Use the PHPExcel object's getSheetNames() method to get an array listing the names/titles of the WorkSheets in the WorkBook */
$sheetNames = $objPHPExcel->getSheetNames();
foreach($sheetNames as $sheetIndex => $sheetName) {
echo 'WorkSheet #',$sheetIndex,' is named "',$sheetName,'"<br />';
}
?>
<body>
</html>

View File

@@ -0,0 +1,50 @@
<?php
error_reporting(E_ALL);
set_time_limit(0);
date_default_timezone_set('Europe/London');
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>PHPExcel Examples</title>
</head>
<body>
<?php
$exampleTypeList = glob('./*',GLOB_ONLYDIR);
foreach($exampleTypeList as $exampleType) {
echo '<h1>PHPExcel ' . pathinfo($exampleType,PATHINFO_BASENAME) . ' Examples</h1>';
$exampleList = glob('./'.$exampleType.'/*.php');
foreach($exampleList as $exampleFile) {
$fileData = file_get_contents($exampleFile);
$h1Pattern = '#<h1>(.*?)</h1>#';
$h2Pattern = '#<h2>(.*?)</h2>#';
if (preg_match($h1Pattern, $fileData, $out)) {
$h1Text = $out[1];
$h2Text = (preg_match($h2Pattern, $fileData, $out)) ? $out[1] : '';
echo '<a href="',$exampleFile,'">',$h1Text,'</a><br />';
if (($h2Text > '') &&
(pathinfo($exampleType,PATHINFO_BASENAME) != 'Calculations')) {
echo $h2Text,'<br />';
}
}
}
}
?>
<body>
</html>

Binary file not shown.

View File

@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="utf-8"?>
<ClassDiagram MajorVersion="1" MinorVersion="1">
<Font Name="Tahoma" Size="8.25" />
<Class Name="ClassDiagrams.PHPExcel" Collapsed="true">
<Position X="3.5" Y="0.5" Width="1.5" />
<TypeIdentifier>
<FileName>Classes\PHPExcel.cs</FileName>
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAA=</HashCode>
</TypeIdentifier>
<ShowAsAssociation>
<Property Name="Worksheets" />
</ShowAsAssociation>
</Class>
<Class Name="ClassDiagrams.Worksheet" Collapsed="true">
<Position X="0.5" Y="0.5" Width="1.5" />
<TypeIdentifier>
<FileName>Classes\Worksheet.cs</FileName>
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
</TypeIdentifier>
</Class>
<Interface Name="ClassDiagrams.PHPExcel_Reader_IReader" Collapsed="true">
<Position X="2.25" Y="2.5" Width="2" />
<TypeIdentifier>
<FileName>Classes\IReader.cs</FileName>
<HashCode>AAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
</TypeIdentifier>
<ShowAsAssociation>
<Property Name="reads" />
</ShowAsAssociation>
<AssociationLine Name="reads" Type="ClassDiagrams.PHPExcel">
<MemberNameLabel ManuallyPlaced="true" ManuallySized="true">
<Position X="0.152" Y="1.279" Height="0.16" Width="0.597" />
</MemberNameLabel>
</AssociationLine>
</Interface>
<Interface Name="ClassDiagrams.PHPExcel_Writer_IWriter" Collapsed="true">
<Position X="4.5" Y="2.5" Width="2" />
<TypeIdentifier>
<FileName>Classes\IWriter.cs</FileName>
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAA=</HashCode>
</TypeIdentifier>
<ShowAsAssociation>
<Property Name="writes" />
</ShowAsAssociation>
<AssociationLine Name="writes" Type="ClassDiagrams.PHPExcel">
<MemberNameLabel ManuallyPlaced="true" ManuallySized="true">
<Position X="-1.002" Y="1.298" Height="0.16" Width="0.764" />
</MemberNameLabel>
</AssociationLine>
</Interface>
</ClassDiagram>

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

View File

@@ -0,0 +1,64 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.50727</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{CC8CD7D2-8EFF-48E5-A17A-C1C482744D31}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ClassDiagrams</RootNamespace>
<AssemblyName>ClassDiagrams</AssemblyName>
<FileUpgradeFlags>
</FileUpgradeFlags>
<OldToolsVersion>2.0</OldToolsVersion>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
<ItemGroup>
<None Include="Architecture.cd" />
<None Include="ReaderWriter.cd" />
</ItemGroup>
<ItemGroup>
<Compile Include="Classes\IReader.cs" />
<Compile Include="Classes\IWriter.cs" />
<Compile Include="Classes\PHPExcel_IOFactory.cs" />
<Compile Include="Classes\Worksheet.cs" />
<Compile Include="Classes\PHPExcel.cs" />
<Compile Include="Classes\PHPExcel_Reader_Excel2007.cs" />
<Compile Include="Classes\PHPExcel_Reader_Serialized.cs" />
<Compile Include="Classes\PHPExcel_Writer_Excel2007.cs" />
<Compile Include="Classes\PHPExcel_Writer_Serialized.cs" />
<Compile Include="Classes\PHPExcel_Reader_Excel5.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="Exports\Architecture.png" />
<Content Include="Exports\ReaderWriter.png" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,5 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectView>ShowAllFiles</ProjectView>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,20 @@

Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClassDiagrams", "ClassDiagrams.csproj", "{CC8CD7D2-8EFF-48E5-A17A-C1C482744D31}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{CC8CD7D2-8EFF-48E5-A17A-C1C482744D31}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CC8CD7D2-8EFF-48E5-A17A-C1C482744D31}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CC8CD7D2-8EFF-48E5-A17A-C1C482744D31}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CC8CD7D2-8EFF-48E5-A17A-C1C482744D31}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace ClassDiagrams
{
public interface PHPExcel_Reader_IReader
{
PHPExcel reads
{
get;
set;
}
}
}

View File

@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace ClassDiagrams
{
public interface PHPExcel_Writer_IWriter
{
PHPExcel writes
{
get;
set;
}
}
}

View File

@@ -0,0 +1,40 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace ClassDiagrams
{
public class PHPExcel
{
/// <remarks></remarks>
public Worksheet Worksheets
{
get
{
throw new System.NotImplementedException();
}
set
{
}
}
}
public class PHPExcel_Writer_PDF : PHPExcel_Writer_IWriter
{
#region PHPExcel_Writer_IWriter Members
public PHPExcel writes
{
get
{
throw new Exception("The method or operation is not implemented.");
}
set
{
throw new Exception("The method or operation is not implemented.");
}
}
#endregion
}
}

View File

@@ -0,0 +1,41 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace ClassDiagrams
{
public class PHPExcel_IOFactory
{
public PHPExcel_Reader_IReader createsReader
{
get
{
throw new System.NotImplementedException();
}
set
{
}
}
public PHPExcel_Writer_IWriter createsWriter
{
get
{
throw new System.NotImplementedException();
}
set
{
}
}
public PHPExcel_Writer_IWriter createWriter()
{
throw new System.NotImplementedException();
}
public PHPExcel_Reader_IReader createReader()
{
throw new System.NotImplementedException();
}
}
}

View File

@@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace ClassDiagrams
{
public class PHPExcel_Reader_Excel2007 : PHPExcel_Reader_IReader
{
#region IReader Members
public PHPExcel reads
{
get
{
throw new Exception("The method or operation is not implemented.");
}
set
{
throw new Exception("The method or operation is not implemented.");
}
}
#endregion
}
}

View File

@@ -0,0 +1,63 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace ClassDiagrams
{
public class PHPExcel_Reader_Excel5 : PHPExcel_Reader_IReader
{
#region PHPExcel_Writer_IReader Members
public PHPExcel reads
{
get
{
throw new Exception("The method or operation is not implemented.");
}
set
{
throw new Exception("The method or operation is not implemented.");
}
}
#endregion
}
public class PHPExcel_Reader_Excel2003XML : PHPExcel_Reader_IReader
{
#region PHPExcel_Writer_IReader Members
public PHPExcel reads
{
get
{
throw new Exception("The method or operation is not implemented.");
}
set
{
throw new Exception("The method or operation is not implemented.");
}
}
#endregion
}
public class PHPExcel_Reader_SYLK : PHPExcel_Reader_IReader
{
#region PHPExcel_Writer_IReader Members
public PHPExcel reads
{
get
{
throw new Exception("The method or operation is not implemented.");
}
set
{
throw new Exception("The method or operation is not implemented.");
}
}
#endregion
}
}

View File

@@ -0,0 +1,44 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace ClassDiagrams
{
public class PHPExcel_Reader_Serialized : PHPExcel_Reader_IReader
{
#region IReader Members
public PHPExcel reads
{
get
{
throw new Exception("The method or operation is not implemented.");
}
set
{
throw new Exception("The method or operation is not implemented.");
}
}
#endregion
}
public class PHPExcel_Reader_CSV : PHPExcel_Reader_IReader
{
#region IReader Members
public PHPExcel reads
{
get
{
throw new Exception("The method or operation is not implemented.");
}
set
{
throw new Exception("The method or operation is not implemented.");
}
}
#endregion
}
}

View File

@@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace ClassDiagrams
{
public class PHPExcel_Writer_Excel2007 : PHPExcel_Writer_IWriter
{
#region IWriter Members
public PHPExcel writes
{
get
{
throw new Exception("The method or operation is not implemented.");
}
set
{
throw new Exception("The method or operation is not implemented.");
}
}
#endregion
}
}

View File

@@ -0,0 +1,82 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace ClassDiagrams
{
public class PHPExcel_Writer_Serialized : PHPExcel_Writer_IWriter
{
#region IWriter Members
public PHPExcel writes
{
get
{
throw new Exception("The method or operation is not implemented.");
}
set
{
throw new Exception("The method or operation is not implemented.");
}
}
#endregion
}
public class PHPExcel_Writer_CSV : PHPExcel_Writer_IWriter
{
#region IWriter Members
public PHPExcel writes
{
get
{
throw new Exception("The method or operation is not implemented.");
}
set
{
throw new Exception("The method or operation is not implemented.");
}
}
#endregion
}
public class PHPExcel_Writer_Excel5 : PHPExcel_Writer_IWriter
{
#region IWriter Members
public PHPExcel writes
{
get
{
throw new Exception("The method or operation is not implemented.");
}
set
{
throw new Exception("The method or operation is not implemented.");
}
}
#endregion
}
public class PHPExcel_Writer_HTML : PHPExcel_Writer_IWriter
{
#region IWriter Members
public PHPExcel writes
{
get
{
throw new Exception("The method or operation is not implemented.");
}
set
{
throw new Exception("The method or operation is not implemented.");
}
}
#endregion
}
}

View File

@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace ClassDiagrams
{
public class Worksheet
{
}
public class CopyOfWorksheet
{
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

View File

@@ -0,0 +1,135 @@
<?xml version="1.0" encoding="utf-8"?>
<ClassDiagram MajorVersion="1" MinorVersion="1">
<Class Name="ClassDiagrams.PHPExcel_Reader_Excel2007" Collapsed="true" BaseTypeListCollapsed="true">
<Position X="0.5" Y="3.5" Width="2.25" />
<TypeIdentifier>
<HashCode>AAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
<FileName>Classes\PHPExcel_Reader_Excel2007.cs</FileName>
</TypeIdentifier>
<Lollipop Position="0.2" />
</Class>
<Class Name="ClassDiagrams.PHPExcel_Writer_Excel2007" Collapsed="true" BaseTypeListCollapsed="true">
<Position X="3.5" Y="3.5" Width="2.25" />
<TypeIdentifier>
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAA=</HashCode>
<FileName>Classes\PHPExcel_Writer_Excel2007.cs</FileName>
</TypeIdentifier>
<Lollipop Position="0.2" />
</Class>
<Class Name="ClassDiagrams.PHPExcel_Reader_Serialized" Collapsed="true" BaseTypeListCollapsed="true">
<Position X="0.5" Y="4.25" Width="2.25" />
<TypeIdentifier>
<HashCode>AAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
<FileName>Classes\PHPExcel_Reader_Serialized.cs</FileName>
</TypeIdentifier>
<Lollipop Position="0.2" />
</Class>
<Class Name="ClassDiagrams.PHPExcel_Writer_Serialized" Collapsed="true" BaseTypeListCollapsed="true">
<Position X="3.5" Y="4.25" Width="2.25" />
<TypeIdentifier>
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAA=</HashCode>
<FileName>Classes\PHPExcel_Writer_Serialized.cs</FileName>
</TypeIdentifier>
<Lollipop Position="0.2" />
</Class>
<Class Name="ClassDiagrams.PHPExcel_Reader_CSV" Collapsed="true" BaseTypeListCollapsed="true">
<Position X="0.5" Y="5" Width="2.25" />
<TypeIdentifier>
<HashCode>AAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
<FileName>Classes\PHPExcel_Reader_Serialized.cs</FileName>
</TypeIdentifier>
<Lollipop Position="0.2" />
</Class>
<Class Name="ClassDiagrams.PHPExcel_Writer_CSV" Collapsed="true" BaseTypeListCollapsed="true">
<Position X="3.5" Y="5" Width="2.25" />
<TypeIdentifier>
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAA=</HashCode>
<FileName>Classes\PHPExcel_Writer_Serialized.cs</FileName>
</TypeIdentifier>
<Lollipop Position="0.2" />
</Class>
<Class Name="ClassDiagrams.PHPExcel_Writer_Excel5" Collapsed="true" BaseTypeListCollapsed="true">
<Position X="3.5" Y="5.75" Width="2.25" />
<TypeIdentifier>
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAA=</HashCode>
<FileName>Classes\PHPExcel_Writer_Serialized.cs</FileName>
</TypeIdentifier>
<Lollipop Position="0.2" />
</Class>
<Class Name="ClassDiagrams.PHPExcel_Writer_HTML" Collapsed="true" BaseTypeListCollapsed="true">
<Position X="3.5" Y="6.5" Width="2.25" />
<TypeIdentifier>
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAA=</HashCode>
<FileName>Classes\PHPExcel_Writer_Serialized.cs</FileName>
</TypeIdentifier>
<Lollipop Position="0.2" />
</Class>
<Class Name="ClassDiagrams.PHPExcel_Reader_Excel5" Collapsed="true">
<Position X="0.5" Y="5.75" Width="2.25" />
<TypeIdentifier>
<HashCode>AAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
<FileName>Classes\PHPExcel_Reader_Excel5.cs</FileName>
</TypeIdentifier>
<Lollipop Position="0.2" />
</Class>
<Class Name="ClassDiagrams.PHPExcel_Writer_PDF" Collapsed="true">
<Position X="3.5" Y="7.25" Width="2.25" />
<TypeIdentifier>
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAA=</HashCode>
<FileName>Classes\PHPExcel.cs</FileName>
</TypeIdentifier>
<Lollipop Position="0.2" />
</Class>
<Class Name="ClassDiagrams.PHPExcel_IOFactory">
<Position X="2" Y="0.5" Width="2.25" />
<AssociationLine Name="createsReader" Type="ClassDiagrams.PHPExcel_Reader_IReader">
<MemberNameLabel ManuallyPlaced="true">
<Position X="0.11" Y="0.06" />
</MemberNameLabel>
</AssociationLine>
<AssociationLine Name="createsWriter" Type="ClassDiagrams.PHPExcel_Writer_IWriter">
<MemberNameLabel ManuallyPlaced="true">
<Position X="-1.088" Y="0.081" />
</MemberNameLabel>
</AssociationLine>
<TypeIdentifier>
<HashCode>AIAAAAAAAAEAAAAAAQAAAAAAAAAAAAAAAAABAAAAAAA=</HashCode>
<FileName>Classes\PHPExcel_IOFactory.cs</FileName>
</TypeIdentifier>
<ShowAsAssociation>
<Property Name="createsReader" />
<Property Name="createsWriter" />
</ShowAsAssociation>
</Class>
<Class Name="ClassDiagrams.PHPExcel_Reader_Excel2003XML" Collapsed="true">
<Position X="0.5" Y="6.5" Width="2.25" />
<TypeIdentifier>
<HashCode>AAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
<FileName>Classes\PHPExcel_Reader_Excel5.cs</FileName>
</TypeIdentifier>
<Lollipop Position="0.2" />
</Class>
<Class Name="ClassDiagrams.PHPExcel_Reader_SYLK" Collapsed="true">
<Position X="0.5" Y="7.25" Width="2.25" />
<TypeIdentifier>
<HashCode>AAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
<FileName>Classes\PHPExcel_Reader_Excel5.cs</FileName>
</TypeIdentifier>
<Lollipop Position="0.2" />
</Class>
<Interface Name="ClassDiagrams.PHPExcel_Writer_IWriter" Collapsed="true">
<Position X="3.5" Y="2.5" Width="2.25" />
<TypeIdentifier>
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAA=</HashCode>
<FileName>Classes\IWriter.cs</FileName>
</TypeIdentifier>
</Interface>
<Interface Name="ClassDiagrams.PHPExcel_Reader_IReader" Collapsed="true">
<Position X="0.5" Y="2.5" Width="2.25" />
<TypeIdentifier>
<HashCode>AAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
<FileName>Classes\IReader.cs</FileName>
</TypeIdentifier>
</Interface>
<Font Name="Tahoma" Size="8.25" />
</ClassDiagram>

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

View File

@@ -0,0 +1,11 @@
# Calculation Engine - Formula Function Reference
## Frequently asked questions
The up-to-date F.A.Q. page for PHPExcel can be found on [http://www.codeplex.com/PHPExcel/Wiki/View.aspx?title=FAQ&referringTitle=Requirements][1].
### Formulas dont seem to be calculated in Excel2003 using compatibility pack?
This is normal behaviour of the compatibility pack, Excel2007 displays this correctly. Use PHPExcel_Writer_Excel5 if you really need calculated values, or force recalculation in Excel2003.
[1]: http://www.codeplex.com/PHPExcel/Wiki/View.aspx?title=FAQ&referringTitle=Requirements

View File

@@ -0,0 +1,123 @@
# Calculation Engine - Formula Function Reference
## Function Reference
### Handling Date and Time Values
#### Excel functions that return a Date and Time value
Any of the Date and Time functions that return a date value in Excel can return either an Excel timestamp or a PHP timestamp or date object.
It is possible for scripts to change the data type used for returning date values by calling the PHPExcel_Calculation_Functions::setReturnDateType() method:
```php
PHPExcel_Calculation_Functions::setReturnDateType($returnDateType);
```
where the following constants can be used for $returnDateType
- PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC
- PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT
- PHPExcel_Calculation_Functions::RETURNDATE_EXCEL
The method will return a Boolean True on success, False on failure (e.g. if an invalid value is passed in for the return date type).
The PHPExcel_Calculation_Functions::getReturnDateType() method can be used to determine the current value of this setting:
```php
$returnDateType = PHPExcel_Calculation_Functions::getReturnDateType();
```
The default is RETURNDATE_PHP_NUMERIC.
##### PHP Timestamps
If RETURNDATE_PHP_NUMERIC is set for the Return Date Type, then any date value returned to the calling script by any access to the Date and Time functions in Excel will be an integer value that represents the number of seconds from the PHP/Unix base date. The PHP/Unix base date (0) is 00:00 UST on 1st January 1970. This value can be positive or negative: so a value of -3600 would be 23:00 hrs on 31st December 1969; while a value of +3600 would be 01:00 hrs on 1st January 1970. This gives PHP a date range of between 14th December 1901 and 19th January 2038.
##### PHP DateTime Objects
If the Return Date Type is set for RETURNDATE_PHP_NUMERIC, then any date value returned to the calling script by any access to the Date and Time functions in Excel will be a PHP date/time object.
##### Excel Timestamps
If RETURNDATE_EXCEL is set for the Return Date Type, then the returned date value by any access to the Date and Time functions in Excel will be a floating point value that represents a number of days from the Excel base date. The Excel base date is determined by which calendar Excel uses: the Windows 1900 or the Mac 1904 calendar. 1st January 1900 is the base date for the Windows 1900 calendar while 1st January 1904 is the base date for the Mac 1904 calendar.
It is possible for scripts to change the calendar used for calculating Excel date values by calling the PHPExcel_Shared_Date::setExcelCalendar() method:
```php
PHPExcel_Shared_Date::setExcelCalendar($baseDate);
```
where the following constants can be used for $baseDate
- PHPExcel_Shared_Date::CALENDAR_WINDOWS_1900
- PHPExcel_Shared_Date::CALENDAR_MAC_1904
The method will return a Boolean True on success, False on failure (e.g. if an invalid value is passed in).
The PHPExcel_Shared_Date::getExcelCalendar() method can be used to determine the current value of this setting:
```php
$baseDate = PHPExcel_Shared_Date::getExcelCalendar();
```
The default is CALENDAR_WINDOWS_1900.
##### Functions that return a Date/Time Value
- DATE
- DATEVALUE
- EDATE
- EOMONTH
- NOW
- TIME
- TIMEVALUE
- TODAY
#### Excel functions that accept Date and Time values as parameters
Date values passed in as parameters to a function can be an Excel timestamp or a PHP timestamp; or date object; or a string containing a date value (e.g. '1-Jan-2009'). PHPExcel will attempt to identify their type based on the PHP datatype:
An integer numeric value will be treated as a PHP/Unix timestamp. A real (floating point) numeric value will be treated as an Excel date/timestamp. Any PHP DateTime object will be treated as a DateTime object. Any string value (even one containing straight numeric data) will be converted to a date/time object for validation as a date value based on the server locale settings, so passing through an ambiguous value of '07/08/2008' will be treated as 7th August 2008 if your server settings are UK, but as 8th July 2008 if your server settings are US. However, if you pass through a value such as '31/12/2008' that would be considered an error by a US-based server, but which is not ambiguous, then PHPExcel will attempt to correct this to 31st December 2008. If the content of the string doesnt match any of the formats recognised by the php date/time object implementation of strtotime() (which can handle a wider range of formats than the normal strtotime() function), then the function will return a '#VALUE' error. However, Excel recommends that you should always use date/timestamps for your date functions, and the recommendation for PHPExcel is the same: avoid strings because the result is not predictable.
The same principle applies when data is being written to Excel. Cells containing date actual values (rather than Excel functions that return a date value) are always written as Excel dates, converting where necessary. If a cell formatted as a date contains an integer or date/time object value, then it is converted to an Excel value for writing: if a cell formatted as a date contains a real value, then no conversion is required. Note that string values are written as strings rather than converted to Excel date timestamp values.
##### Functions that expect a Date/Time Value
- DATEDIF
- DAY
- DAYS360
- EDATE
- EOMONTH
- HOUR
- MINUTE
- MONTH
- NETWORKDAYS
- SECOND
- WEEKDAY
- WEEKNUM
- WORKDAY
- YEAR
- YEARFRAC
#### Helper Methods
In addition to the setExcelCalendar() and getExcelCalendar() methods, a number of other methods are available in the PHPExcel_Shared_Date class that can help when working with dates:
##### PHPExcel_Shared_Date::ExcelToPHP($excelDate)
Converts a date/time from an Excel date timestamp to return a PHP serialized date/timestamp.
Note that this method does not trap for Excel dates that fall outside of the valid range for a PHP date timestamp.
##### PHPExcel_Shared_Date::ExcelToPHPObject($excelDate)
Converts a date from an Excel date/timestamp to return a PHP DateTime object.
##### PHPExcel_Shared_Date::PHPToExcel($PHPDate)
Converts a PHP serialized date/timestamp or a PHP DateTime object to return an Excel date timestamp.
##### PHPExcel_Shared_Date::FormattedPHPToExcel($year, $month, $day, $hours=0, $minutes=0, $seconds=0)
Takes year, month and day values (and optional hour, minute and second values) and returns an Excel date timestamp value.

View File

@@ -0,0 +1,36 @@
# Calculation Engine - Formula Function Reference
## General Introduction
### Function that are not Supported in Excel5
Not all functions are supported by the Excel 5 Writer. Use of these functions within your workbooks will result in an error when trying to write to Excel5.
The following is the list of those functions that are implemented within PHPExcel, but that cannot currently be written to Excel 5.
#### Cube Functions
Excel Function | Notes
--------------------|---------
CUBEKPIMEMBER | Not yet Implemented
CUBEMEMBER | Not yet Implemented
CUBEMEMBERPROPERTY | Not yet Implemented
CUBERANKEDMEMBER | Not yet Implemented
CUBESET | Not yet Implemented
CUBESETCOUNT | Not yet Implemented
CUBEVALUE | Not yet Implemented
#### Database Functions
Excel Function | Notes
---------------|---------
#### Date and Time Functions
Excel Function | Notes
---------------|---------
EDATE | Not a standard function within Excel 5, but an add-in from the Analysis ToolPak.
EOMONTH | Not a standard function within Excel 5, but an add-in from the Analysis ToolPak.

View File

@@ -0,0 +1,34 @@
# Calculation Engine - Formula Function Reference
## Function Reference
### Cube Functions
#### CUBEKPIMEMBER
Not yet implemented.
#### CUBEMEMBER
Not yet implemented.
#### CUBEMEMBERPROPERTY
Not yet implemented.
#### CUBERANKEDMEMBER
Not yet implemented.
#### CUBESET
Not yet implemented.
#### CUBESETCOUNT
Not yet implemented.
#### CUBEVALUE
Not yet implemented.

View File

@@ -0,0 +1,618 @@
# Calculation Engine - Formula Function Reference
## Function Reference
### Database Functions
#### DAVERAGE
The DAVERAGE function returns the average value of the cells in a column of a list or database that match conditions you specify.
##### Syntax
```
DAVERAGE (database, field, criteria)
```
##### Parameters
**database** The range of cells that makes up the list or database.
A database is a list of related data in which rows of related information are records, and columns of data are fields. The first row of the list contains labels for each column.
**field** Indicates which column of the database is used in the function.
Enter the column label as a string (enclosed between double quotation marks), such as "Age" or "Yield," or as a number (without quotation marks) that represents the position of the column within the list: 1 for the first column, 2 for the second column, and so on.
**criteria** The range of cells that contains the conditions you specify.
You can use any range for the criteria argument, as long as it includes at least one column label and at least one cell below the column label in which you specify a condition for the column.
##### Return Value
**float** The average value of the matching cells.
This is the statistical mean.
##### Examples
```php
$database = array(
array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ),
array( 'Apple', 18, 20, 14, 105.00 ),
array( 'Pear', 12, 12, 10, 96.00 ),
array( 'Cherry', 13, 14, 9, 105.00 ),
array( 'Apple', 14, 15, 10, 75.00 ),
array( 'Pear', 9, 8, 8, 76.80 ),
array( 'Apple', 8, 9, 6, 45.00 ),
);
$criteria = array(
array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ),
array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ),
array( '="=Pear"', NULL, NULL, NULL, NULL, NULL ),
);
$worksheet->fromArray( $criteria, NULL, 'A1' )
->fromArray( $database, NULL, 'A4' );
$worksheet->setCellValue('A12', '=DAVERAGE(A4:E10,"Yield",A1:B2)');
$retVal = $worksheet->getCell('A12')->getCalculatedValue();
// $retVal = 12
```
##### Notes
There are no additional notes on this function
#### DCOUNT
The DCOUNT function returns the count of cells that contain a number in a column of a list or database matching conditions that you specify.
##### Syntax
```
DCOUNT(database, [field], criteria)
```
##### Parameters
**database** The range of cells that makes up the list or database.
A database is a list of related data in which rows of related information are records, and columns of data are fields. The first row of the list contains labels for each column.
**field** Indicates which column of the database is used in the function.
Enter the column label as a string (enclosed between double quotation marks), such as "Age" or "Yield," or as a number (without quotation marks) that represents the position of the column within the list: 1 for the first column, 2 for the second column, and so on.
**criteria** The range of cells that contains the conditions you specify.
You can use any range for the criteria argument, as long as it includes at least one column label and at least one cell below the column label in which you specify a condition for the column.
##### Return Value
**float** The count of the matching cells.
##### Examples
```php
$database = array(
array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ),
array( 'Apple', 18, 20, 14, 105.00 ),
array( 'Pear', 12, 12, 10, 96.00 ),
array( 'Cherry', 13, 14, 9, 105.00 ),
array( 'Apple', 14, 15, 10, 75.00 ),
array( 'Pear', 9, 8, 8, 76.80 ),
array( 'Apple', 8, 9, 6, 45.00 ),
);
$criteria = array(
array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ),
array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ),
array( '="=Pear"', NULL, NULL, NULL, NULL, NULL ),
);
$worksheet->fromArray( $criteria, NULL, 'A1' )
->fromArray( $database, NULL, 'A4' );
$worksheet->setCellValue('A12', '=DCOUNT(A4:E10,"Height",A1:B3)');
$retVal = $worksheet->getCell('A12')->getCalculatedValue();
// $retVal = 3
```
##### Notes
In MS Excel, The field argument is optional. If field is omitted, DCOUNT counts all records in the database that match the criteria. This logic has not yet been implemented in PHPExcel.
#### DCOUNTA
The DCOUNT function returns the count of cells that arent blank in a column of a list or database and that match conditions that you specify.
##### Syntax
```
DCOUNTA(database, [field], criteria)
```
##### Parameters
**database** The range of cells that makes up the list or database.
A database is a list of related data in which rows of related information are records, and columns of data are fields. The first row of the list contains labels for each column.
**field** Indicates which column of the database is used in the function.
Enter the column label as a string (enclosed between double quotation marks), such as "Age" or "Yield," or as a number (without quotation marks) that represents the position of the column within the list: 1 for the first column, 2 for the second column, and so on.
**criteria** The range of cells that contains the conditions you specify.
You can use any range for the criteria argument, as long as it includes at least one column label and at least one cell below the column label in which you specify a condition for the column.
##### Return Value
**float** The count of the matching cells.
##### Examples
```php
$database = array(
array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ),
array( 'Apple', 18, 20, 14, 105.00 ),
array( 'Pear', 12, 12, 10, 96.00 ),
array( 'Cherry', 13, 14, 9, 105.00 ),
array( 'Apple', 14, 15, 10, 75.00 ),
array( 'Pear', 9, 8, 8, 76.80 ),
array( 'Apple', 8, 9, 6, 45.00 ),
);
$criteria = array(
array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ),
array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ),
array( '="=Pear"', NULL, NULL, NULL, NULL, NULL ),
);
$worksheet->fromArray( $criteria, NULL, 'A1' )
->fromArray( $database, NULL, 'A4' );
$worksheet->setCellValue('A12', '=DCOUNTA(A4:E10,"Yield",A1:A3)');
$retVal = $worksheet->getCell('A12')->getCalculatedValue();
// $retVal = 5
```
##### Notes
In MS Excel, The field argument is optional. If field is omitted, DCOUNTA counts all records in the database that match the criteria. This logic has not yet been implemented in PHPExcel.
#### DGET
The DGET function extracts a single value from a column of a list or database that matches conditions that you specify.
##### Syntax
```
DGET(database, field, criteria)
```
##### Parameters
**database** The range of cells that makes up the list or database.
A database is a list of related data in which rows of related information are records, and columns of data are fields. The first row of the list contains labels for each column.
**field** Indicates which column of the database is used in the function.
Enter the column label as a string (enclosed between double quotation marks), such as "Age" or "Yield," or as a number (without quotation marks) that represents the position of the column within the list: 1 for the first column, 2 for the second column, and so on.
**criteria** The range of cells that contains the conditions you specify.
You can use any range for the criteria argument, as long as it includes at least one column label and at least one cell below the column label in which you specify a condition for the column.
##### Return Value
**mixed** The value from the selected column of the matching row.
#### Examples
```php
$database = array(
array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ),
array( 'Apple', 18, 20, 14, 105.00 ),
array( 'Pear', 12, 12, 10, 96.00 ),
array( 'Cherry', 13, 14, 9, 105.00 ),
array( 'Apple', 14, 15, 10, 75.00 ),
array( 'Pear', 9, 8, 8, 76.80 ),
array( 'Apple', 8, 9, 6, 45.00 ),
);
$criteria = array(
array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ),
array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ),
array( '="=Pear"', NULL, NULL, NULL, NULL, NULL ),
);
$worksheet->fromArray( $criteria, NULL, 'A1' )
->fromArray( $database, NULL, 'A4' );
$worksheet->setCellValue('A12', '=GET(A4:E10,"Age",A1:F2)');
$retVal = $worksheet->getCell('A12')->getCalculatedValue();
// $retVal = 14
```
##### Notes
There are no additional notes on this function
#### DMAX
The DMAX function returns the largest number in a column of a list or database that matches conditions you specify.
##### Syntax
```
DMAX(database, field, criteria)
```
##### Parameters
**database** The range of cells that makes up the list or database.
A database is a list of related data in which rows of related information are records, and columns of data are fields. The first row of the list contains labels for each column.
**field** Indicates which column of the database is used in the function.
Enter the column label as a string (enclosed between double quotation marks), such as "Age" or "Yield," or as a number (without quotation marks) that represents the position of the column within the list: 1 for the first column, 2 for the second column, and so on.
**criteria** The range of cells that contains the conditions you specify.
You can use any range for the criteria argument, as long as it includes at least one column label and at least one cell below the column label in which you specify a condition for the column.
##### Return Value
**float** The maximum value of the matching cells.
##### Examples
```php
$database = array(
array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ),
array( 'Apple', 18, 20, 14, 105.00 ),
array( 'Pear', 12, 12, 10, 96.00 ),
array( 'Cherry', 13, 14, 9, 105.00 ),
array( 'Apple', 14, 15, 10, 75.00 ),
array( 'Pear', 9, 8, 8, 76.80 ),
array( 'Apple', 8, 9, 6, 45.00 ),
);
$criteria = array(
array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ),
array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ),
array( '="=Pear"', NULL, NULL, NULL, NULL, NULL ),
);
$worksheet->fromArray( $criteria, NULL, 'A1' )
->fromArray( $database, NULL, 'A4' );
$worksheet->setCellValue('A12', '=DMAX(A4:E10,"Profit",A1:B2)');
$retVal = $worksheet->getCell('A12')->getCalculatedValue();
// $retVal = 105
```
##### Notes
There are no additional notes on this function
#### DMIN
The DMIN function returns the smallest number in a column of a list or database that matches conditions you specify.
##### Syntax
```
DMIN(database, field, criteria)
```
##### Parameters
**database** The range of cells that makes up the list or database.
A database is a list of related data in which rows of related information are records, and columns of data are fields. The first row of the list contains labels for each column.
**field** Indicates which column of the database is used in the function.
Enter the column label as a string (enclosed between double quotation marks), such as "Age" or "Yield," or as a number (without quotation marks) that represents the position of the column within the list: 1 for the first column, 2 for the second column, and so on.
**criteria** The range of cells that contains the conditions you specify.
You can use any range for the criteria argument, as long as it includes at least one column label and at least one cell below the column label in which you specify a condition for the column.
##### Return Value
**float** The minimum value of the matching cells.
##### Examples
```php
$database = array(
array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ),
array( 'Apple', 18, 20, 14, 105.00 ),
array( 'Pear', 12, 12, 10, 96.00 ),
array( 'Cherry', 13, 14, 9, 105.00 ),
array( 'Apple', 14, 15, 10, 75.00 ),
array( 'Pear', 9, 8, 8, 76.80 ),
array( 'Apple', 8, 9, 6, 45.00 ),
);
$criteria = array(
array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ),
array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ),
array( '="=Pear"', NULL, NULL, NULL, NULL, NULL ),
);
$worksheet->fromArray( $criteria, NULL, 'A1' )
->fromArray( $database, NULL, 'A4' );
$worksheet->setCellValue('A12', '=DMIN(A4:E10,"Yield",A1:A3)');
$retVal = $worksheet->getCell('A12')->getCalculatedValue();
// $retVal = 6
```
##### Notes
There are no additional notes on this function
#### DPRODUCT
The DPRODUCT function multiplies the values in a column of a list or database that match conditions that you specify.
##### Syntax
```
DPRODUCT(database, field, criteria)
```
##### Parameters
**database** The range of cells that makes up the list or database.
A database is a list of related data in which rows of related information are records, and columns of data are fields. The first row of the list contains labels for each column.
**field** Indicates which column of the database is used in the function.
Enter the column label as a string (enclosed between double quotation marks), such as "Age" or "Yield," or as a number (without quotation marks) that represents the position of the column within the list: 1 for the first column, 2 for the second column, and so on.
**criteria** The range of cells that contains the conditions you specify.
You can use any range for the criteria argument, as long as it includes at least one column label and at least one cell below the column label in which you specify a condition for the column.
##### Return Value
**float** The product of the matching cells.
##### Examples
```php
$database = array(
array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ),
array( 'Apple', 18, 20, 14, 105.00 ),
array( 'Pear', 12, 12, 10, 96.00 ),
array( 'Cherry', 13, 14, 9, 105.00 ),
array( 'Apple', 14, 15, 10, 75.00 ),
array( 'Pear', 9, 8, 8, 76.80 ),
array( 'Apple', 8, 9, 6, 45.00 ),
);
$criteria = array(
array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ),
array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ),
array( '="=Pear"', NULL, NULL, NULL, NULL, NULL ),
);
$worksheet->fromArray( $criteria, NULL, 'A1' )
->fromArray( $database, NULL, 'A4' );
$worksheet->setCellValue('A12', '=DPRODUCT(A4:E10,"Yield",A1:B2)');
$retVal = $worksheet->getCell('A12')->getCalculatedValue();
// $retVal = 140
```
##### Notes
There are no additional notes on this function
#### DSTDEV
The DSTDEV function estimates the standard deviation of a population based on a sample by using the numbers in a column of a list or database that match conditions that you specify.
##### Syntax
```
DSTDEV(database, field, criteria)
```
##### Parameters
**database** The range of cells that makes up the list or database.
A database is a list of related data in which rows of related information are records, and columns of data are fields. The first row of the list contains labels for each column.
**field** Indicates which column of the database is used in the function.
Enter the column label as a string (enclosed between double quotation marks), such as "Age" or "Yield," or as a number (without quotation marks) that represents the position of the column within the list: 1 for the first column, 2 for the second column, and so on.
**criteria** The range of cells that contains the conditions you specify.
You can use any range for the criteria argument, as long as it includes at least one column label and at least one cell below the column label in which you specify a condition for the column.
##### Return Value
**float** The estimated standard deviation of the matching cells.
##### Examples
```php
$database = array(
array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ),
array( 'Apple', 18, 20, 14, 105.00 ),
array( 'Pear', 12, 12, 10, 96.00 ),
array( 'Cherry', 13, 14, 9, 105.00 ),
array( 'Apple', 14, 15, 10, 75.00 ),
array( 'Pear', 9, 8, 8, 76.80 ),
array( 'Apple', 8, 9, 6, 45.00 ),
);
$criteria = array(
array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ),
array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ),
array( '="=Pear"', NULL, NULL, NULL, NULL, NULL ),
);
$worksheet->fromArray( $criteria, NULL, 'A1' )
->fromArray( $database, NULL, 'A4' );
$worksheet->setCellValue('A12', '=DSTDEV(A4:E10,"Yield",A1:A3)');
$retVal = $worksheet->getCell('A12')->getCalculatedValue();
// $retVal = 2.97
```
##### Notes
There are no additional notes on this function
#### DSTDEVP
The DSTDEVP function calculates the standard deviation of a population based on the entire population by using the numbers in a column of a list or database that match conditions that you specify.
##### Syntax
```
DSTDEVP(database, field, criteria)
```
##### Parameters
**database** The range of cells that makes up the list or database.
A database is a list of related data in which rows of related information are records, and columns of data are fields. The first row of the list contains labels for each column.
**field** Indicates which column of the database is used in the function.
Enter the column label as a string (enclosed between double quotation marks), such as "Age" or "Yield," or as a number (without quotation marks) that represents the position of the column within the list: 1 for the first column, 2 for the second column, and so on.
**criteria** The range of cells that contains the conditions you specify.
You can use any range for the criteria argument, as long as it includes at least one column label and at least one cell below the column label in which you specify a condition for the column.
##### Return Value
**float** The estimated standard deviation of the matching cells.
##### Examples
```php
$database = array(
array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ),
array( 'Apple', 18, 20, 14, 105.00 ),
array( 'Pear', 12, 12, 10, 96.00 ),
array( 'Cherry', 13, 14, 9, 105.00 ),
array( 'Apple', 14, 15, 10, 75.00 ),
array( 'Pear', 9, 8, 8, 76.80 ),
array( 'Apple', 8, 9, 6, 45.00 ),
);
$criteria = array(
array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ),
array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ),
array( '="=Pear"', NULL, NULL, NULL, NULL, NULL ),
);
$worksheet->fromArray( $criteria, NULL, 'A1' )
->fromArray( $database, NULL, 'A4' );
$worksheet->setCellValue('A12', '=DSTDEVP(A4:E10,"Yield",A1:A3)');
$retVal = $worksheet->getCell('A12')->getCalculatedValue();
// $retVal = 2.65
```
##### Notes
There are no additional notes on this function
#### DSUM
The DSUM function adds the numbers in a column of a list or database that matches conditions you specify.
##### Syntax
```
DSUM(database, field, criteria)
```
##### Parameters
**database** The range of cells that makes up the list or database.
A database is a list of related data in which rows of related information are records, and columns of data are fields. The first row of the list contains labels for each column.
**field** Indicates which column of the database is used in the function.
Enter the column label as a string (enclosed between double quotation marks), such as "Age" or "Yield," or as a number (without quotation marks) that represents the position of the column within the list: 1 for the first column, 2 for the second column, and so on.
**criteria** The range of cells that contains the conditions you specify.
You can use any range for the criteria argument, as long as it includes at least one column label and at least one cell below the column label in which you specify a condition for the column.
##### Return Value
**float** The total value of the matching cells.
##### Examples
```php
$database = array(
array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ),
array( 'Apple', 18, 20, 14, 105.00 ),
array( 'Pear', 12, 12, 10, 96.00 ),
array( 'Cherry', 13, 14, 9, 105.00 ),
array( 'Apple', 14, 15, 10, 75.00 ),
array( 'Pear', 9, 8, 8, 76.80 ),
array( 'Apple', 8, 9, 6, 45.00 ),
);
$criteria = array(
array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ),
array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ),
array( '="=Pear"', NULL, NULL, NULL, NULL, NULL ),
);
$worksheet->fromArray( $criteria, NULL, 'A1' )
->fromArray( $database, NULL, 'A4' );
$worksheet->setCellValue('A12', '=DMIN(A4:E10,"Profit",A1:A2)');
$retVal = $worksheet->getCell('A12')->getCalculatedValue();
// $retVal = 225
```
##### Notes
There are no additional notes on this function
#### DVAR
Not yet documented.
#### DVARP
Not yet documented.

View File

@@ -0,0 +1,19 @@
# PHPExcel AutoFilter Reference
## AutoFilters
Each worksheet in an Excel Workbook can contain a single autoFilter range. Filtered data displays only the rows that meet criteria that you specify and hides rows that you do not want displayed. You can filter by more than one column: filters are additive, which means that each additional filter is based on the current filter and further reduces the subset of data.
![01-01-autofilter.png](./images/01-01-autofilter.png "")
When an AutoFilter is applied to a range of cells, the first row in an autofilter range will be the heading row, which displays the autoFilter dropdown icons. It is not part of the actual autoFiltered data. All subsequent rows are the autoFiltered data. So an AutoFilter range should always contain the heading row and one or more data rows (one data row is pretty meaningless), but PHPExcel won't actually stop you specifying a meaningless range: it's up to you as the developer to avoid such errors.
To determine if a filter is applied, note the icon in the column heading. A drop-down arrow (![01-03-filter-icon-1.png](./images/01-03-filter-icon-1.png "")) means that filtering is enabled but not applied. In MS Excel, when you hover over the heading of a column with filtering enabled but not applied, a screen tip displays the cell text for the first row in that column, and the message "(Showing All)".
![01-02-autofilter.png](./images/01-02-autofilter.png "")
A Filter button (![01-03-filter-icon-2.png](./images/01-03-filter-icon-2.png "")) means that a filter is applied. When you hover over the heading of a filtered column, a screen tip displays the filter that has been applied to that column, such as "Equals a red cell color" or "Larger than 150".
![01-04-autofilter.png](./images/01-04-autofilter.png "")

View File

@@ -0,0 +1,24 @@
# PHPExcel AutoFilter Reference
## Setting an AutoFilter area on a worksheet
To set an autoFilter on a range of cells.
```php
$objPHPExcel->getActiveSheet()->setAutoFilter('A1:E20');
```
The first row in an autofilter range will be the heading row, which displays the autoFilter dropdown icons. It is not part of the actual autoFiltered data. All subsequent rows are the autoFiltered data. So an AutoFilter range should always contain the heading row and one or more data rows (one data row is pretty meaningless, but PHPExcel won't actually stop you specifying a meaningless range: it's up to you as the developer to avoid such errors.
If you want to set the whole worksheet as an autofilter region
```php
$objPHPExcel->getActiveSheet()->setAutoFilter(
$objPHPExcel->getActiveSheet()
->calculateWorksheetDimension()
);
```
This enables filtering, but does not actually apply any filters.

View File

@@ -0,0 +1,27 @@
# PHPExcel AutoFilter Reference
## Autofilter Expressions
PHPEXcel 1.7.8 introduced the ability to actually create, read and write filter expressions; initially only for Excel2007 files, but later releases will extend this to other formats.
To apply a filter expression to an autoFilter range, you first need to identify which column you're going to be applying this filter to.
```php
$autoFilter = $objPHPExcel->getActiveSheet()->getAutoFilter();
$columnFilter = $autoFilter->getColumn('C');
```
This returns an autoFilter column object, and you can then apply filter expressions to that column.
There are a number of different types of autofilter expressions. The most commonly used are:
- Simple Filters
- DateGroup Filters
- Custom filters
- Dynamic Filters
- Top Ten Filters
These different types are mutually exclusive within any single column. You should not mix the different types of filter in the same column. PHPExcel will not actively prevent you from doing this, but the results are unpredictable.
Other filter expression types (such as cell colour filters) are not yet supported.

View File

@@ -0,0 +1,52 @@
# PHPExcel AutoFilter Reference
## Autofilter Expressions
### Simple filters
In MS Excel, Simple Filters are a dropdown list of all values used in that column, and the user can select which ones they want to display and which ones they want to hide by ticking and unticking the checkboxes alongside each option. When the filter is applied, rows containing the checked entries will be displayed, rows that don't contain those values will be hidden.
![04-01-simple-autofilter.png](./images/04-01-simple-autofilter.png "")
To create a filter expression, we need to start by identifying the filter type. In this case, we're just going to specify that this filter is a standard filter.
```php
$columnFilter->setFilterType(
PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_FILTER
);
```
Now we've identified the filter type, we can create a filter rule and set the filter values:
When creating a simple filter in PHPExcel, you only need to specify the values for "checked" columns: you do this by creating a filter rule for each value.
```php
$columnFilter->createRule()
->setRule(
PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
'France'
);
$columnFilter->createRule()
->setRule(
PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
'Germany'
);
```
This creates two filter rules: the column will be filtered by values that match “France” OR “Germany”. For Simple Filters, you can create as many rules as you want
Simple filters are always a comparison match of EQUALS, and multiple standard filters are always treated as being joined by an OR condition.
#### Matching Blanks
If you want to create a filter to select blank cells, you would use:
```php
$columnFilter->createRule()
->setRule(
PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
''
);
```

View File

@@ -0,0 +1,48 @@
# PHPExcel AutoFilter Reference
## Autofilter Expressions
### DateGroup Filters
In MS Excel, DateGroup filters provide a series of dropdown filter selectors for date values, so you can specify entire years, or months within a year, or individual days within each month.
![04-02-dategroup-autofilter.png](./images/04-02-dategroup-autofilter.png "")
DateGroup filters are still applied as a Standard Filter type.
```php
$columnFilter->setFilterType(
PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_FILTER
);
```
Creating a dateGroup filter in PHPExcel, you specify the values for "checked" columns as an associative array of year. month, day, hour minute and second. To select a year and month, you need to create a DateGroup rule identifying the selected year and month:
```php
$columnFilter->createRule()
->setRule(
PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
array(
'year' => 2012,
'month' => 1
)
)
->setRuleType(
PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP
);
```
The key values for the associative array are:
- year
- month
- day
- hour
- minute
- second
Like Standard filters, DateGroup filters are always a match of EQUALS, and multiple standard filters are always treated as being joined by an OR condition.
Note that we alse specify a ruleType: to differentiate this from a standard filter, we explicitly set the Rule's Type to AUTOFILTER_RULETYPE_DATEGROUP. As with standard filters, we can create any number of DateGroup Filters.

View File

@@ -0,0 +1,84 @@
# PHPExcel AutoFilter Reference
## Autofilter Expressions
### Custom filters
In MS Excel, Custom filters allow us to select more complex conditions using an operator as well as a value. Typical examples might be values that fall within a range (e.g. between -20 and +20), or text values with wildcards (e.g. beginning with the letter U). To handle this, they
![04-03-custom-autofilter-1.png](./images/04-03-custom-autofilter-1.png "")
![04-03-custom-autofilter-2.png](./images/04-03-custom-autofilter-2.png "")
Custom filters are limited to 2 rules, and these can be joined using either an AND or an OR.
We start by specifying a Filter type, this time a CUSTOMFILTER.
```php
$columnFilter->setFilterType(
PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_CUSTOMFILTER
);
```
And then define our rules.
The following shows a simple wildcard filter to show all column entries beginning with the letter 'U'.
```php
$columnFilter->createRule()
->setRule(
PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
'U*'
)
->setRuleType(
PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER
);
```
MS Excel uses \* as a wildcard to match any number of characters, and ? as a wildcard to match a single character. 'U\*' equates to "begins with a 'U'"; '\*U' equates to "ends with a 'U'"; and '\*U\*' equates to "contains a 'U'"
If you want to match explicitly against a \* or a ? character, you can escape it with a tilde (~), so ?~\*\* would explicitly match for a \* character as the second character in the cell value, followed by any number of other characters. The only other character that needs escaping is the ~ itself.
To create a "between" condition, we need to define two rules:
```php
$columnFilter->createRule()
->setRule(
PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_GREATERTHANOREQUAL,
-20
)
->setRuleType(
PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER
);
$columnFilter->createRule()
->setRule(
PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_LESSTHANOREQUAL,
20
)
->setRuleType(
PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER
);
```
We also set the rule type to CUSTOMFILTER.
This defined two rules, filtering numbers that are >= -20 OR <= 20, so we also need to modify the join condition to reflect AND rather than OR.
```php
$columnFilter->setAndOr(
PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_ANDOR_AND
);
```
The valid set of operators for Custom Filters are defined in the PHPExcel_Worksheet_AutoFilter_Column_Rule class, and comprise:
Operator Constant | Value |
------------------------------------------|----------------------|
AUTOFILTER_COLUMN_RULE_EQUAL | 'equal' |
AUTOFILTER_COLUMN_RULE_NOTEQUAL | 'notEqual' |
AUTOFILTER_COLUMN_RULE_GREATERTHAN | 'greaterThan' |
AUTOFILTER_COLUMN_RULE_GREATERTHANOREQUAL | 'greaterThanOrEqual' |
AUTOFILTER_COLUMN_RULE_LESSTHAN | 'lessThan' |
AUTOFILTER_COLUMN_RULE_LESSTHANOREQUAL | 'lessThanOrEqual' |

View File

@@ -0,0 +1,88 @@
# PHPExcel AutoFilter Reference
## Autofilter Expressions
### Dynamic Filters
Dynamic Filters are based on a dynamic comparison condition, where the value we're comparing against the cell values is variable, such as 'today'; or when we're testing against an aggregate of the cell data (e.g. 'aboveAverage'). Only a single dynamic filter can be applied to a column at a time.
![04-04-dynamic-autofilter.png](./images/04-04-dynamic-autofilter.png "")
Again, we start by specifying a Filter type, this time a DYNAMICFILTER.
```php
$columnFilter->setFilterType(
PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_DYNAMICFILTER
);
```
When defining the rule for a dynamic filter, we don't define a value (we can simply set that to NULL) but we do specify the dynamic filter category.
```php
$columnFilter->createRule()
->setRule(
PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
NULL,
PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_YEARTODATE
)
->setRuleType(
PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMICFILTER
);
```
We also set the rule type to DYNAMICFILTER.
The valid set of dynamic filter categories is defined in the PHPExcel_Worksheet_AutoFilter_Column_Rule class, and comprises:
Operator Constant | Value |
-----------------------------------------|----------------|
AUTOFILTER_RULETYPE_DYNAMIC_YESTERDAY | 'yesterday' |
AUTOFILTER_RULETYPE_DYNAMIC_TODAY | 'today' |
AUTOFILTER_RULETYPE_DYNAMIC_TOMORROW | 'tomorrow' |
AUTOFILTER_RULETYPE_DYNAMIC_YEARTODATE | 'yearToDate' |
AUTOFILTER_RULETYPE_DYNAMIC_THISYEAR | 'thisYear' |
AUTOFILTER_RULETYPE_DYNAMIC_THISQUARTER | 'thisQuarter' |
AUTOFILTER_RULETYPE_DYNAMIC_THISMONTH | 'thisMonth' |
AUTOFILTER_RULETYPE_DYNAMIC_THISWEEK | 'thisWeek' |
AUTOFILTER_RULETYPE_DYNAMIC_LASTYEAR | 'lastYear' |
AUTOFILTER_RULETYPE_DYNAMIC_LASTQUARTER | 'lastQuarter' |
AUTOFILTER_RULETYPE_DYNAMIC_LASTMONTH | 'lastMonth' |
AUTOFILTER_RULETYPE_DYNAMIC_LASTWEEK | 'lastWeek' |
AUTOFILTER_RULETYPE_DYNAMIC_NEXTYEAR | 'nextYear' |
AUTOFILTER_RULETYPE_DYNAMIC_NEXTQUARTER | 'nextQuarter' |
AUTOFILTER_RULETYPE_DYNAMIC_NEXTMONTH | 'nextMonth' |
AUTOFILTER_RULETYPE_DYNAMIC_NEXTWEEK | 'nextWeek' |
AUTOFILTER_RULETYPE_DYNAMIC_MONTH_1 | 'M1' |
AUTOFILTER_RULETYPE_DYNAMIC_JANUARY | 'M1' |
AUTOFILTER_RULETYPE_DYNAMIC_MONTH_2 | 'M2' |
AUTOFILTER_RULETYPE_DYNAMIC_FEBRUARY | 'M2' |
AUTOFILTER_RULETYPE_DYNAMIC_MONTH_3 | 'M3' |
AUTOFILTER_RULETYPE_DYNAMIC_MARCH | 'M3' |
AUTOFILTER_RULETYPE_DYNAMIC_MONTH_4 | 'M4' |
AUTOFILTER_RULETYPE_DYNAMIC_APRIL | 'M4' |
AUTOFILTER_RULETYPE_DYNAMIC_MONTH_5 | 'M5' |
AUTOFILTER_RULETYPE_DYNAMIC_MAY | 'M5' |
AUTOFILTER_RULETYPE_DYNAMIC_MONTH_6 | 'M6' |
AUTOFILTER_RULETYPE_DYNAMIC_JUNE | 'M6' |
AUTOFILTER_RULETYPE_DYNAMIC_MONTH_7 | 'M7' |
AUTOFILTER_RULETYPE_DYNAMIC_JULY | 'M7' |
AUTOFILTER_RULETYPE_DYNAMIC_MONTH_8 | 'M8' |
AUTOFILTER_RULETYPE_DYNAMIC_AUGUST | 'M8' |
AUTOFILTER_RULETYPE_DYNAMIC_MONTH_9 | 'M9' |
AUTOFILTER_RULETYPE_DYNAMIC_SEPTEMBER | 'M9' |
AUTOFILTER_RULETYPE_DYNAMIC_MONTH_10 | 'M10' |
AUTOFILTER_RULETYPE_DYNAMIC_OCTOBER | 'M10' |
AUTOFILTER_RULETYPE_DYNAMIC_MONTH_11 | 'M11' |
AUTOFILTER_RULETYPE_DYNAMIC_NOVEMBER | 'M11' |
AUTOFILTER_RULETYPE_DYNAMIC_MONTH_12 | 'M12' |
AUTOFILTER_RULETYPE_DYNAMIC_DECEMBER | 'M12' |
AUTOFILTER_RULETYPE_DYNAMIC_QUARTER_1 | 'Q1' |
AUTOFILTER_RULETYPE_DYNAMIC_QUARTER_2 | 'Q2' |
AUTOFILTER_RULETYPE_DYNAMIC_QUARTER_3 | 'Q3' |
AUTOFILTER_RULETYPE_DYNAMIC_QUARTER_4 | 'Q4' |
AUTOFILTER_RULETYPE_DYNAMIC_ABOVEAVERAGE | 'aboveAverage' |
AUTOFILTER_RULETYPE_DYNAMIC_BELOWAVERAGE | 'belowAverage' |
We can only apply a single Dynamic Filter rule to a column at a time.

View File

@@ -0,0 +1,69 @@
# PHPExcel AutoFilter Reference
## Autofilter Expressions
### Top Ten Filters
Top Ten Filters are similar to Dynamic Filters in that they are based on a summarisation of the actual data values in the cells. However, unlike Dynamic Filters where you can only select a single option, Top Ten Filters allow you to select based on a number of criteria:
![04-05-custom-topten-1.png](./images/04-05-topten-autofilter-1.png "")
![04-05-custom-topten-2.png](./images/04-05-topten-autofilter-2.png "")
You can identify whether you want the top (highest) or bottom (lowest) values.You can identify how many values you wish to select in the filterYou can identify whether this should be a percentage or a number of items.
Like Dynamic Filters, only a single Top Ten filter can be applied to a column at a time.
We start by specifying a Filter type, this time a DYNAMICFILTER.
```php
$columnFilter->setFilterType(
PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_TOPTENFILTER
);
```
Then we create the rule:
```php
$columnFilter->createRule()
->setRule(
PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_PERCENT,
5,
PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_TOP
)
->setRuleType(
PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_TOPTENFILTER
);
```
This will filter the Top 5 percent of values in the column.
To specify the lowest (bottom 2 values), we would specify a rule of:
```php
$columnFilter->createRule()
->setRule(
PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_BY_VALUE,
5,
PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_BOTTOM
)
->setRuleType(
PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_TOPTENFILTER
);
```
The option values for TopTen Filters top/bottom value/percent are all defined in the PHPExcel_Worksheet_AutoFilter_Column_Rule class, and comprise:
Operator Constant | Value |
---------------------------------------|-------------|
AUTOFILTER_COLUMN_RULE_TOPTEN_BY_VALUE | 'byValue' |
AUTOFILTER_COLUMN_RULE_TOPTEN_PERCENT | 'byPercent' |
and
Operator Constant | Value |
-------------------------------------|----------|
AUTOFILTER_COLUMN_RULE_TOPTEN_TOP | 'top' |
AUTOFILTER_COLUMN_RULE_TOPTEN_BOTTOM | 'bottom' |

View File

@@ -0,0 +1,42 @@
# PHPExcel AutoFilter Reference
## Executing an AutoFilter
When an autofilter is applied in MS Excel, it sets the row hidden/visible flags for each row of the autofilter area based on the selected criteria, so that only those rows that match the filter criteria are displayed.
PHPExcel will not execute the equivalent function automatically when you set or change a filter expression, but only when the file is saved.
### Applying the Filter
If you wish to execute your filter from within a script, you need to do this manually. You can do this using the autofilters showHideRows() method.
```php
$autoFilter = $objPHPExcel->getActiveSheet()->getAutoFilter();
$autoFilter->showHideRows();
```
This will set all rows that match the filter criteria to visible, while hiding all other rows within the autofilter area.
### Displaying Filtered Rows
Simply looping through the rows in an autofilter area will still access ever row, whether it matches the filter criteria or not. To selectively access only the filtered rows, you need to test each rows visibility settings.
```php
foreach ($objPHPExcel->getActiveSheet()->getRowIterator() as $row) {
if ($objPHPExcel->getActiveSheet()
->getRowDimension($row->getRowIndex())->getVisible()) {
echo ' Row number - ' , $row->getRowIndex() , ' ';
echo $objPHPExcel->getActiveSheet()
->getCell(
'C'.$row->getRowIndex()
)
->getValue(), ' ';
echo $objPHPExcel->getActiveSheet()
->getCell(
'D'.$row->getRowIndex()
)->getFormattedValue(), ' ';
echo EOL;
}
}
```

View File

@@ -0,0 +1,7 @@
# PHPExcel AutoFilter Reference
## AutoFilter Sorting
In MS Excel, Autofiltering also allows the rows to be sorted. This feature is ***not*** supported by PHPExcel.

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 453 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 640 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 109 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

View File

@@ -0,0 +1,411 @@
## CATEGORY_CUBE
Excel Function | PHPExcel Function
--------------------|-------------------------------------------
CUBEKPIMEMBER | **\*\*\* Not yet Implemented**
CUBEMEMBER | **\*\*\* Not yet Implemented**
CUBEMEMBERPROPERTY | **\*\*\* Not yet Implemented**
CUBERANKEDMEMBER | **\*\*\* Not yet Implemented**
CUBESET | **\*\*\* Not yet Implemented**
CUBESETCOUNT | **\*\*\* Not yet Implemented**
CUBEVALUE | **\*\*\* Not yet Implemented**
## CATEGORY_DATABASE
Excel Function | PHPExcel Function
--------------------|-------------------------------------------
DAVERAGE | PHPExcel_Calculation_Database::DAVERAGE
DCOUNT | PHPExcel_Calculation_Database::DCOUNT
DCOUNTA | PHPExcel_Calculation_Database::DCOUNTA
DGET | PHPExcel_Calculation_Database::DGET
DMAX | PHPExcel_Calculation_Database::DMAX
DMIN | PHPExcel_Calculation_Database::DMIN
DPRODUCT | PHPExcel_Calculation_Database::DPRODUCT
DSTDEV | PHPExcel_Calculation_Database::DSTDEV
DSTDEVP | PHPExcel_Calculation_Database::DSTDEVP
DSUM | PHPExcel_Calculation_Database::DSUM
DVAR | PHPExcel_Calculation_Database::DVAR
DVARP | PHPExcel_Calculation_Database::DVARP
## CATEGORY_DATE_AND_TIME
Excel Function | PHPExcel Function
--------------------|-------------------------------------------
DATE | PHPExcel_Calculation_DateTime::DATE
DATEDIF | PHPExcel_Calculation_DateTime::DATEDIF
DATEVALUE | PHPExcel_Calculation_DateTime::DATEVALUE
DAY | PHPExcel_Calculation_DateTime::DAYOFMONTH
DAYS360 | PHPExcel_Calculation_DateTime::DAYS360
EDATE | PHPExcel_Calculation_DateTime::EDATE
EOMONTH | PHPExcel_Calculation_DateTime::EOMONTH
HOUR | PHPExcel_Calculation_DateTime::HOUROFDAY
MINUTE | PHPExcel_Calculation_DateTime::MINUTEOFHOUR
MONTH | PHPExcel_Calculation_DateTime::MONTHOFYEAR
NETWORKDAYS | PHPExcel_Calculation_DateTime::NETWORKDAYS
NOW | PHPExcel_Calculation_DateTime::DATETIMENOW
SECOND | PHPExcel_Calculation_DateTime::SECONDOFMINUTE
TIME | PHPExcel_Calculation_DateTime::TIME
TIMEVALUE | PHPExcel_Calculation_DateTime::TIMEVALUE
TODAY | PHPExcel_Calculation_DateTime::DATENOW
WEEKDAY | PHPExcel_Calculation_DateTime::DAYOFWEEK
WEEKNUM | PHPExcel_Calculation_DateTime::WEEKOFYEAR
WORKDAY | PHPExcel_Calculation_DateTime::WORKDAY
YEAR | PHPExcel_Calculation_DateTime::YEAR
YEARFRAC | PHPExcel_Calculation_DateTime::YEARFRAC
## CATEGORY_ENGINEERING
Excel Function | PHPExcel Function
--------------------|-------------------------------------------
BESSELI | PHPExcel_Calculation_Engineering::BESSELI
BESSELJ | PHPExcel_Calculation_Engineering::BESSELJ
BESSELK | PHPExcel_Calculation_Engineering::BESSELK
BESSELY | PHPExcel_Calculation_Engineering::BESSELY
BIN2DEC | PHPExcel_Calculation_Engineering::BINTODEC
BIN2HEX | PHPExcel_Calculation_Engineering::BINTOHEX
BIN2OCT | PHPExcel_Calculation_Engineering::BINTOOCT
COMPLEX | PHPExcel_Calculation_Engineering::COMPLEX
CONVERT | PHPExcel_Calculation_Engineering::CONVERTUOM
DEC2BIN | PHPExcel_Calculation_Engineering::DECTOBIN
DEC2HEX | PHPExcel_Calculation_Engineering::DECTOHEX
DEC2OCT | PHPExcel_Calculation_Engineering::DECTOOCT
DELTA | PHPExcel_Calculation_Engineering::DELTA
ERF | PHPExcel_Calculation_Engineering::ERF
ERFC | PHPExcel_Calculation_Engineering::ERFC
GESTEP | PHPExcel_Calculation_Engineering::GESTEP
HEX2BIN | PHPExcel_Calculation_Engineering::HEXTOBIN
HEX2DEC | PHPExcel_Calculation_Engineering::HEXTODEC
HEX2OCT | PHPExcel_Calculation_Engineering::HEXTOOCT
IMABS | PHPExcel_Calculation_Engineering::IMABS
IMAGINARY | PHPExcel_Calculation_Engineering::IMAGINARY
IMARGUMENT | PHPExcel_Calculation_Engineering::IMARGUMENT
IMCONJUGATE | PHPExcel_Calculation_Engineering::IMCONJUGATE
IMCOS | PHPExcel_Calculation_Engineering::IMCOS
IMDIV | PHPExcel_Calculation_Engineering::IMDIV
IMEXP | PHPExcel_Calculation_Engineering::IMEXP
IMLN | PHPExcel_Calculation_Engineering::IMLN
IMLOG10 | PHPExcel_Calculation_Engineering::IMLOG10
IMLOG2 | PHPExcel_Calculation_Engineering::IMLOG2
IMPOWER | PHPExcel_Calculation_Engineering::IMPOWER
IMPRODUCT | PHPExcel_Calculation_Engineering::IMPRODUCT
IMREAL | PHPExcel_Calculation_Engineering::IMREAL
IMSIN | PHPExcel_Calculation_Engineering::IMSIN
IMSQRT | PHPExcel_Calculation_Engineering::IMSQRT
IMSUB | PHPExcel_Calculation_Engineering::IMSUB
IMSUM | PHPExcel_Calculation_Engineering::IMSUM
OCT2BIN | PHPExcel_Calculation_Engineering::OCTTOBIN
OCT2DEC | PHPExcel_Calculation_Engineering::OCTTODEC
OCT2HEX | PHPExcel_Calculation_Engineering::OCTTOHEX
## CATEGORY_FINANCIAL
Excel Function | PHPExcel Function
--------------------|-------------------------------------------
ACCRINT | PHPExcel_Calculation_Financial::ACCRINT
ACCRINTM | PHPExcel_Calculation_Financial::ACCRINTM
AMORDEGRC | PHPExcel_Calculation_Financial::AMORDEGRC
AMORLINC | PHPExcel_Calculation_Financial::AMORLINC
COUPDAYBS | PHPExcel_Calculation_Financial::COUPDAYBS
COUPDAYS | PHPExcel_Calculation_Financial::COUPDAYS
COUPDAYSNC | PHPExcel_Calculation_Financial::COUPDAYSNC
COUPNCD | PHPExcel_Calculation_Financial::COUPNCD
COUPNUM | PHPExcel_Calculation_Financial::COUPNUM
COUPPCD | PHPExcel_Calculation_Financial::COUPPCD
CUMIPMT | PHPExcel_Calculation_Financial::CUMIPMT
CUMPRINC | PHPExcel_Calculation_Financial::CUMPRINC
DB | PHPExcel_Calculation_Financial::DB
DDB | PHPExcel_Calculation_Financial::DDB
DISC | PHPExcel_Calculation_Financial::DISC
DOLLARDE | PHPExcel_Calculation_Financial::DOLLARDE
DOLLARFR | PHPExcel_Calculation_Financial::DOLLARFR
DURATION | **\*\*\* Not yet Implemented**
EFFECT | PHPExcel_Calculation_Financial::EFFECT
FV | PHPExcel_Calculation_Financial::FV
FVSCHEDULE | PHPExcel_Calculation_Financial::FVSCHEDULE
INTRATE | PHPExcel_Calculation_Financial::INTRATE
IPMT | PHPExcel_Calculation_Financial::IPMT
IRR | PHPExcel_Calculation_Financial::IRR
ISPMT | PHPExcel_Calculation_Financial::ISPMT
MDURATION | **\*\*\* Not yet Implemented**
MIRR | PHPExcel_Calculation_Financial::MIRR
NOMINAL | PHPExcel_Calculation_Financial::NOMINAL
NPER | PHPExcel_Calculation_Financial::NPER
NPV | PHPExcel_Calculation_Financial::NPV
ODDFPRICE | **\*\*\* Not yet Implemented**
ODDFYIELD | **\*\*\* Not yet Implemented**
ODDLPRICE | **\*\*\* Not yet Implemented**
ODDLYIELD | **\*\*\* Not yet Implemented**
PMT | PHPExcel_Calculation_Financial::PMT
PPMT | PHPExcel_Calculation_Financial::PPMT
PRICE | PHPExcel_Calculation_Financial::PRICE
PRICEDISC | PHPExcel_Calculation_Financial::PRICEDISC
PRICEMAT | PHPExcel_Calculation_Financial::PRICEMAT
PV | PHPExcel_Calculation_Financial::PV
RATE | PHPExcel_Calculation_Financial::RATE
RECEIVED | PHPExcel_Calculation_Financial::RECEIVED
SLN | PHPExcel_Calculation_Financial::SLN
SYD | PHPExcel_Calculation_Financial::SYD
TBILLEQ | PHPExcel_Calculation_Financial::TBILLEQ
TBILLPRICE | PHPExcel_Calculation_Financial::TBILLPRICE
TBILLYIELD | PHPExcel_Calculation_Financial::TBILLYIELD
USDOLLAR | **\*\*\* Not yet Implemented**
VDB | **\*\*\* Not yet Implemented**
XIRR | PHPExcel_Calculation_Financial::XIRR
XNPV | PHPExcel_Calculation_Financial::XNPV
YIELD | **\*\*\* Not yet Implemented**
YIELDDISC | PHPExcel_Calculation_Financial::YIELDDISC
YIELDMAT | PHPExcel_Calculation_Financial::YIELDMAT
## CATEGORY_INFORMATION
Excel Function | PHPExcel Function
--------------------|-------------------------------------------
CELL | **\*\*\* Not yet Implemented**
ERROR.TYPE | PHPExcel_Calculation_Functions::ERROR_TYPE
INFO | **\*\*\* Not yet Implemented**
ISBLANK | PHPExcel_Calculation_Functions::IS_BLANK
ISERR | PHPExcel_Calculation_Functions::IS_ERR
ISERROR | PHPExcel_Calculation_Functions::IS_ERROR
ISEVEN | PHPExcel_Calculation_Functions::IS_EVEN
ISLOGICAL | PHPExcel_Calculation_Functions::IS_LOGICAL
ISNA | PHPExcel_Calculation_Functions::IS_NA
ISNONTEXT | PHPExcel_Calculation_Functions::IS_NONTEXT
ISNUMBER | PHPExcel_Calculation_Functions::IS_NUMBER
ISODD | PHPExcel_Calculation_Functions::IS_ODD
ISREF | **\*\*\* Not yet Implemented**
ISTEXT | PHPExcel_Calculation_Functions::IS_TEXT
N | PHPExcel_Calculation_Functions::N
NA | PHPExcel_Calculation_Functions::NA
TYPE | PHPExcel_Calculation_Functions::TYPE
VERSION | PHPExcel_Calculation_Functions::VERSION
## CATEGORY_LOGICAL
Excel Function | PHPExcel Function
--------------------|-------------------------------------------
AND | PHPExcel_Calculation_Logical::LOGICAL_AND
FALSE | PHPExcel_Calculation_Logical::FALSE
IF | PHPExcel_Calculation_Logical::STATEMENT_IF
IFERROR | PHPExcel_Calculation_Logical::IFERROR
NOT | PHPExcel_Calculation_Logical::NOT
OR | PHPExcel_Calculation_Logical::LOGICAL_OR
TRUE | PHPExcel_Calculation_Logical::TRUE
## CATEGORY_LOOKUP_AND_REFERENCE
Excel Function | PHPExcel Function
--------------------|-------------------------------------------
ADDRESS | PHPExcel_Calculation_LookupRef::CELL_ADDRESS
AREAS | **\*\*\* Not yet Implemented**
CHOOSE | PHPExcel_Calculation_LookupRef::CHOOSE
COLUMN | PHPExcel_Calculation_LookupRef::COLUMN
COLUMNS | PHPExcel_Calculation_LookupRef::COLUMNS
GETPIVOTDATA | **\*\*\* Not yet Implemented**
HLOOKUP | **\*\*\* Not yet Implemented**
HYPERLINK | PHPExcel_Calculation_LookupRef::HYPERLINK
INDEX | PHPExcel_Calculation_LookupRef::INDEX
INDIRECT | PHPExcel_Calculation_LookupRef::INDIRECT
LOOKUP | PHPExcel_Calculation_LookupRef::LOOKUP
MATCH | PHPExcel_Calculation_LookupRef::MATCH
OFFSET | PHPExcel_Calculation_LookupRef::OFFSET
ROW | PHPExcel_Calculation_LookupRef::ROW
ROWS | PHPExcel_Calculation_LookupRef::ROWS
RTD | **\*\*\* Not yet Implemented**
TRANSPOSE | PHPExcel_Calculation_LookupRef::TRANSPOSE
VLOOKUP | PHPExcel_Calculation_LookupRef::VLOOKUP
## CATEGORY_MATH_AND_TRIG
Excel Function | PHPExcel Function
--------------------|-------------------------------------------
ABS | abs
ACOS | acos
ACOSH | acosh
ASIN | asin
ASINH | asinh
ATAN | atan
ATAN2 | PHPExcel_Calculation_MathTrig::REVERSE_ATAN2
ATANH | atanh
CEILING | PHPExcel_Calculation_MathTrig::CEILING
COMBIN | PHPExcel_Calculation_MathTrig::COMBIN
COS | cos
COSH | cosh
DEGREES | rad2deg
EVEN | PHPExcel_Calculation_MathTrig::EVEN
EXP | exp
FACT | PHPExcel_Calculation_MathTrig::FACT
FACTDOUBLE | PHPExcel_Calculation_MathTrig::FACTDOUBLE
FLOOR | PHPExcel_Calculation_MathTrig::FLOOR
GCD | PHPExcel_Calculation_MathTrig::GCD
INT | PHPExcel_Calculation_MathTrig::INT
LCM | PHPExcel_Calculation_MathTrig::LCM
LN | log
LOG | PHPExcel_Calculation_MathTrig::LOG_BASE
LOG10 | log10
MDETERM | PHPExcel_Calculation_MathTrig::MDETERM
MINVERSE | PHPExcel_Calculation_MathTrig::MINVERSE
MMULT | PHPExcel_Calculation_MathTrig::MMULT
MOD | PHPExcel_Calculation_MathTrig::MOD
MROUND | PHPExcel_Calculation_MathTrig::MROUND
MULTINOMIAL | PHPExcel_Calculation_MathTrig::MULTINOMIAL
ODD | PHPExcel_Calculation_MathTrig::ODD
PI | pi
POWER | PHPExcel_Calculation_MathTrig::POWER
PRODUCT | PHPExcel_Calculation_MathTrig::PRODUCT
QUOTIENT | PHPExcel_Calculation_MathTrig::QUOTIENT
RADIANS | deg2rad
RAND | PHPExcel_Calculation_MathTrig::RAND
RANDBETWEEN | PHPExcel_Calculation_MathTrig::RAND
ROMAN | PHPExcel_Calculation_MathTrig::ROMAN
ROUND | round
ROUNDDOWN | PHPExcel_Calculation_MathTrig::ROUNDDOWN
ROUNDUP | PHPExcel_Calculation_MathTrig::ROUNDUP
SERIESSUM | PHPExcel_Calculation_MathTrig::SERIESSUM
SIGN | PHPExcel_Calculation_MathTrig::SIGN
SIN | sin
SINH | sinh
SQRT | sqrt
SQRTPI | PHPExcel_Calculation_MathTrig::SQRTPI
SUBTOTAL | PHPExcel_Calculation_MathTrig::SUBTOTAL
SUM | PHPExcel_Calculation_MathTrig::SUM
SUMIF | PHPExcel_Calculation_MathTrig::SUMIF
SUMIFS | **\*\*\* Not yet Implemented**
SUMPRODUCT | PHPExcel_Calculation_MathTrig::SUMPRODUCT
SUMSQ | PHPExcel_Calculation_MathTrig::SUMSQ
SUMX2MY2 | PHPExcel_Calculation_MathTrig::SUMX2MY2
SUMX2PY2 | PHPExcel_Calculation_MathTrig::SUMX2PY2
SUMXMY2 | PHPExcel_Calculation_MathTrig::SUMXMY2
TAN | tan
TANH | tanh
TRUNC | PHPExcel_Calculation_MathTrig::TRUNC
## CATEGORY_STATISTICAL
Excel Function | PHPExcel Function
--------------------|-------------------------------------------
AVEDEV | PHPExcel_Calculation_Statistical::AVEDEV
AVERAGE | PHPExcel_Calculation_Statistical::AVERAGE
AVERAGEA | PHPExcel_Calculation_Statistical::AVERAGEA
AVERAGEIF | PHPExcel_Calculation_Statistical::AVERAGEIF
AVERAGEIFS | **\*\*\* Not yet Implemented**
BETADIST | PHPExcel_Calculation_Statistical::BETADIST
BETAINV | PHPExcel_Calculation_Statistical::BETAINV
BINOMDIST | PHPExcel_Calculation_Statistical::BINOMDIST
CHIDIST | PHPExcel_Calculation_Statistical::CHIDIST
CHIINV | PHPExcel_Calculation_Statistical::CHIINV
CHITEST | **\*\*\* Not yet Implemented**
CONFIDENCE | PHPExcel_Calculation_Statistical::CONFIDENCE
CORREL | PHPExcel_Calculation_Statistical::CORREL
COUNT | PHPExcel_Calculation_Statistical::COUNT
COUNTA | PHPExcel_Calculation_Statistical::COUNTA
COUNTBLANK | PHPExcel_Calculation_Statistical::COUNTBLANK
COUNTIF | PHPExcel_Calculation_Statistical::COUNTIF
COUNTIFS | **\*\*\* Not yet Implemented**
COVAR | PHPExcel_Calculation_Statistical::COVAR
CRITBINOM | PHPExcel_Calculation_Statistical::CRITBINOM
DEVSQ | PHPExcel_Calculation_Statistical::DEVSQ
EXPONDIST | PHPExcel_Calculation_Statistical::EXPONDIST
FDIST | **\*\*\* Not yet Implemented**
FINV | **\*\*\* Not yet Implemented**
FISHER | PHPExcel_Calculation_Statistical::FISHER
FISHERINV | PHPExcel_Calculation_Statistical::FISHERINV
FORECAST | PHPExcel_Calculation_Statistical::FORECAST
FREQUENCY | **\*\*\* Not yet Implemented**
FTEST | **\*\*\* Not yet Implemented**
GAMMADIST | PHPExcel_Calculation_Statistical::GAMMADIST
GAMMAINV | PHPExcel_Calculation_Statistical::GAMMAINV
GAMMALN | PHPExcel_Calculation_Statistical::GAMMALN
GEOMEAN | PHPExcel_Calculation_Statistical::GEOMEAN
GROWTH | PHPExcel_Calculation_Statistical::GROWTH
HARMEAN | PHPExcel_Calculation_Statistical::HARMEAN
HYPGEOMDIST | PHPExcel_Calculation_Statistical::HYPGEOMDIST
INTERCEPT | PHPExcel_Calculation_Statistical::INTERCEPT
KURT | PHPExcel_Calculation_Statistical::KURT
LARGE | PHPExcel_Calculation_Statistical::LARGE
LINEST | PHPExcel_Calculation_Statistical::LINEST
LOGEST | PHPExcel_Calculation_Statistical::LOGEST
LOGINV | PHPExcel_Calculation_Statistical::LOGINV
LOGNORMDIST | PHPExcel_Calculation_Statistical::LOGNORMDIST
MAX | PHPExcel_Calculation_Statistical::MAX
MAXA | PHPExcel_Calculation_Statistical::MAXA
MAXIF | PHPExcel_Calculation_Statistical::MAXIF
MEDIAN | PHPExcel_Calculation_Statistical::MEDIAN
MEDIANIF | **\*\*\* Not yet Implemented**
MIN | PHPExcel_Calculation_Statistical::MIN
MINA | PHPExcel_Calculation_Statistical::MINA
MINIF | PHPExcel_Calculation_Statistical::MINIF
MODE | PHPExcel_Calculation_Statistical::MODE
NEGBINOMDIST | PHPExcel_Calculation_Statistical::NEGBINOMDIST
NORMDIST | PHPExcel_Calculation_Statistical::NORMDIST
NORMINV | PHPExcel_Calculation_Statistical::NORMINV
NORMSDIST | PHPExcel_Calculation_Statistical::NORMSDIST
NORMSINV | PHPExcel_Calculation_Statistical::NORMSINV
PEARSON | PHPExcel_Calculation_Statistical::CORREL
PERCENTILE | PHPExcel_Calculation_Statistical::PERCENTILE
PERCENTRANK | PHPExcel_Calculation_Statistical::PERCENTRANK
PERMUT | PHPExcel_Calculation_Statistical::PERMUT
POISSON | PHPExcel_Calculation_Statistical::POISSON
PROB | **\*\*\* Not yet Implemented**
QUARTILE | PHPExcel_Calculation_Statistical::QUARTILE
RANK | PHPExcel_Calculation_Statistical::RANK
RSQ | PHPExcel_Calculation_Statistical::RSQ
SKEW | PHPExcel_Calculation_Statistical::SKEW
SLOPE | PHPExcel_Calculation_Statistical::SLOPE
SMALL | PHPExcel_Calculation_Statistical::SMALL
STANDARDIZE | PHPExcel_Calculation_Statistical::STANDARDIZE
STDEV | PHPExcel_Calculation_Statistical::STDEV
STDEVA | PHPExcel_Calculation_Statistical::STDEVA
STDEVP | PHPExcel_Calculation_Statistical::STDEVP
STDEVPA | PHPExcel_Calculation_Statistical::STDEVPA
STEYX | PHPExcel_Calculation_Statistical::STEYX
TDIST | PHPExcel_Calculation_Statistical::TDIST
TINV | PHPExcel_Calculation_Statistical::TINV
TREND | PHPExcel_Calculation_Statistical::TREND
TRIMMEAN | PHPExcel_Calculation_Statistical::TRIMMEAN
TTEST | **\*\*\* Not yet Implemented**
VAR | PHPExcel_Calculation_Statistical::VARFunc
VARA | PHPExcel_Calculation_Statistical::VARA
VARP | PHPExcel_Calculation_Statistical::VARP
VARPA | PHPExcel_Calculation_Statistical::VARPA
WEIBULL | PHPExcel_Calculation_Statistical::WEIBULL
ZTEST | PHPExcel_Calculation_Statistical::ZTEST
## CATEGORY_TEXT_AND_DATA
Excel Function | PHPExcel Function
--------------------|-------------------------------------------
ASC | **\*\*\* Not yet Implemented**
BAHTTEXT | **\*\*\* Not yet Implemented**
CHAR | PHPExcel_Calculation_TextData::CHARACTER
CLEAN | PHPExcel_Calculation_TextData::TRIMNONPRINTABLE
CODE | PHPExcel_Calculation_TextData::ASCIICODE
CONCATENATE | PHPExcel_Calculation_TextData::CONCATENATE
DOLLAR | PHPExcel_Calculation_TextData::DOLLAR
EXACT | **\*\*\* Not yet Implemented**
FIND | PHPExcel_Calculation_TextData::SEARCHSENSITIVE
FINDB | PHPExcel_Calculation_TextData::SEARCHSENSITIVE
FIXED | PHPExcel_Calculation_TextData::FIXEDFORMAT
JIS | **\*\*\* Not yet Implemented**
LEFT | PHPExcel_Calculation_TextData::LEFT
LEFTB | PHPExcel_Calculation_TextData::LEFT
LEN | PHPExcel_Calculation_TextData::STRINGLENGTH
LENB | PHPExcel_Calculation_TextData::STRINGLENGTH
LOWER | PHPExcel_Calculation_TextData::LOWERCASE
MID | PHPExcel_Calculation_TextData::MID
MIDB | PHPExcel_Calculation_TextData::MID
PHONETIC | **\*\*\* Not yet Implemented**
PROPER | PHPExcel_Calculation_TextData::PROPERCASE
REPLACE | PHPExcel_Calculation_TextData::REPLACE
REPLACEB | PHPExcel_Calculation_TextData::REPLACE
REPT | str_repeat
RIGHT | PHPExcel_Calculation_TextData::RIGHT
RIGHTB | PHPExcel_Calculation_TextData::RIGHT
SEARCH | PHPExcel_Calculation_TextData::SEARCHINSENSITIVE
SEARCHB | PHPExcel_Calculation_TextData::SEARCHINSENSITIVE
SUBSTITUTE | PHPExcel_Calculation_TextData::SUBSTITUTE
T | PHPExcel_Calculation_TextData::RETURNSTRING
TEXT | PHPExcel_Calculation_TextData::TEXTFORMAT
TRIM | PHPExcel_Calculation_TextData::TRIMSPACES
UPPER | PHPExcel_Calculation_TextData::UPPERCASE
VALUE | **\*\*\* Not yet Implemented**

Some files were not shown because too many files have changed in this diff Show More