Convert all line ending to unix style
This commit is contained in:
parent
f74fde155f
commit
e6bbc4bd25
|
@ -5,7 +5,6 @@ set_time_limit(0);
|
||||||
|
|
||||||
date_default_timezone_set('Europe/London');
|
date_default_timezone_set('Europe/London');
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
|
@ -26,27 +25,26 @@ set_include_path(get_include_path() . PATH_SEPARATOR . '../../../../Classes/');
|
||||||
/** Include PHPExcel */
|
/** Include PHPExcel */
|
||||||
include 'PHPExcel.php';
|
include 'PHPExcel.php';
|
||||||
|
|
||||||
|
|
||||||
// Create new PHPExcel object
|
// Create new PHPExcel object
|
||||||
$objPHPExcel = new PHPExcel();
|
$objPHPExcel = new PHPExcel();
|
||||||
$worksheet = $objPHPExcel->getActiveSheet();
|
$worksheet = $objPHPExcel->getActiveSheet();
|
||||||
|
|
||||||
// Add some data
|
// Add some data
|
||||||
$database = array( array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ),
|
$database = [['Tree', 'Height', 'Age', 'Yield', 'Profit'],
|
||||||
array( 'Apple', 18, 20, 14, 105.00 ),
|
['Apple', 18, 20, 14, 105.00],
|
||||||
array( 'Pear', 12, 12, 10, 96.00 ),
|
['Pear', 12, 12, 10, 96.00],
|
||||||
array( 'Cherry', 13, 14, 9, 105.00 ),
|
['Cherry', 13, 14, 9, 105.00],
|
||||||
array( 'Apple', 14, 15, 10, 75.00 ),
|
['Apple', 14, 15, 10, 75.00],
|
||||||
array( 'Pear', 9, 8, 8, 76.80 ),
|
['Pear', 9, 8, 8, 76.80],
|
||||||
array( 'Apple', 8, 9, 6, 45.00 ),
|
['Apple', 8, 9, 6, 45.00],
|
||||||
);
|
];
|
||||||
$criteria = array( array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ),
|
$criteria = [['Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height'],
|
||||||
array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ),
|
['="=Apple"', '>10', null, null, null, '<16'],
|
||||||
array( '="=Pear"', NULL, NULL, NULL, NULL, NULL )
|
['="=Pear"', null, null, null, null, null],
|
||||||
);
|
];
|
||||||
|
|
||||||
$worksheet->fromArray( $criteria, NULL, 'A1' );
|
$worksheet->fromArray($criteria, null, 'A1');
|
||||||
$worksheet->fromArray( $database, NULL, 'A4' );
|
$worksheet->fromArray($database, null, 'A4');
|
||||||
|
|
||||||
$worksheet->setCellValue('A12', 'The Average yield of Apple trees over 10\' in height');
|
$worksheet->setCellValue('A12', 'The Average yield of Apple trees over 10\' in height');
|
||||||
$worksheet->setCellValue('B12', '=DAVERAGE(A4:E10,"Yield",A1:B2)');
|
$worksheet->setCellValue('B12', '=DAVERAGE(A4:E10,"Yield",A1:B2)');
|
||||||
|
@ -54,36 +52,31 @@ $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('A13', 'The Average age of all Apple and Pear trees in the orchard');
|
||||||
$worksheet->setCellValue('B13', '=DAVERAGE(A4:E10,3,A1:A3)');
|
$worksheet->setCellValue('B13', '=DAVERAGE(A4:E10,3,A1:A3)');
|
||||||
|
|
||||||
|
|
||||||
echo '<hr />';
|
echo '<hr />';
|
||||||
|
|
||||||
|
|
||||||
echo '<h4>Database</h4>';
|
echo '<h4>Database</h4>';
|
||||||
|
|
||||||
$databaseData = $worksheet->rangeToArray('A4:E10', null, true, true, true);
|
$databaseData = $worksheet->rangeToArray('A4:E10', null, true, true, true);
|
||||||
var_dump($databaseData);
|
var_dump($databaseData);
|
||||||
|
|
||||||
|
|
||||||
echo '<hr />';
|
echo '<hr />';
|
||||||
|
|
||||||
|
|
||||||
// Test the formulae
|
// Test the formulae
|
||||||
echo '<h4>Criteria</h4>';
|
echo '<h4>Criteria</h4>';
|
||||||
|
|
||||||
$criteriaData = $worksheet->rangeToArray('A1:B2', null, true, true, true);
|
$criteriaData = $worksheet->rangeToArray('A1:B2', null, true, true, true);
|
||||||
var_dump($criteriaData);
|
var_dump($criteriaData);
|
||||||
|
|
||||||
echo $worksheet->getCell("A12")->getValue() .'<br />';
|
echo $worksheet->getCell('A12')->getValue() . '<br />';
|
||||||
echo 'DAVERAGE() Result is ' . $worksheet->getCell("B12")->getCalculatedValue() .'<br /><br />';
|
echo 'DAVERAGE() Result is ' . $worksheet->getCell('B12')->getCalculatedValue() . '<br /><br />';
|
||||||
|
|
||||||
echo '<h4>Criteria</h4>';
|
echo '<h4>Criteria</h4>';
|
||||||
|
|
||||||
$criteriaData = $worksheet->rangeToArray('A1:A3', null, true, true, true);
|
$criteriaData = $worksheet->rangeToArray('A1:A3', null, true, true, true);
|
||||||
var_dump($criteriaData);
|
var_dump($criteriaData);
|
||||||
|
|
||||||
echo $worksheet->getCell("A13")->getValue() .'<br />';
|
echo $worksheet->getCell('A13')->getValue() . '<br />';
|
||||||
echo 'DAVERAGE() Result is ' . $worksheet->getCell("B13")->getCalculatedValue();
|
echo 'DAVERAGE() Result is ' . $worksheet->getCell('B13')->getCalculatedValue();
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<body>
|
<body>
|
||||||
|
|
|
@ -5,7 +5,6 @@ set_time_limit(0);
|
||||||
|
|
||||||
date_default_timezone_set('Europe/London');
|
date_default_timezone_set('Europe/London');
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
|
@ -26,27 +25,26 @@ set_include_path(get_include_path() . PATH_SEPARATOR . '../../../../Classes/');
|
||||||
/** Include PHPExcel */
|
/** Include PHPExcel */
|
||||||
include 'PHPExcel.php';
|
include 'PHPExcel.php';
|
||||||
|
|
||||||
|
|
||||||
// Create new PHPExcel object
|
// Create new PHPExcel object
|
||||||
$objPHPExcel = new PHPExcel();
|
$objPHPExcel = new PHPExcel();
|
||||||
$worksheet = $objPHPExcel->getActiveSheet();
|
$worksheet = $objPHPExcel->getActiveSheet();
|
||||||
|
|
||||||
// Add some data
|
// Add some data
|
||||||
$database = array( array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ),
|
$database = [['Tree', 'Height', 'Age', 'Yield', 'Profit'],
|
||||||
array( 'Apple', 18, 20, 14, 105.00 ),
|
['Apple', 18, 20, 14, 105.00],
|
||||||
array( 'Pear', 12, 12, 10, 96.00 ),
|
['Pear', 12, 12, 10, 96.00],
|
||||||
array( 'Cherry', 13, 14, 9, 105.00 ),
|
['Cherry', 13, 14, 9, 105.00],
|
||||||
array( 'Apple', 14, 15, 10, 75.00 ),
|
['Apple', 14, 15, 10, 75.00],
|
||||||
array( 'Pear', 9, 8, 8, 76.80 ),
|
['Pear', 9, 8, 8, 76.80],
|
||||||
array( 'Apple', 8, 9, 6, 45.00 ),
|
['Apple', 8, 9, 6, 45.00],
|
||||||
);
|
];
|
||||||
$criteria = array( array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ),
|
$criteria = [['Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height'],
|
||||||
array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ),
|
['="=Apple"', '>10', null, null, null, '<16'],
|
||||||
array( '="=Pear"', NULL, NULL, NULL, NULL, NULL )
|
['="=Pear"', null, null, null, null, null],
|
||||||
);
|
];
|
||||||
|
|
||||||
$worksheet->fromArray( $criteria, NULL, 'A1' );
|
$worksheet->fromArray($criteria, null, 'A1');
|
||||||
$worksheet->fromArray( $database, NULL, 'A4' );
|
$worksheet->fromArray($database, null, 'A4');
|
||||||
|
|
||||||
$worksheet->setCellValue('A12', 'The Number of Apple trees over 10\' in height');
|
$worksheet->setCellValue('A12', 'The Number of Apple trees over 10\' in height');
|
||||||
$worksheet->setCellValue('B12', '=DCOUNT(A4:E10,"Yield",A1:B2)');
|
$worksheet->setCellValue('B12', '=DCOUNT(A4:E10,"Yield",A1:B2)');
|
||||||
|
@ -54,36 +52,31 @@ $worksheet->setCellValue('B12', '=DCOUNT(A4:E10,"Yield",A1:B2)');
|
||||||
$worksheet->setCellValue('A13', 'The Number of Apple and Pear trees in the orchard');
|
$worksheet->setCellValue('A13', 'The Number of Apple and Pear trees in the orchard');
|
||||||
$worksheet->setCellValue('B13', '=DCOUNT(A4:E10,3,A1:A3)');
|
$worksheet->setCellValue('B13', '=DCOUNT(A4:E10,3,A1:A3)');
|
||||||
|
|
||||||
|
|
||||||
echo '<hr />';
|
echo '<hr />';
|
||||||
|
|
||||||
|
|
||||||
echo '<h4>Database</h4>';
|
echo '<h4>Database</h4>';
|
||||||
|
|
||||||
$databaseData = $worksheet->rangeToArray('A4:E10', null, true, true, true);
|
$databaseData = $worksheet->rangeToArray('A4:E10', null, true, true, true);
|
||||||
var_dump($databaseData);
|
var_dump($databaseData);
|
||||||
|
|
||||||
|
|
||||||
echo '<hr />';
|
echo '<hr />';
|
||||||
|
|
||||||
|
|
||||||
// Test the formulae
|
// Test the formulae
|
||||||
echo '<h4>Criteria</h4>';
|
echo '<h4>Criteria</h4>';
|
||||||
|
|
||||||
$criteriaData = $worksheet->rangeToArray('A1:B2', null, true, true, true);
|
$criteriaData = $worksheet->rangeToArray('A1:B2', null, true, true, true);
|
||||||
var_dump($criteriaData);
|
var_dump($criteriaData);
|
||||||
|
|
||||||
echo $worksheet->getCell("A12")->getValue() .'<br />';
|
echo $worksheet->getCell('A12')->getValue() . '<br />';
|
||||||
echo 'DCOUNT() Result is ' . $worksheet->getCell("B12")->getCalculatedValue() .'<br /><br />';
|
echo 'DCOUNT() Result is ' . $worksheet->getCell('B12')->getCalculatedValue() . '<br /><br />';
|
||||||
|
|
||||||
echo '<h4>Criteria</h4>';
|
echo '<h4>Criteria</h4>';
|
||||||
|
|
||||||
$criteriaData = $worksheet->rangeToArray('A1:A3', null, true, true, true);
|
$criteriaData = $worksheet->rangeToArray('A1:A3', null, true, true, true);
|
||||||
var_dump($criteriaData);
|
var_dump($criteriaData);
|
||||||
|
|
||||||
echo $worksheet->getCell("A13")->getValue() .'<br />';
|
echo $worksheet->getCell('A13')->getValue() . '<br />';
|
||||||
echo 'DCOUNT() Result is ' . $worksheet->getCell("B13")->getCalculatedValue();
|
echo 'DCOUNT() Result is ' . $worksheet->getCell('B13')->getCalculatedValue();
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<body>
|
<body>
|
||||||
|
|
|
@ -5,7 +5,6 @@ set_time_limit(0);
|
||||||
|
|
||||||
date_default_timezone_set('Europe/London');
|
date_default_timezone_set('Europe/London');
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
|
@ -26,60 +25,54 @@ set_include_path(get_include_path() . PATH_SEPARATOR . '../../../../Classes/');
|
||||||
/** Include PHPExcel */
|
/** Include PHPExcel */
|
||||||
include 'PHPExcel.php';
|
include 'PHPExcel.php';
|
||||||
|
|
||||||
|
|
||||||
// Create new PHPExcel object
|
// Create new PHPExcel object
|
||||||
$objPHPExcel = new PHPExcel();
|
$objPHPExcel = new PHPExcel();
|
||||||
$worksheet = $objPHPExcel->getActiveSheet();
|
$worksheet = $objPHPExcel->getActiveSheet();
|
||||||
|
|
||||||
// Add some data
|
// Add some data
|
||||||
$database = array( array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ),
|
$database = [['Tree', 'Height', 'Age', 'Yield', 'Profit'],
|
||||||
array( 'Apple', 18, 20, 14, 105.00 ),
|
['Apple', 18, 20, 14, 105.00],
|
||||||
array( 'Pear', 12, 12, 10, 96.00 ),
|
['Pear', 12, 12, 10, 96.00],
|
||||||
array( 'Cherry', 13, 14, 9, 105.00 ),
|
['Cherry', 13, 14, 9, 105.00],
|
||||||
array( 'Apple', 14, 15, 10, 75.00 ),
|
['Apple', 14, 15, 10, 75.00],
|
||||||
array( 'Pear', 9, 8, 8, 76.80 ),
|
['Pear', 9, 8, 8, 76.80],
|
||||||
array( 'Apple', 8, 9, 6, 45.00 ),
|
['Apple', 8, 9, 6, 45.00],
|
||||||
);
|
];
|
||||||
$criteria = array( array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ),
|
$criteria = [['Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height'],
|
||||||
array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ),
|
['="=Apple"', '>10', null, null, null, '<16'],
|
||||||
array( '="=Pear"', NULL, NULL, NULL, NULL, NULL )
|
['="=Pear"', null, null, null, null, null],
|
||||||
);
|
];
|
||||||
|
|
||||||
$worksheet->fromArray( $criteria, NULL, 'A1' );
|
$worksheet->fromArray($criteria, null, 'A1');
|
||||||
$worksheet->fromArray( $database, NULL, 'A4' );
|
$worksheet->fromArray($database, null, 'A4');
|
||||||
|
|
||||||
$worksheet->setCellValue('A12', 'The height of the Apple tree between 10\' and 16\' tall');
|
$worksheet->setCellValue('A12', 'The height of the Apple tree between 10\' and 16\' tall');
|
||||||
$worksheet->setCellValue('B12', '=DGET(A4:E10,"Height",A1:F2)');
|
$worksheet->setCellValue('B12', '=DGET(A4:E10,"Height",A1:F2)');
|
||||||
|
|
||||||
|
|
||||||
echo '<hr />';
|
echo '<hr />';
|
||||||
|
|
||||||
|
|
||||||
echo '<h4>Database</h4>';
|
echo '<h4>Database</h4>';
|
||||||
|
|
||||||
$databaseData = $worksheet->rangeToArray('A4:E10', null, true, true, true);
|
$databaseData = $worksheet->rangeToArray('A4:E10', null, true, true, true);
|
||||||
var_dump($databaseData);
|
var_dump($databaseData);
|
||||||
|
|
||||||
|
|
||||||
echo '<hr />';
|
echo '<hr />';
|
||||||
|
|
||||||
|
|
||||||
// Test the formulae
|
// Test the formulae
|
||||||
echo '<h4>Criteria</h4>';
|
echo '<h4>Criteria</h4>';
|
||||||
|
|
||||||
echo 'ALL' . '<br /><br />';
|
echo 'ALL' . '<br /><br />';
|
||||||
|
|
||||||
echo $worksheet->getCell("A12")->getValue() .'<br />';
|
echo $worksheet->getCell('A12')->getValue() . '<br />';
|
||||||
echo 'DMAX() Result is ' . $worksheet->getCell("B12")->getCalculatedValue() .'<br /><br />';
|
echo 'DMAX() Result is ' . $worksheet->getCell('B12')->getCalculatedValue() . '<br /><br />';
|
||||||
|
|
||||||
echo '<h4>Criteria</h4>';
|
echo '<h4>Criteria</h4>';
|
||||||
|
|
||||||
$criteriaData = $worksheet->rangeToArray('A1:A2', null, true, true, true);
|
$criteriaData = $worksheet->rangeToArray('A1:A2', null, true, true, true);
|
||||||
var_dump($criteriaData);
|
var_dump($criteriaData);
|
||||||
|
|
||||||
echo $worksheet->getCell("A13")->getValue() .'<br />';
|
echo $worksheet->getCell('A13')->getValue() . '<br />';
|
||||||
echo 'DMAX() Result is ' . $worksheet->getCell("B13")->getCalculatedValue();
|
echo 'DMAX() Result is ' . $worksheet->getCell('B13')->getCalculatedValue();
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<body>
|
<body>
|
||||||
|
|
|
@ -5,7 +5,6 @@ set_time_limit(0);
|
||||||
|
|
||||||
date_default_timezone_set('Europe/London');
|
date_default_timezone_set('Europe/London');
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
|
@ -26,27 +25,26 @@ set_include_path(get_include_path() . PATH_SEPARATOR . '../../../../Classes/');
|
||||||
/** Include PHPExcel */
|
/** Include PHPExcel */
|
||||||
include 'PHPExcel.php';
|
include 'PHPExcel.php';
|
||||||
|
|
||||||
|
|
||||||
// Create new PHPExcel object
|
// Create new PHPExcel object
|
||||||
$objPHPExcel = new PHPExcel();
|
$objPHPExcel = new PHPExcel();
|
||||||
$worksheet = $objPHPExcel->getActiveSheet();
|
$worksheet = $objPHPExcel->getActiveSheet();
|
||||||
|
|
||||||
// Add some data
|
// Add some data
|
||||||
$database = array( array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ),
|
$database = [['Tree', 'Height', 'Age', 'Yield', 'Profit'],
|
||||||
array( 'Apple', 18, 20, 14, 105.00 ),
|
['Apple', 18, 20, 14, 105.00],
|
||||||
array( 'Pear', 12, 12, 10, 96.00 ),
|
['Pear', 12, 12, 10, 96.00],
|
||||||
array( 'Cherry', 13, 14, 9, 105.00 ),
|
['Cherry', 13, 14, 9, 105.00],
|
||||||
array( 'Apple', 14, 15, 10, 75.00 ),
|
['Apple', 14, 15, 10, 75.00],
|
||||||
array( 'Pear', 9, 8, 8, 76.80 ),
|
['Pear', 9, 8, 8, 76.80],
|
||||||
array( 'Apple', 8, 9, 6, 45.00 ),
|
['Apple', 8, 9, 6, 45.00],
|
||||||
);
|
];
|
||||||
$criteria = array( array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ),
|
$criteria = [['Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height'],
|
||||||
array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ),
|
['="=Apple"', '>10', null, null, null, '<16'],
|
||||||
array( '="=Pear"', NULL, NULL, NULL, NULL, NULL )
|
['="=Pear"', null, null, null, null, null],
|
||||||
);
|
];
|
||||||
|
|
||||||
$worksheet->fromArray( $criteria, NULL, 'A1' );
|
$worksheet->fromArray($criteria, null, 'A1');
|
||||||
$worksheet->fromArray( $database, NULL, 'A4' );
|
$worksheet->fromArray($database, null, 'A4');
|
||||||
|
|
||||||
$worksheet->setCellValue('A12', 'The tallest tree in the orchard');
|
$worksheet->setCellValue('A12', 'The tallest tree in the orchard');
|
||||||
$worksheet->setCellValue('B12', '=DMAX(A4:E10,"Height",A4:E10)');
|
$worksheet->setCellValue('B12', '=DMAX(A4:E10,"Height",A4:E10)');
|
||||||
|
@ -54,35 +52,30 @@ $worksheet->setCellValue('B12', '=DMAX(A4:E10,"Height",A4:E10)');
|
||||||
$worksheet->setCellValue('A13', 'The Oldest apple tree in the orchard');
|
$worksheet->setCellValue('A13', 'The Oldest apple tree in the orchard');
|
||||||
$worksheet->setCellValue('B13', '=DMAX(A4:E10,3,A1:A2)');
|
$worksheet->setCellValue('B13', '=DMAX(A4:E10,3,A1:A2)');
|
||||||
|
|
||||||
|
|
||||||
echo '<hr />';
|
echo '<hr />';
|
||||||
|
|
||||||
|
|
||||||
echo '<h4>Database</h4>';
|
echo '<h4>Database</h4>';
|
||||||
|
|
||||||
$databaseData = $worksheet->rangeToArray('A4:E10', null, true, true, true);
|
$databaseData = $worksheet->rangeToArray('A4:E10', null, true, true, true);
|
||||||
var_dump($databaseData);
|
var_dump($databaseData);
|
||||||
|
|
||||||
|
|
||||||
echo '<hr />';
|
echo '<hr />';
|
||||||
|
|
||||||
|
|
||||||
// Test the formulae
|
// Test the formulae
|
||||||
echo '<h4>Criteria</h4>';
|
echo '<h4>Criteria</h4>';
|
||||||
|
|
||||||
echo 'ALL' . '<br /><br />';
|
echo 'ALL' . '<br /><br />';
|
||||||
|
|
||||||
echo $worksheet->getCell("A12")->getValue() .'<br />';
|
echo $worksheet->getCell('A12')->getValue() . '<br />';
|
||||||
echo 'DMAX() Result is ' . $worksheet->getCell("B12")->getCalculatedValue() .'<br /><br />';
|
echo 'DMAX() Result is ' . $worksheet->getCell('B12')->getCalculatedValue() . '<br /><br />';
|
||||||
|
|
||||||
echo '<h4>Criteria</h4>';
|
echo '<h4>Criteria</h4>';
|
||||||
|
|
||||||
$criteriaData = $worksheet->rangeToArray('A1:A2', null, true, true, true);
|
$criteriaData = $worksheet->rangeToArray('A1:A2', null, true, true, true);
|
||||||
var_dump($criteriaData);
|
var_dump($criteriaData);
|
||||||
|
|
||||||
echo $worksheet->getCell("A13")->getValue() .'<br />';
|
echo $worksheet->getCell('A13')->getValue() . '<br />';
|
||||||
echo 'DMAX() Result is ' . $worksheet->getCell("B13")->getCalculatedValue();
|
echo 'DMAX() Result is ' . $worksheet->getCell('B13')->getCalculatedValue();
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<body>
|
<body>
|
||||||
|
|
|
@ -5,7 +5,6 @@ set_time_limit(0);
|
||||||
|
|
||||||
date_default_timezone_set('Europe/London');
|
date_default_timezone_set('Europe/London');
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
|
@ -26,27 +25,26 @@ set_include_path(get_include_path() . PATH_SEPARATOR . '../../../../Classes/');
|
||||||
/** Include PHPExcel */
|
/** Include PHPExcel */
|
||||||
include 'PHPExcel.php';
|
include 'PHPExcel.php';
|
||||||
|
|
||||||
|
|
||||||
// Create new PHPExcel object
|
// Create new PHPExcel object
|
||||||
$objPHPExcel = new PHPExcel();
|
$objPHPExcel = new PHPExcel();
|
||||||
$worksheet = $objPHPExcel->getActiveSheet();
|
$worksheet = $objPHPExcel->getActiveSheet();
|
||||||
|
|
||||||
// Add some data
|
// Add some data
|
||||||
$database = array( array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ),
|
$database = [['Tree', 'Height', 'Age', 'Yield', 'Profit'],
|
||||||
array( 'Apple', 18, 20, 14, 105.00 ),
|
['Apple', 18, 20, 14, 105.00],
|
||||||
array( 'Pear', 12, 12, 10, 96.00 ),
|
['Pear', 12, 12, 10, 96.00],
|
||||||
array( 'Cherry', 13, 14, 9, 105.00 ),
|
['Cherry', 13, 14, 9, 105.00],
|
||||||
array( 'Apple', 14, 15, 10, 75.00 ),
|
['Apple', 14, 15, 10, 75.00],
|
||||||
array( 'Pear', 9, 8, 8, 76.80 ),
|
['Pear', 9, 8, 8, 76.80],
|
||||||
array( 'Apple', 8, 9, 6, 45.00 ),
|
['Apple', 8, 9, 6, 45.00],
|
||||||
);
|
];
|
||||||
$criteria = array( array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ),
|
$criteria = [['Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height'],
|
||||||
array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ),
|
['="=Apple"', '>10', null, null, null, '<16'],
|
||||||
array( '="=Pear"', NULL, NULL, NULL, NULL, NULL )
|
['="=Pear"', null, null, null, null, null],
|
||||||
);
|
];
|
||||||
|
|
||||||
$worksheet->fromArray( $criteria, NULL, 'A1' );
|
$worksheet->fromArray($criteria, null, 'A1');
|
||||||
$worksheet->fromArray( $database, NULL, 'A4' );
|
$worksheet->fromArray($database, null, 'A4');
|
||||||
|
|
||||||
$worksheet->setCellValue('A12', 'The shortest tree in the orchard');
|
$worksheet->setCellValue('A12', 'The shortest tree in the orchard');
|
||||||
$worksheet->setCellValue('B12', '=DMIN(A4:E10,"Height",A4:E10)');
|
$worksheet->setCellValue('B12', '=DMIN(A4:E10,"Height",A4:E10)');
|
||||||
|
@ -54,35 +52,30 @@ $worksheet->setCellValue('B12', '=DMIN(A4:E10,"Height",A4:E10)');
|
||||||
$worksheet->setCellValue('A13', 'The Youngest apple tree in the orchard');
|
$worksheet->setCellValue('A13', 'The Youngest apple tree in the orchard');
|
||||||
$worksheet->setCellValue('B13', '=DMIN(A4:E10,3,A1:A2)');
|
$worksheet->setCellValue('B13', '=DMIN(A4:E10,3,A1:A2)');
|
||||||
|
|
||||||
|
|
||||||
echo '<hr />';
|
echo '<hr />';
|
||||||
|
|
||||||
|
|
||||||
echo '<h4>Database</h4>';
|
echo '<h4>Database</h4>';
|
||||||
|
|
||||||
$databaseData = $worksheet->rangeToArray('A4:E10', null, true, true, true);
|
$databaseData = $worksheet->rangeToArray('A4:E10', null, true, true, true);
|
||||||
var_dump($databaseData);
|
var_dump($databaseData);
|
||||||
|
|
||||||
|
|
||||||
echo '<hr />';
|
echo '<hr />';
|
||||||
|
|
||||||
|
|
||||||
// Test the formulae
|
// Test the formulae
|
||||||
echo '<h4>Criteria</h4>';
|
echo '<h4>Criteria</h4>';
|
||||||
|
|
||||||
echo 'ALL' . '<br /><br />';
|
echo 'ALL' . '<br /><br />';
|
||||||
|
|
||||||
echo $worksheet->getCell("A12")->getValue() .'<br />';
|
echo $worksheet->getCell('A12')->getValue() . '<br />';
|
||||||
echo 'DMIN() Result is ' . $worksheet->getCell("B12")->getCalculatedValue() .'<br /><br />';
|
echo 'DMIN() Result is ' . $worksheet->getCell('B12')->getCalculatedValue() . '<br /><br />';
|
||||||
|
|
||||||
echo '<h4>Criteria</h4>';
|
echo '<h4>Criteria</h4>';
|
||||||
|
|
||||||
$criteriaData = $worksheet->rangeToArray('A1:A2', null, true, true, true);
|
$criteriaData = $worksheet->rangeToArray('A1:A2', null, true, true, true);
|
||||||
var_dump($criteriaData);
|
var_dump($criteriaData);
|
||||||
|
|
||||||
echo $worksheet->getCell("A13")->getValue() .'<br />';
|
echo $worksheet->getCell('A13')->getValue() . '<br />';
|
||||||
echo 'DMIN() Result is ' . $worksheet->getCell("B13")->getCalculatedValue();
|
echo 'DMIN() Result is ' . $worksheet->getCell('B13')->getCalculatedValue();
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<body>
|
<body>
|
||||||
|
|
|
@ -5,7 +5,6 @@ set_time_limit(0);
|
||||||
|
|
||||||
date_default_timezone_set('Europe/London');
|
date_default_timezone_set('Europe/London');
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
|
@ -26,61 +25,54 @@ set_include_path(get_include_path() . PATH_SEPARATOR . '../../../../Classes/');
|
||||||
/** Include PHPExcel */
|
/** Include PHPExcel */
|
||||||
include 'PHPExcel.php';
|
include 'PHPExcel.php';
|
||||||
|
|
||||||
|
|
||||||
// Create new PHPExcel object
|
// Create new PHPExcel object
|
||||||
$objPHPExcel = new PHPExcel();
|
$objPHPExcel = new PHPExcel();
|
||||||
$worksheet = $objPHPExcel->getActiveSheet();
|
$worksheet = $objPHPExcel->getActiveSheet();
|
||||||
|
|
||||||
// Add some data
|
// Add some data
|
||||||
$database = array( array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ),
|
$database = [['Tree', 'Height', 'Age', 'Yield', 'Profit'],
|
||||||
array( 'Apple', 18, 20, 14, 105.00 ),
|
['Apple', 18, 20, 14, 105.00],
|
||||||
array( 'Pear', 12, 12, 10, 96.00 ),
|
['Pear', 12, 12, 10, 96.00],
|
||||||
array( 'Cherry', 13, 14, 9, 105.00 ),
|
['Cherry', 13, 14, 9, 105.00],
|
||||||
array( 'Apple', 14, 15, 10, 75.00 ),
|
['Apple', 14, 15, 10, 75.00],
|
||||||
array( 'Pear', 9, 8, 8, 76.80 ),
|
['Pear', 9, 8, 8, 76.80],
|
||||||
array( 'Apple', 8, 9, 6, 45.00 ),
|
['Apple', 8, 9, 6, 45.00],
|
||||||
);
|
];
|
||||||
$criteria = array( array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ),
|
$criteria = [['Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height'],
|
||||||
array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ),
|
['="=Apple"', '>10', null, null, null, '<16'],
|
||||||
array( '="=Pear"', NULL, NULL, NULL, NULL, NULL )
|
['="=Pear"', null, null, null, null, null],
|
||||||
);
|
];
|
||||||
|
|
||||||
$worksheet->fromArray( $criteria, NULL, 'A1' );
|
$worksheet->fromArray($criteria, null, 'A1');
|
||||||
$worksheet->fromArray( $database, NULL, 'A4' );
|
$worksheet->fromArray($database, null, 'A4');
|
||||||
|
|
||||||
$worksheet->setCellValue('A12', 'The product of the yields of all Apple trees over 10\' in the orchard');
|
$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)');
|
$worksheet->setCellValue('B12', '=DPRODUCT(A4:E10,"Yield",A1:B2)');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
echo '<hr />';
|
echo '<hr />';
|
||||||
|
|
||||||
|
|
||||||
echo '<h4>Database</h4>';
|
echo '<h4>Database</h4>';
|
||||||
|
|
||||||
$databaseData = $worksheet->rangeToArray('A4:E10', null, true, true, true);
|
$databaseData = $worksheet->rangeToArray('A4:E10', null, true, true, true);
|
||||||
var_dump($databaseData);
|
var_dump($databaseData);
|
||||||
|
|
||||||
|
|
||||||
echo '<hr />';
|
echo '<hr />';
|
||||||
|
|
||||||
|
|
||||||
// Test the formulae
|
// Test the formulae
|
||||||
echo '<h4>Criteria</h4>';
|
echo '<h4>Criteria</h4>';
|
||||||
|
|
||||||
echo 'ALL' . '<br /><br />';
|
echo 'ALL' . '<br /><br />';
|
||||||
|
|
||||||
echo $worksheet->getCell("A12")->getValue() .'<br />';
|
echo $worksheet->getCell('A12')->getValue() . '<br />';
|
||||||
echo 'DMAX() Result is ' . $worksheet->getCell("B12")->getCalculatedValue() .'<br /><br />';
|
echo 'DMAX() Result is ' . $worksheet->getCell('B12')->getCalculatedValue() . '<br /><br />';
|
||||||
|
|
||||||
echo '<h4>Criteria</h4>';
|
echo '<h4>Criteria</h4>';
|
||||||
|
|
||||||
$criteriaData = $worksheet->rangeToArray('A1:A2', null, true, true, true);
|
$criteriaData = $worksheet->rangeToArray('A1:A2', null, true, true, true);
|
||||||
var_dump($criteriaData);
|
var_dump($criteriaData);
|
||||||
|
|
||||||
echo $worksheet->getCell("A13")->getValue() .'<br />';
|
echo $worksheet->getCell('A13')->getValue() . '<br />';
|
||||||
echo 'DMAX() Result is ' . $worksheet->getCell("B13")->getCalculatedValue();
|
echo 'DMAX() Result is ' . $worksheet->getCell('B13')->getCalculatedValue();
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<body>
|
<body>
|
||||||
|
|
|
@ -5,7 +5,6 @@ set_time_limit(0);
|
||||||
|
|
||||||
date_default_timezone_set('Europe/London');
|
date_default_timezone_set('Europe/London');
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
|
@ -26,27 +25,26 @@ set_include_path(get_include_path() . PATH_SEPARATOR . '../../../../Classes/');
|
||||||
/** Include PHPExcel */
|
/** Include PHPExcel */
|
||||||
include 'PHPExcel.php';
|
include 'PHPExcel.php';
|
||||||
|
|
||||||
|
|
||||||
// Create new PHPExcel object
|
// Create new PHPExcel object
|
||||||
$objPHPExcel = new PHPExcel();
|
$objPHPExcel = new PHPExcel();
|
||||||
$worksheet = $objPHPExcel->getActiveSheet();
|
$worksheet = $objPHPExcel->getActiveSheet();
|
||||||
|
|
||||||
// Add some data
|
// Add some data
|
||||||
$database = array( array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ),
|
$database = [['Tree', 'Height', 'Age', 'Yield', 'Profit'],
|
||||||
array( 'Apple', 18, 20, 14, 105.00 ),
|
['Apple', 18, 20, 14, 105.00],
|
||||||
array( 'Pear', 12, 12, 10, 96.00 ),
|
['Pear', 12, 12, 10, 96.00],
|
||||||
array( 'Cherry', 13, 14, 9, 105.00 ),
|
['Cherry', 13, 14, 9, 105.00],
|
||||||
array( 'Apple', 14, 15, 10, 75.00 ),
|
['Apple', 14, 15, 10, 75.00],
|
||||||
array( 'Pear', 9, 8, 8, 76.80 ),
|
['Pear', 9, 8, 8, 76.80],
|
||||||
array( 'Apple', 8, 9, 6, 45.00 ),
|
['Apple', 8, 9, 6, 45.00],
|
||||||
);
|
];
|
||||||
$criteria = array( array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ),
|
$criteria = [['Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height'],
|
||||||
array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ),
|
['="=Apple"', '>10', null, null, null, '<16'],
|
||||||
array( '="=Pear"', NULL, NULL, NULL, NULL, NULL )
|
['="=Pear"', null, null, null, null, null],
|
||||||
);
|
];
|
||||||
|
|
||||||
$worksheet->fromArray( $criteria, NULL, 'A1' );
|
$worksheet->fromArray($criteria, null, 'A1');
|
||||||
$worksheet->fromArray( $database, NULL, 'A4' );
|
$worksheet->fromArray($database, null, 'A4');
|
||||||
|
|
||||||
$worksheet->setCellValue('A12', 'The estimated standard deviation in the yield of Apple and Pear trees');
|
$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('B12', '=DSTDEV(A4:E10,"Yield",A1:A3)');
|
||||||
|
@ -54,36 +52,31 @@ $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('A13', 'The estimated standard deviation in height of Apple and Pear trees');
|
||||||
$worksheet->setCellValue('B13', '=DSTDEV(A4:E10,2,A1:A3)');
|
$worksheet->setCellValue('B13', '=DSTDEV(A4:E10,2,A1:A3)');
|
||||||
|
|
||||||
|
|
||||||
echo '<hr />';
|
echo '<hr />';
|
||||||
|
|
||||||
|
|
||||||
echo '<h4>Database</h4>';
|
echo '<h4>Database</h4>';
|
||||||
|
|
||||||
$databaseData = $worksheet->rangeToArray('A4:E10', null, true, true, true);
|
$databaseData = $worksheet->rangeToArray('A4:E10', null, true, true, true);
|
||||||
var_dump($databaseData);
|
var_dump($databaseData);
|
||||||
|
|
||||||
|
|
||||||
echo '<hr />';
|
echo '<hr />';
|
||||||
|
|
||||||
|
|
||||||
// Test the formulae
|
// Test the formulae
|
||||||
echo '<h4>Criteria</h4>';
|
echo '<h4>Criteria</h4>';
|
||||||
|
|
||||||
$criteriaData = $worksheet->rangeToArray('A1:A3', null, true, true, true);
|
$criteriaData = $worksheet->rangeToArray('A1:A3', null, true, true, true);
|
||||||
var_dump($criteriaData);
|
var_dump($criteriaData);
|
||||||
|
|
||||||
echo $worksheet->getCell("A12")->getValue() .'<br />';
|
echo $worksheet->getCell('A12')->getValue() . '<br />';
|
||||||
echo 'DSTDEV() Result is ' . $worksheet->getCell("B12")->getCalculatedValue() .'<br /><br />';
|
echo 'DSTDEV() Result is ' . $worksheet->getCell('B12')->getCalculatedValue() . '<br /><br />';
|
||||||
|
|
||||||
echo '<h4>Criteria</h4>';
|
echo '<h4>Criteria</h4>';
|
||||||
|
|
||||||
$criteriaData = $worksheet->rangeToArray('A1:A3', null, true, true, true);
|
$criteriaData = $worksheet->rangeToArray('A1:A3', null, true, true, true);
|
||||||
var_dump($criteriaData);
|
var_dump($criteriaData);
|
||||||
|
|
||||||
echo $worksheet->getCell("A13")->getValue() .'<br />';
|
echo $worksheet->getCell('A13')->getValue() . '<br />';
|
||||||
echo 'DSTDEV() Result is ' . $worksheet->getCell("B13")->getCalculatedValue();
|
echo 'DSTDEV() Result is ' . $worksheet->getCell('B13')->getCalculatedValue();
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<body>
|
<body>
|
||||||
|
|
|
@ -5,7 +5,6 @@ set_time_limit(0);
|
||||||
|
|
||||||
date_default_timezone_set('Europe/London');
|
date_default_timezone_set('Europe/London');
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
|
@ -26,27 +25,26 @@ set_include_path(get_include_path() . PATH_SEPARATOR . '../../../../Classes/');
|
||||||
/** Include PHPExcel */
|
/** Include PHPExcel */
|
||||||
include 'PHPExcel.php';
|
include 'PHPExcel.php';
|
||||||
|
|
||||||
|
|
||||||
// Create new PHPExcel object
|
// Create new PHPExcel object
|
||||||
$objPHPExcel = new PHPExcel();
|
$objPHPExcel = new PHPExcel();
|
||||||
$worksheet = $objPHPExcel->getActiveSheet();
|
$worksheet = $objPHPExcel->getActiveSheet();
|
||||||
|
|
||||||
// Add some data
|
// Add some data
|
||||||
$database = array( array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ),
|
$database = [['Tree', 'Height', 'Age', 'Yield', 'Profit'],
|
||||||
array( 'Apple', 18, 20, 14, 105.00 ),
|
['Apple', 18, 20, 14, 105.00],
|
||||||
array( 'Pear', 12, 12, 10, 96.00 ),
|
['Pear', 12, 12, 10, 96.00],
|
||||||
array( 'Cherry', 13, 14, 9, 105.00 ),
|
['Cherry', 13, 14, 9, 105.00],
|
||||||
array( 'Apple', 14, 15, 10, 75.00 ),
|
['Apple', 14, 15, 10, 75.00],
|
||||||
array( 'Pear', 9, 8, 8, 76.80 ),
|
['Pear', 9, 8, 8, 76.80],
|
||||||
array( 'Apple', 8, 9, 6, 45.00 ),
|
['Apple', 8, 9, 6, 45.00],
|
||||||
);
|
];
|
||||||
$criteria = array( array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ),
|
$criteria = [['Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height'],
|
||||||
array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ),
|
['="=Apple"', '>10', null, null, null, '<16'],
|
||||||
array( '="=Pear"', NULL, NULL, NULL, NULL, NULL )
|
['="=Pear"', null, null, null, null, null],
|
||||||
);
|
];
|
||||||
|
|
||||||
$worksheet->fromArray( $criteria, NULL, 'A1' );
|
$worksheet->fromArray($criteria, null, 'A1');
|
||||||
$worksheet->fromArray( $database, NULL, 'A4' );
|
$worksheet->fromArray($database, null, 'A4');
|
||||||
|
|
||||||
$worksheet->setCellValue('A12', 'The standard deviation in the yield of Apple and Pear trees');
|
$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('B12', '=DSTDEVP(A4:E10,"Yield",A1:A3)');
|
||||||
|
@ -54,36 +52,31 @@ $worksheet->setCellValue('B12', '=DSTDEVP(A4:E10,"Yield",A1:A3)');
|
||||||
$worksheet->setCellValue('A13', 'The standard deviation in height of Apple and Pear trees');
|
$worksheet->setCellValue('A13', 'The standard deviation in height of Apple and Pear trees');
|
||||||
$worksheet->setCellValue('B13', '=DSTDEVP(A4:E10,2,A1:A3)');
|
$worksheet->setCellValue('B13', '=DSTDEVP(A4:E10,2,A1:A3)');
|
||||||
|
|
||||||
|
|
||||||
echo '<hr />';
|
echo '<hr />';
|
||||||
|
|
||||||
|
|
||||||
echo '<h4>Database</h4>';
|
echo '<h4>Database</h4>';
|
||||||
|
|
||||||
$databaseData = $worksheet->rangeToArray('A4:E10', null, true, true, true);
|
$databaseData = $worksheet->rangeToArray('A4:E10', null, true, true, true);
|
||||||
var_dump($databaseData);
|
var_dump($databaseData);
|
||||||
|
|
||||||
|
|
||||||
echo '<hr />';
|
echo '<hr />';
|
||||||
|
|
||||||
|
|
||||||
// Test the formulae
|
// Test the formulae
|
||||||
echo '<h4>Criteria</h4>';
|
echo '<h4>Criteria</h4>';
|
||||||
|
|
||||||
$criteriaData = $worksheet->rangeToArray('A1:A3', null, true, true, true);
|
$criteriaData = $worksheet->rangeToArray('A1:A3', null, true, true, true);
|
||||||
var_dump($criteriaData);
|
var_dump($criteriaData);
|
||||||
|
|
||||||
echo $worksheet->getCell("A12")->getValue() .'<br />';
|
echo $worksheet->getCell('A12')->getValue() . '<br />';
|
||||||
echo 'DSTDEVP() Result is ' . $worksheet->getCell("B12")->getCalculatedValue() .'<br /><br />';
|
echo 'DSTDEVP() Result is ' . $worksheet->getCell('B12')->getCalculatedValue() . '<br /><br />';
|
||||||
|
|
||||||
echo '<h4>Criteria</h4>';
|
echo '<h4>Criteria</h4>';
|
||||||
|
|
||||||
$criteriaData = $worksheet->rangeToArray('A1:A3', null, true, true, true);
|
$criteriaData = $worksheet->rangeToArray('A1:A3', null, true, true, true);
|
||||||
var_dump($criteriaData);
|
var_dump($criteriaData);
|
||||||
|
|
||||||
echo $worksheet->getCell("A13")->getValue() .'<br />';
|
echo $worksheet->getCell('A13')->getValue() . '<br />';
|
||||||
echo 'DSTDEVP() Result is ' . $worksheet->getCell("B13")->getCalculatedValue();
|
echo 'DSTDEVP() Result is ' . $worksheet->getCell('B13')->getCalculatedValue();
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<body>
|
<body>
|
||||||
|
|
|
@ -5,7 +5,6 @@ set_time_limit(0);
|
||||||
|
|
||||||
date_default_timezone_set('Europe/London');
|
date_default_timezone_set('Europe/London');
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
|
@ -26,27 +25,26 @@ set_include_path(get_include_path() . PATH_SEPARATOR . '../../../../Classes/');
|
||||||
/** Include PHPExcel */
|
/** Include PHPExcel */
|
||||||
include 'PHPExcel.php';
|
include 'PHPExcel.php';
|
||||||
|
|
||||||
|
|
||||||
// Create new PHPExcel object
|
// Create new PHPExcel object
|
||||||
$objPHPExcel = new PHPExcel();
|
$objPHPExcel = new PHPExcel();
|
||||||
$worksheet = $objPHPExcel->getActiveSheet();
|
$worksheet = $objPHPExcel->getActiveSheet();
|
||||||
|
|
||||||
// Add some data
|
// Add some data
|
||||||
$database = array( array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ),
|
$database = [['Tree', 'Height', 'Age', 'Yield', 'Profit'],
|
||||||
array( 'Apple', 18, 20, 14, 105.00 ),
|
['Apple', 18, 20, 14, 105.00],
|
||||||
array( 'Pear', 12, 12, 10, 96.00 ),
|
['Pear', 12, 12, 10, 96.00],
|
||||||
array( 'Cherry', 13, 14, 9, 105.00 ),
|
['Cherry', 13, 14, 9, 105.00],
|
||||||
array( 'Apple', 14, 15, 10, 75.00 ),
|
['Apple', 14, 15, 10, 75.00],
|
||||||
array( 'Pear', 9, 8, 8, 76.80 ),
|
['Pear', 9, 8, 8, 76.80],
|
||||||
array( 'Apple', 8, 9, 6, 45.00 ),
|
['Apple', 8, 9, 6, 45.00],
|
||||||
);
|
];
|
||||||
$criteria = array( array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ),
|
$criteria = [['Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height'],
|
||||||
array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ),
|
['="=Apple"', '>10', null, null, null, '<16'],
|
||||||
array( '="=Pear"', NULL, NULL, NULL, NULL, NULL )
|
['="=Pear"', null, null, null, null, null],
|
||||||
);
|
];
|
||||||
|
|
||||||
$worksheet->fromArray( $criteria, NULL, 'A1' );
|
$worksheet->fromArray($criteria, null, 'A1');
|
||||||
$worksheet->fromArray( $database, NULL, 'A4' );
|
$worksheet->fromArray($database, null, 'A4');
|
||||||
|
|
||||||
$worksheet->setCellValue('A12', 'The estimated variance in the yield of Apple and Pear trees');
|
$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('B12', '=DVAR(A4:E10,"Yield",A1:A3)');
|
||||||
|
@ -54,36 +52,31 @@ $worksheet->setCellValue('B12', '=DVAR(A4:E10,"Yield",A1:A3)');
|
||||||
$worksheet->setCellValue('A13', 'The estimated variance in height of Apple and Pear trees');
|
$worksheet->setCellValue('A13', 'The estimated variance in height of Apple and Pear trees');
|
||||||
$worksheet->setCellValue('B13', '=DVAR(A4:E10,2,A1:A3)');
|
$worksheet->setCellValue('B13', '=DVAR(A4:E10,2,A1:A3)');
|
||||||
|
|
||||||
|
|
||||||
echo '<hr />';
|
echo '<hr />';
|
||||||
|
|
||||||
|
|
||||||
echo '<h4>Database</h4>';
|
echo '<h4>Database</h4>';
|
||||||
|
|
||||||
$databaseData = $worksheet->rangeToArray('A4:E10', null, true, true, true);
|
$databaseData = $worksheet->rangeToArray('A4:E10', null, true, true, true);
|
||||||
var_dump($databaseData);
|
var_dump($databaseData);
|
||||||
|
|
||||||
|
|
||||||
echo '<hr />';
|
echo '<hr />';
|
||||||
|
|
||||||
|
|
||||||
// Test the formulae
|
// Test the formulae
|
||||||
echo '<h4>Criteria</h4>';
|
echo '<h4>Criteria</h4>';
|
||||||
|
|
||||||
$criteriaData = $worksheet->rangeToArray('A1:A3', null, true, true, true);
|
$criteriaData = $worksheet->rangeToArray('A1:A3', null, true, true, true);
|
||||||
var_dump($criteriaData);
|
var_dump($criteriaData);
|
||||||
|
|
||||||
echo $worksheet->getCell("A12")->getValue() .'<br />';
|
echo $worksheet->getCell('A12')->getValue() . '<br />';
|
||||||
echo 'DVAR() Result is ' . $worksheet->getCell("B12")->getCalculatedValue() .'<br /><br />';
|
echo 'DVAR() Result is ' . $worksheet->getCell('B12')->getCalculatedValue() . '<br /><br />';
|
||||||
|
|
||||||
echo '<h4>Criteria</h4>';
|
echo '<h4>Criteria</h4>';
|
||||||
|
|
||||||
$criteriaData = $worksheet->rangeToArray('A1:A3', null, true, true, true);
|
$criteriaData = $worksheet->rangeToArray('A1:A3', null, true, true, true);
|
||||||
var_dump($criteriaData);
|
var_dump($criteriaData);
|
||||||
|
|
||||||
echo $worksheet->getCell("A13")->getValue() .'<br />';
|
echo $worksheet->getCell('A13')->getValue() . '<br />';
|
||||||
echo 'DVAR() Result is ' . $worksheet->getCell("B13")->getCalculatedValue();
|
echo 'DVAR() Result is ' . $worksheet->getCell('B13')->getCalculatedValue();
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<body>
|
<body>
|
||||||
|
|
|
@ -5,7 +5,6 @@ set_time_limit(0);
|
||||||
|
|
||||||
date_default_timezone_set('Europe/London');
|
date_default_timezone_set('Europe/London');
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
|
@ -26,27 +25,26 @@ set_include_path(get_include_path() . PATH_SEPARATOR . '../../../../Classes/');
|
||||||
/** Include PHPExcel */
|
/** Include PHPExcel */
|
||||||
include 'PHPExcel.php';
|
include 'PHPExcel.php';
|
||||||
|
|
||||||
|
|
||||||
// Create new PHPExcel object
|
// Create new PHPExcel object
|
||||||
$objPHPExcel = new PHPExcel();
|
$objPHPExcel = new PHPExcel();
|
||||||
$worksheet = $objPHPExcel->getActiveSheet();
|
$worksheet = $objPHPExcel->getActiveSheet();
|
||||||
|
|
||||||
// Add some data
|
// Add some data
|
||||||
$database = array( array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ),
|
$database = [['Tree', 'Height', 'Age', 'Yield', 'Profit'],
|
||||||
array( 'Apple', 18, 20, 14, 105.00 ),
|
['Apple', 18, 20, 14, 105.00],
|
||||||
array( 'Pear', 12, 12, 10, 96.00 ),
|
['Pear', 12, 12, 10, 96.00],
|
||||||
array( 'Cherry', 13, 14, 9, 105.00 ),
|
['Cherry', 13, 14, 9, 105.00],
|
||||||
array( 'Apple', 14, 15, 10, 75.00 ),
|
['Apple', 14, 15, 10, 75.00],
|
||||||
array( 'Pear', 9, 8, 8, 76.80 ),
|
['Pear', 9, 8, 8, 76.80],
|
||||||
array( 'Apple', 8, 9, 6, 45.00 ),
|
['Apple', 8, 9, 6, 45.00],
|
||||||
);
|
];
|
||||||
$criteria = array( array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ),
|
$criteria = [['Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height'],
|
||||||
array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ),
|
['="=Apple"', '>10', null, null, null, '<16'],
|
||||||
array( '="=Pear"', NULL, NULL, NULL, NULL, NULL )
|
['="=Pear"', null, null, null, null, null],
|
||||||
);
|
];
|
||||||
|
|
||||||
$worksheet->fromArray( $criteria, NULL, 'A1' );
|
$worksheet->fromArray($criteria, null, 'A1');
|
||||||
$worksheet->fromArray( $database, NULL, 'A4' );
|
$worksheet->fromArray($database, null, 'A4');
|
||||||
|
|
||||||
$worksheet->setCellValue('A12', 'The variance in the yield of Apple and Pear trees');
|
$worksheet->setCellValue('A12', 'The variance in the yield of Apple and Pear trees');
|
||||||
$worksheet->setCellValue('B12', '=DVARP(A4:E10,"Yield",A1:A3)');
|
$worksheet->setCellValue('B12', '=DVARP(A4:E10,"Yield",A1:A3)');
|
||||||
|
@ -54,36 +52,31 @@ $worksheet->setCellValue('B12', '=DVARP(A4:E10,"Yield",A1:A3)');
|
||||||
$worksheet->setCellValue('A13', 'The variance in height of Apple and Pear trees');
|
$worksheet->setCellValue('A13', 'The variance in height of Apple and Pear trees');
|
||||||
$worksheet->setCellValue('B13', '=DVARP(A4:E10,2,A1:A3)');
|
$worksheet->setCellValue('B13', '=DVARP(A4:E10,2,A1:A3)');
|
||||||
|
|
||||||
|
|
||||||
echo '<hr />';
|
echo '<hr />';
|
||||||
|
|
||||||
|
|
||||||
echo '<h4>Database</h4>';
|
echo '<h4>Database</h4>';
|
||||||
|
|
||||||
$databaseData = $worksheet->rangeToArray('A4:E10', null, true, true, true);
|
$databaseData = $worksheet->rangeToArray('A4:E10', null, true, true, true);
|
||||||
var_dump($databaseData);
|
var_dump($databaseData);
|
||||||
|
|
||||||
|
|
||||||
echo '<hr />';
|
echo '<hr />';
|
||||||
|
|
||||||
|
|
||||||
// Test the formulae
|
// Test the formulae
|
||||||
echo '<h4>Criteria</h4>';
|
echo '<h4>Criteria</h4>';
|
||||||
|
|
||||||
$criteriaData = $worksheet->rangeToArray('A1:A3', null, true, true, true);
|
$criteriaData = $worksheet->rangeToArray('A1:A3', null, true, true, true);
|
||||||
var_dump($criteriaData);
|
var_dump($criteriaData);
|
||||||
|
|
||||||
echo $worksheet->getCell("A12")->getValue() .'<br />';
|
echo $worksheet->getCell('A12')->getValue() . '<br />';
|
||||||
echo 'DVARP() Result is ' . $worksheet->getCell("B12")->getCalculatedValue() .'<br /><br />';
|
echo 'DVARP() Result is ' . $worksheet->getCell('B12')->getCalculatedValue() . '<br /><br />';
|
||||||
|
|
||||||
echo '<h4>Criteria</h4>';
|
echo '<h4>Criteria</h4>';
|
||||||
|
|
||||||
$criteriaData = $worksheet->rangeToArray('A1:A3', null, true, true, true);
|
$criteriaData = $worksheet->rangeToArray('A1:A3', null, true, true, true);
|
||||||
var_dump($criteriaData);
|
var_dump($criteriaData);
|
||||||
|
|
||||||
echo $worksheet->getCell("A13")->getValue() .'<br />';
|
echo $worksheet->getCell('A13')->getValue() . '<br />';
|
||||||
echo 'DVARP() Result is ' . $worksheet->getCell("B13")->getCalculatedValue();
|
echo 'DVARP() Result is ' . $worksheet->getCell('B13')->getCalculatedValue();
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<body>
|
<body>
|
||||||
|
|
|
@ -22,7 +22,6 @@ echo '<h1>PHPExcel Calculation Function Examples</h1>';
|
||||||
$exampleTypeList = glob('./*', GLOB_ONLYDIR);
|
$exampleTypeList = glob('./*', GLOB_ONLYDIR);
|
||||||
|
|
||||||
foreach ($exampleTypeList as $exampleType) {
|
foreach ($exampleTypeList as $exampleType) {
|
||||||
|
|
||||||
echo '<h2>' . pathinfo($exampleType, PATHINFO_BASENAME) . ' Function Examples</h2>';
|
echo '<h2>' . pathinfo($exampleType, PATHINFO_BASENAME) . ' Function Examples</h2>';
|
||||||
|
|
||||||
$exampleList = glob('./' . $exampleType . '/*.php');
|
$exampleList = glob('./' . $exampleType . '/*.php');
|
||||||
|
@ -42,7 +41,6 @@ foreach($exampleTypeList as $exampleType) {
|
||||||
echo $h2Text,'<br />';
|
echo $h2Text,'<br />';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,18 +25,15 @@ set_include_path(get_include_path() . PATH_SEPARATOR . '../../../Classes/');
|
||||||
/** PHPExcel_IOFactory */
|
/** PHPExcel_IOFactory */
|
||||||
include 'PHPExcel/IOFactory.php';
|
include 'PHPExcel/IOFactory.php';
|
||||||
|
|
||||||
|
|
||||||
$inputFileName = './sampleData/example1.xls';
|
$inputFileName = './sampleData/example1.xls';
|
||||||
echo 'Loading file ',pathinfo($inputFileName, PATHINFO_BASENAME),' using IOFactory to identify the format<br />';
|
echo 'Loading file ',pathinfo($inputFileName, PATHINFO_BASENAME),' using IOFactory to identify the format<br />';
|
||||||
$objPHPExcel = PHPExcel_IOFactory::load($inputFileName);
|
$objPHPExcel = PHPExcel_IOFactory::load($inputFileName);
|
||||||
|
|
||||||
|
|
||||||
echo '<hr />';
|
echo '<hr />';
|
||||||
|
|
||||||
$sheetData = $objPHPExcel->getActiveSheet()->toArray(null, true, true, true);
|
$sheetData = $objPHPExcel->getActiveSheet()->toArray(null, true, true, true);
|
||||||
var_dump($sheetData);
|
var_dump($sheetData);
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<body>
|
<body>
|
||||||
</html>
|
</html>
|
|
@ -5,8 +5,7 @@ set_time_limit(0);
|
||||||
|
|
||||||
date_default_timezone_set('Europe/London');
|
date_default_timezone_set('Europe/London');
|
||||||
|
|
||||||
|
/* Include path **/
|
||||||
/** Include path **/
|
|
||||||
set_include_path(get_include_path() . PATH_SEPARATOR . '../../../Classes/');
|
set_include_path(get_include_path() . PATH_SEPARATOR . '../../../Classes/');
|
||||||
|
|
||||||
/** PHPExcel_IOFactory */
|
/** PHPExcel_IOFactory */
|
||||||
|
@ -38,13 +37,11 @@ $objReader = new PHPExcel_Reader_Excel5();
|
||||||
// $objReader = new PHPExcel_Reader_CSV();
|
// $objReader = new PHPExcel_Reader_CSV();
|
||||||
$objPHPExcel = $objReader->load($inputFileName);
|
$objPHPExcel = $objReader->load($inputFileName);
|
||||||
|
|
||||||
|
|
||||||
echo '<hr />';
|
echo '<hr />';
|
||||||
|
|
||||||
$sheetData = $objPHPExcel->getActiveSheet()->toArray(null, true, true, true);
|
$sheetData = $objPHPExcel->getActiveSheet()->toArray(null, true, true, true);
|
||||||
var_dump($sheetData);
|
var_dump($sheetData);
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<body>
|
<body>
|
||||||
</html>
|
</html>
|
|
@ -25,7 +25,6 @@ set_include_path(get_include_path() . PATH_SEPARATOR . '../../../Classes/');
|
||||||
/** PHPExcel_IOFactory */
|
/** PHPExcel_IOFactory */
|
||||||
include 'PHPExcel/IOFactory.php';
|
include 'PHPExcel/IOFactory.php';
|
||||||
|
|
||||||
|
|
||||||
$inputFileType = 'Xls';
|
$inputFileType = 'Xls';
|
||||||
// $inputFileType = 'Xlsx';
|
// $inputFileType = 'Xlsx';
|
||||||
// $inputFileType = 'Excel2003XML';
|
// $inputFileType = 'Excel2003XML';
|
||||||
|
@ -39,13 +38,11 @@ echo 'Loading file ',pathinfo($inputFileName,PATHINFO_BASENAME),' using IOFactor
|
||||||
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
|
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
|
||||||
$objPHPExcel = $objReader->load($inputFileName);
|
$objPHPExcel = $objReader->load($inputFileName);
|
||||||
|
|
||||||
|
|
||||||
echo '<hr />';
|
echo '<hr />';
|
||||||
|
|
||||||
$sheetData = $objPHPExcel->getActiveSheet()->toArray(null, true, true, true);
|
$sheetData = $objPHPExcel->getActiveSheet()->toArray(null, true, true, true);
|
||||||
var_dump($sheetData);
|
var_dump($sheetData);
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<body>
|
<body>
|
||||||
</html>
|
</html>
|
|
@ -25,7 +25,6 @@ set_include_path(get_include_path() . PATH_SEPARATOR . '../../../Classes/');
|
||||||
/** PHPExcel_IOFactory */
|
/** PHPExcel_IOFactory */
|
||||||
include 'PHPExcel/IOFactory.php';
|
include 'PHPExcel/IOFactory.php';
|
||||||
|
|
||||||
|
|
||||||
$inputFileName = './sampleData/example1.xls';
|
$inputFileName = './sampleData/example1.xls';
|
||||||
|
|
||||||
$inputFileType = PHPExcel_IOFactory::identify($inputFileName);
|
$inputFileType = PHPExcel_IOFactory::identify($inputFileName);
|
||||||
|
@ -35,13 +34,11 @@ echo 'Loading file ',pathinfo($inputFileName,PATHINFO_BASENAME),' using IOFactor
|
||||||
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
|
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
|
||||||
$objPHPExcel = $objReader->load($inputFileName);
|
$objPHPExcel = $objReader->load($inputFileName);
|
||||||
|
|
||||||
|
|
||||||
echo '<hr />';
|
echo '<hr />';
|
||||||
|
|
||||||
$sheetData = $objPHPExcel->getActiveSheet()->toArray(null, true, true, true);
|
$sheetData = $objPHPExcel->getActiveSheet()->toArray(null, true, true, true);
|
||||||
var_dump($sheetData);
|
var_dump($sheetData);
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<body>
|
<body>
|
||||||
</html>
|
</html>
|
|
@ -25,7 +25,6 @@ set_include_path(get_include_path() . PATH_SEPARATOR . '../../../Classes/');
|
||||||
/** PHPExcel_IOFactory */
|
/** PHPExcel_IOFactory */
|
||||||
include 'PHPExcel/IOFactory.php';
|
include 'PHPExcel/IOFactory.php';
|
||||||
|
|
||||||
|
|
||||||
$inputFileType = 'Xls';
|
$inputFileType = 'Xls';
|
||||||
// $inputFileType = 'Xlsx';
|
// $inputFileType = 'Xlsx';
|
||||||
// $inputFileType = 'Excel2003XML';
|
// $inputFileType = 'Excel2003XML';
|
||||||
|
@ -39,13 +38,11 @@ echo 'Turning Formatting off for Load<br />';
|
||||||
$objReader->setReadDataOnly(true);
|
$objReader->setReadDataOnly(true);
|
||||||
$objPHPExcel = $objReader->load($inputFileName);
|
$objPHPExcel = $objReader->load($inputFileName);
|
||||||
|
|
||||||
|
|
||||||
echo '<hr />';
|
echo '<hr />';
|
||||||
|
|
||||||
$sheetData = $objPHPExcel->getActiveSheet()->toArray(null, true, true, true);
|
$sheetData = $objPHPExcel->getActiveSheet()->toArray(null, true, true, true);
|
||||||
var_dump($sheetData);
|
var_dump($sheetData);
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<body>
|
<body>
|
||||||
</html>
|
</html>
|
|
@ -25,7 +25,6 @@ set_include_path(get_include_path() . PATH_SEPARATOR . '../../../Classes/');
|
||||||
/** PHPExcel_IOFactory */
|
/** PHPExcel_IOFactory */
|
||||||
include 'PHPExcel/IOFactory.php';
|
include 'PHPExcel/IOFactory.php';
|
||||||
|
|
||||||
|
|
||||||
$inputFileType = 'Xls';
|
$inputFileType = 'Xls';
|
||||||
// $inputFileType = 'Xlsx';
|
// $inputFileType = 'Xlsx';
|
||||||
// $inputFileType = 'Excel2003XML';
|
// $inputFileType = 'Excel2003XML';
|
||||||
|
@ -39,7 +38,6 @@ echo 'Loading all WorkSheets<br />';
|
||||||
$objReader->setLoadAllSheets();
|
$objReader->setLoadAllSheets();
|
||||||
$objPHPExcel = $objReader->load($inputFileName);
|
$objPHPExcel = $objReader->load($inputFileName);
|
||||||
|
|
||||||
|
|
||||||
echo '<hr />';
|
echo '<hr />';
|
||||||
|
|
||||||
echo $objPHPExcel->getSheetCount(),' worksheet',(($objPHPExcel->getSheetCount() == 1) ? '' : 's'),' loaded<br /><br />';
|
echo $objPHPExcel->getSheetCount(),' worksheet',(($objPHPExcel->getSheetCount() == 1) ? '' : 's'),' loaded<br /><br />';
|
||||||
|
@ -48,7 +46,6 @@ foreach($loadedSheetNames as $sheetIndex => $loadedSheetName) {
|
||||||
echo $sheetIndex,' -> ',$loadedSheetName,'<br />';
|
echo $sheetIndex,' -> ',$loadedSheetName,'<br />';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<body>
|
<body>
|
||||||
</html>
|
</html>
|
|
@ -25,7 +25,6 @@ set_include_path(get_include_path() . PATH_SEPARATOR . '../../../Classes/');
|
||||||
/** PHPExcel_IOFactory */
|
/** PHPExcel_IOFactory */
|
||||||
include 'PHPExcel/IOFactory.php';
|
include 'PHPExcel/IOFactory.php';
|
||||||
|
|
||||||
|
|
||||||
$inputFileType = 'Xls';
|
$inputFileType = 'Xls';
|
||||||
// $inputFileType = 'Xlsx';
|
// $inputFileType = 'Xlsx';
|
||||||
// $inputFileType = 'Excel2003XML';
|
// $inputFileType = 'Excel2003XML';
|
||||||
|
@ -40,7 +39,6 @@ echo 'Loading Sheet "',$sheetname,'" only<br />';
|
||||||
$objReader->setLoadSheetsOnly($sheetname);
|
$objReader->setLoadSheetsOnly($sheetname);
|
||||||
$objPHPExcel = $objReader->load($inputFileName);
|
$objPHPExcel = $objReader->load($inputFileName);
|
||||||
|
|
||||||
|
|
||||||
echo '<hr />';
|
echo '<hr />';
|
||||||
|
|
||||||
echo $objPHPExcel->getSheetCount(),' worksheet',(($objPHPExcel->getSheetCount() == 1) ? '' : 's'),' loaded<br /><br />';
|
echo $objPHPExcel->getSheetCount(),' worksheet',(($objPHPExcel->getSheetCount() == 1) ? '' : 's'),' loaded<br /><br />';
|
||||||
|
@ -49,7 +47,6 @@ foreach($loadedSheetNames as $sheetIndex => $loadedSheetName) {
|
||||||
echo $sheetIndex,' -> ',$loadedSheetName,'<br />';
|
echo $sheetIndex,' -> ',$loadedSheetName,'<br />';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<body>
|
<body>
|
||||||
</html>
|
</html>
|
|
@ -25,14 +25,13 @@ set_include_path(get_include_path() . PATH_SEPARATOR . '../../../Classes/');
|
||||||
/** PHPExcel_IOFactory */
|
/** PHPExcel_IOFactory */
|
||||||
include 'PHPExcel/IOFactory.php';
|
include 'PHPExcel/IOFactory.php';
|
||||||
|
|
||||||
|
|
||||||
$inputFileType = 'Xls';
|
$inputFileType = 'Xls';
|
||||||
// $inputFileType = 'Xlsx';
|
// $inputFileType = 'Xlsx';
|
||||||
// $inputFileType = 'Excel2003XML';
|
// $inputFileType = 'Excel2003XML';
|
||||||
// $inputFileType = 'Ods';
|
// $inputFileType = 'Ods';
|
||||||
// $inputFileType = 'Gnumeric';
|
// $inputFileType = 'Gnumeric';
|
||||||
$inputFileName = './sampleData/example1.xls';
|
$inputFileName = './sampleData/example1.xls';
|
||||||
$sheetnames = array('Data Sheet #1','Data Sheet #3');
|
$sheetnames = ['Data Sheet #1', 'Data Sheet #3'];
|
||||||
|
|
||||||
echo 'Loading file ',pathinfo($inputFileName, PATHINFO_BASENAME),' using IOFactory with a defined reader type of ',$inputFileType,'<br />';
|
echo 'Loading file ',pathinfo($inputFileName, PATHINFO_BASENAME),' using IOFactory with a defined reader type of ',$inputFileType,'<br />';
|
||||||
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
|
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
|
||||||
|
@ -40,7 +39,6 @@ echo 'Loading Sheet',((count($sheetnames) == 1) ? '' : 's'),' "',implode('" and
|
||||||
$objReader->setLoadSheetsOnly($sheetnames);
|
$objReader->setLoadSheetsOnly($sheetnames);
|
||||||
$objPHPExcel = $objReader->load($inputFileName);
|
$objPHPExcel = $objReader->load($inputFileName);
|
||||||
|
|
||||||
|
|
||||||
echo '<hr />';
|
echo '<hr />';
|
||||||
|
|
||||||
echo $objPHPExcel->getSheetCount(),' worksheet',(($objPHPExcel->getSheetCount() == 1) ? '' : 's'),' loaded<br /><br />';
|
echo $objPHPExcel->getSheetCount(),' worksheet',(($objPHPExcel->getSheetCount() == 1) ? '' : 's'),' loaded<br /><br />';
|
||||||
|
@ -49,7 +47,6 @@ foreach($loadedSheetNames as $sheetIndex => $loadedSheetName) {
|
||||||
echo $sheetIndex,' -> ',$loadedSheetName,'<br />';
|
echo $sheetIndex,' -> ',$loadedSheetName,'<br />';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<body>
|
<body>
|
||||||
</html>
|
</html>
|
|
@ -25,7 +25,6 @@ set_include_path(get_include_path() . PATH_SEPARATOR . '../../../Classes/');
|
||||||
/** PHPExcel_IOFactory */
|
/** PHPExcel_IOFactory */
|
||||||
include 'PHPExcel/IOFactory.php';
|
include 'PHPExcel/IOFactory.php';
|
||||||
|
|
||||||
|
|
||||||
$inputFileType = 'Xls';
|
$inputFileType = 'Xls';
|
||||||
// $inputFileType = 'Xlsx';
|
// $inputFileType = 'Xlsx';
|
||||||
// $inputFileType = 'Excel2003XML';
|
// $inputFileType = 'Excel2003XML';
|
||||||
|
@ -34,23 +33,23 @@ $inputFileType = 'Xls';
|
||||||
$inputFileName = './sampleData/example1.xls';
|
$inputFileName = './sampleData/example1.xls';
|
||||||
$sheetname = 'Data Sheet #3';
|
$sheetname = 'Data Sheet #3';
|
||||||
|
|
||||||
|
|
||||||
class MyReadFilter implements PHPExcel_Reader_IReadFilter
|
class MyReadFilter implements PHPExcel_Reader_IReadFilter
|
||||||
{
|
{
|
||||||
public function readCell($column, $row, $worksheetName = '') {
|
public function readCell($column, $row, $worksheetName = '')
|
||||||
|
{
|
||||||
// Read rows 1 to 7 and columns A to E only
|
// Read rows 1 to 7 and columns A to E only
|
||||||
if ($row >= 1 && $row <= 7) {
|
if ($row >= 1 && $row <= 7) {
|
||||||
if (in_array($column, range('A', 'E'))) {
|
if (in_array($column, range('A', 'E'))) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$filterSubset = new MyReadFilter();
|
$filterSubset = new MyReadFilter();
|
||||||
|
|
||||||
|
|
||||||
echo 'Loading file ',pathinfo($inputFileName, PATHINFO_BASENAME),' using IOFactory with a defined reader type of ',$inputFileType,'<br />';
|
echo 'Loading file ',pathinfo($inputFileName, PATHINFO_BASENAME),' using IOFactory with a defined reader type of ',$inputFileType,'<br />';
|
||||||
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
|
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
|
||||||
echo 'Loading Sheet "',$sheetname,'" only<br />';
|
echo 'Loading Sheet "',$sheetname,'" only<br />';
|
||||||
|
@ -59,13 +58,11 @@ echo 'Loading Sheet using filter<br />';
|
||||||
$objReader->setReadFilter($filterSubset);
|
$objReader->setReadFilter($filterSubset);
|
||||||
$objPHPExcel = $objReader->load($inputFileName);
|
$objPHPExcel = $objReader->load($inputFileName);
|
||||||
|
|
||||||
|
|
||||||
echo '<hr />';
|
echo '<hr />';
|
||||||
|
|
||||||
$sheetData = $objPHPExcel->getActiveSheet()->toArray(null, true, true, true);
|
$sheetData = $objPHPExcel->getActiveSheet()->toArray(null, true, true, true);
|
||||||
var_dump($sheetData);
|
var_dump($sheetData);
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<body>
|
<body>
|
||||||
</html>
|
</html>
|
|
@ -25,7 +25,6 @@ set_include_path(get_include_path() . PATH_SEPARATOR . '../../../Classes/');
|
||||||
/** PHPExcel_IOFactory */
|
/** PHPExcel_IOFactory */
|
||||||
include 'PHPExcel/IOFactory.php';
|
include 'PHPExcel/IOFactory.php';
|
||||||
|
|
||||||
|
|
||||||
$inputFileType = 'Xls';
|
$inputFileType = 'Xls';
|
||||||
// $inputFileType = 'Xlsx';
|
// $inputFileType = 'Xlsx';
|
||||||
// $inputFileType = 'Excel2003XML';
|
// $inputFileType = 'Excel2003XML';
|
||||||
|
@ -34,34 +33,35 @@ $inputFileType = 'Xls';
|
||||||
$inputFileName = './sampleData/example1.xls';
|
$inputFileName = './sampleData/example1.xls';
|
||||||
$sheetname = 'Data Sheet #3';
|
$sheetname = 'Data Sheet #3';
|
||||||
|
|
||||||
|
|
||||||
class MyReadFilter implements PHPExcel_Reader_IReadFilter
|
class MyReadFilter implements PHPExcel_Reader_IReadFilter
|
||||||
{
|
{
|
||||||
private $_startRow = 0;
|
private $_startRow = 0;
|
||||||
|
|
||||||
private $_endRow = 0;
|
private $_endRow = 0;
|
||||||
|
|
||||||
private $_columns = array();
|
private $_columns = [];
|
||||||
|
|
||||||
public function __construct($startRow, $endRow, $columns) {
|
public function __construct($startRow, $endRow, $columns)
|
||||||
|
{
|
||||||
$this->_startRow = $startRow;
|
$this->_startRow = $startRow;
|
||||||
$this->_endRow = $endRow;
|
$this->_endRow = $endRow;
|
||||||
$this->_columns = $columns;
|
$this->_columns = $columns;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function readCell($column, $row, $worksheetName = '') {
|
public function readCell($column, $row, $worksheetName = '')
|
||||||
|
{
|
||||||
if ($row >= $this->_startRow && $row <= $this->_endRow) {
|
if ($row >= $this->_startRow && $row <= $this->_endRow) {
|
||||||
if (in_array($column, $this->_columns)) {
|
if (in_array($column, $this->_columns)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$filterSubset = new MyReadFilter(9, 15, range('G', 'K'));
|
$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 />';
|
echo 'Loading file ',pathinfo($inputFileName, PATHINFO_BASENAME),' using IOFactory with a defined reader type of ',$inputFileType,'<br />';
|
||||||
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
|
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
|
||||||
echo 'Loading Sheet "',$sheetname,'" only<br />';
|
echo 'Loading Sheet "',$sheetname,'" only<br />';
|
||||||
|
@ -70,13 +70,11 @@ echo 'Loading Sheet using configurable filter<br />';
|
||||||
$objReader->setReadFilter($filterSubset);
|
$objReader->setReadFilter($filterSubset);
|
||||||
$objPHPExcel = $objReader->load($inputFileName);
|
$objPHPExcel = $objReader->load($inputFileName);
|
||||||
|
|
||||||
|
|
||||||
echo '<hr />';
|
echo '<hr />';
|
||||||
|
|
||||||
$sheetData = $objPHPExcel->getActiveSheet()->toArray(null, true, true, true);
|
$sheetData = $objPHPExcel->getActiveSheet()->toArray(null, true, true, true);
|
||||||
var_dump($sheetData);
|
var_dump($sheetData);
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<body>
|
<body>
|
||||||
</html>
|
</html>
|
|
@ -25,7 +25,6 @@ set_include_path(get_include_path() . PATH_SEPARATOR . '../../../Classes/');
|
||||||
/** PHPExcel_IOFactory */
|
/** PHPExcel_IOFactory */
|
||||||
include 'PHPExcel/IOFactory.php';
|
include 'PHPExcel/IOFactory.php';
|
||||||
|
|
||||||
|
|
||||||
$inputFileType = 'Xls';
|
$inputFileType = 'Xls';
|
||||||
// $inputFileType = 'Xlsx';
|
// $inputFileType = 'Xlsx';
|
||||||
// $inputFileType = 'Excel2003XML';
|
// $inputFileType = 'Excel2003XML';
|
||||||
|
@ -33,7 +32,6 @@ $inputFileType = 'Xls';
|
||||||
// $inputFileType = 'Gnumeric';
|
// $inputFileType = 'Gnumeric';
|
||||||
$inputFileName = './sampleData/example2.xls';
|
$inputFileName = './sampleData/example2.xls';
|
||||||
|
|
||||||
|
|
||||||
/** Define a Read Filter class implementing PHPExcel_Reader_IReadFilter */
|
/** Define a Read Filter class implementing PHPExcel_Reader_IReadFilter */
|
||||||
class chunkReadFilter implements PHPExcel_Reader_IReadFilter
|
class chunkReadFilter implements PHPExcel_Reader_IReadFilter
|
||||||
{
|
{
|
||||||
|
@ -42,40 +40,40 @@ class chunkReadFilter implements PHPExcel_Reader_IReadFilter
|
||||||
private $_endRow = 0;
|
private $_endRow = 0;
|
||||||
|
|
||||||
/** We expect a list of the rows that we want to read to be passed into the constructor */
|
/** We expect a list of the rows that we want to read to be passed into the constructor */
|
||||||
public function __construct($startRow, $chunkSize) {
|
public function __construct($startRow, $chunkSize)
|
||||||
|
{
|
||||||
$this->_startRow = $startRow;
|
$this->_startRow = $startRow;
|
||||||
$this->_endRow = $startRow + $chunkSize;
|
$this->_endRow = $startRow + $chunkSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function readCell($column, $row, $worksheetName = '') {
|
public function readCell($column, $row, $worksheetName = '')
|
||||||
|
{
|
||||||
// Only read the heading row, and the rows that were configured in the constructor
|
// Only read the heading row, and the rows that were configured in the constructor
|
||||||
if (($row == 1) || ($row >= $this->_startRow && $row < $this->_endRow)) {
|
if (($row == 1) || ($row >= $this->_startRow && $row < $this->_endRow)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
echo 'Loading file ',pathinfo($inputFileName, PATHINFO_BASENAME),' using IOFactory with a defined reader type of ',$inputFileType,'<br />';
|
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 **/
|
/* Create a new Reader of the type defined in $inputFileType **/
|
||||||
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
|
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
|
||||||
|
|
||||||
|
|
||||||
echo '<hr />';
|
echo '<hr />';
|
||||||
|
|
||||||
|
/* Define how many rows we want for each "chunk" **/
|
||||||
/** Define how many rows we want for each "chunk" **/
|
|
||||||
$chunkSize = 20;
|
$chunkSize = 20;
|
||||||
|
|
||||||
/** Loop to read our worksheet in "chunk size" blocks **/
|
/* Loop to read our worksheet in "chunk size" blocks **/
|
||||||
for ($startRow = 2; $startRow <= 240; $startRow += $chunkSize) {
|
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 />';
|
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 **/
|
/* Create a new Instance of our Read Filter, passing in the limits on which rows we want to read **/
|
||||||
$chunkFilter = new chunkReadFilter($startRow, $chunkSize);
|
$chunkFilter = new chunkReadFilter($startRow, $chunkSize);
|
||||||
/** Tell the Reader that we want to use the new Read Filter that we've just Instantiated **/
|
/* Tell the Reader that we want to use the new Read Filter that we've just Instantiated **/
|
||||||
$objReader->setReadFilter($chunkFilter);
|
$objReader->setReadFilter($chunkFilter);
|
||||||
/** Load only the rows that match our filter from $inputFileName to a PHPExcel Object **/
|
/* Load only the rows that match our filter from $inputFileName to a PHPExcel Object **/
|
||||||
$objPHPExcel = $objReader->load($inputFileName);
|
$objPHPExcel = $objReader->load($inputFileName);
|
||||||
|
|
||||||
// Do some processing here
|
// Do some processing here
|
||||||
|
@ -85,7 +83,6 @@ for ($startRow = 2; $startRow <= 240; $startRow += $chunkSize) {
|
||||||
echo '<br /><br />';
|
echo '<br /><br />';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<body>
|
<body>
|
||||||
</html>
|
</html>
|
|
@ -25,7 +25,6 @@ set_include_path(get_include_path() . PATH_SEPARATOR . '../../../Classes/');
|
||||||
/** Include PHPExcel_IOFactory **/
|
/** Include PHPExcel_IOFactory **/
|
||||||
include 'PHPExcel/IOFactory.php';
|
include 'PHPExcel/IOFactory.php';
|
||||||
|
|
||||||
|
|
||||||
$inputFileType = 'Xls';
|
$inputFileType = 'Xls';
|
||||||
// $inputFileType = 'Xlsx';
|
// $inputFileType = 'Xlsx';
|
||||||
// $inputFileType = 'Excel2003XML';
|
// $inputFileType = 'Excel2003XML';
|
||||||
|
@ -33,7 +32,6 @@ $inputFileType = 'Xls';
|
||||||
// $inputFileType = 'Gnumeric';
|
// $inputFileType = 'Gnumeric';
|
||||||
$inputFileName = './sampleData/example2.xls';
|
$inputFileName = './sampleData/example2.xls';
|
||||||
|
|
||||||
|
|
||||||
/** Define a Read Filter class implementing PHPExcel_Reader_IReadFilter */
|
/** Define a Read Filter class implementing PHPExcel_Reader_IReadFilter */
|
||||||
class chunkReadFilter implements PHPExcel_Reader_IReadFilter
|
class chunkReadFilter implements PHPExcel_Reader_IReadFilter
|
||||||
{
|
{
|
||||||
|
@ -42,43 +40,43 @@ class chunkReadFilter implements PHPExcel_Reader_IReadFilter
|
||||||
private $_endRow = 0;
|
private $_endRow = 0;
|
||||||
|
|
||||||
/** Set the list of rows that we want to read */
|
/** Set the list of rows that we want to read */
|
||||||
public function setRows($startRow, $chunkSize) {
|
public function setRows($startRow, $chunkSize)
|
||||||
|
{
|
||||||
$this->_startRow = $startRow;
|
$this->_startRow = $startRow;
|
||||||
$this->_endRow = $startRow + $chunkSize;
|
$this->_endRow = $startRow + $chunkSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function readCell($column, $row, $worksheetName = '') {
|
public function readCell($column, $row, $worksheetName = '')
|
||||||
|
{
|
||||||
// Only read the heading row, and the rows that are configured in $this->_startRow and $this->_endRow
|
// 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)) {
|
if (($row == 1) || ($row >= $this->_startRow && $row < $this->_endRow)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
echo 'Loading file ',pathinfo($inputFileName, PATHINFO_BASENAME),' using IOFactory with a defined reader type of ',$inputFileType,'<br />';
|
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 **/
|
/* Create a new Reader of the type defined in $inputFileType **/
|
||||||
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
|
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
|
||||||
|
|
||||||
|
|
||||||
echo '<hr />';
|
echo '<hr />';
|
||||||
|
|
||||||
|
/* Define how many rows we want to read for each "chunk" **/
|
||||||
/** Define how many rows we want to read for each "chunk" **/
|
|
||||||
$chunkSize = 20;
|
$chunkSize = 20;
|
||||||
/** Create a new Instance of our Read Filter **/
|
/* Create a new Instance of our Read Filter **/
|
||||||
$chunkFilter = new chunkReadFilter();
|
$chunkFilter = new chunkReadFilter();
|
||||||
|
|
||||||
/** Tell the Reader that we want to use the Read Filter that we've Instantiated **/
|
/* Tell the Reader that we want to use the Read Filter that we've Instantiated **/
|
||||||
$objReader->setReadFilter($chunkFilter);
|
$objReader->setReadFilter($chunkFilter);
|
||||||
|
|
||||||
/** Loop to read our worksheet in "chunk size" blocks **/
|
/* Loop to read our worksheet in "chunk size" blocks **/
|
||||||
for ($startRow = 2; $startRow <= 240; $startRow += $chunkSize) {
|
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 />';
|
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 **/
|
/* Tell the Read Filter, the limits on which rows we want to read this iteration **/
|
||||||
$chunkFilter->setRows($startRow, $chunkSize);
|
$chunkFilter->setRows($startRow, $chunkSize);
|
||||||
/** Load only the rows that match our filter from $inputFileName to a PHPExcel Object **/
|
/* Load only the rows that match our filter from $inputFileName to a PHPExcel Object **/
|
||||||
$objPHPExcel = $objReader->load($inputFileName);
|
$objPHPExcel = $objReader->load($inputFileName);
|
||||||
|
|
||||||
// Do some processing here
|
// Do some processing here
|
||||||
|
@ -88,7 +86,6 @@ for ($startRow = 2; $startRow <= 240; $startRow += $chunkSize) {
|
||||||
echo '<br /><br />';
|
echo '<br /><br />';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<body>
|
<body>
|
||||||
</html>
|
</html>
|
|
@ -25,9 +25,8 @@ set_include_path(get_include_path() . PATH_SEPARATOR . '../../../Classes/');
|
||||||
/** PHPExcel_IOFactory */
|
/** PHPExcel_IOFactory */
|
||||||
include 'PHPExcel/IOFactory.php';
|
include 'PHPExcel/IOFactory.php';
|
||||||
|
|
||||||
|
|
||||||
$inputFileType = 'CSV';
|
$inputFileType = 'CSV';
|
||||||
$inputFileNames = array('./sampleData/example1.csv','./sampleData/example2.csv');
|
$inputFileNames = ['./sampleData/example1.csv', './sampleData/example2.csv'];
|
||||||
|
|
||||||
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
|
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
|
||||||
$inputFileName = array_shift($inputFileNames);
|
$inputFileName = array_shift($inputFileNames);
|
||||||
|
@ -41,7 +40,6 @@ foreach($inputFileNames as $sheet => $inputFileName) {
|
||||||
$objPHPExcel->getActiveSheet()->setTitle(pathinfo($inputFileName, PATHINFO_BASENAME));
|
$objPHPExcel->getActiveSheet()->setTitle(pathinfo($inputFileName, PATHINFO_BASENAME));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
echo '<hr />';
|
echo '<hr />';
|
||||||
|
|
||||||
echo $objPHPExcel->getSheetCount(),' worksheet',(($objPHPExcel->getSheetCount() == 1) ? '' : 's'),' loaded<br /><br />';
|
echo $objPHPExcel->getSheetCount(),' worksheet',(($objPHPExcel->getSheetCount() == 1) ? '' : 's'),' loaded<br /><br />';
|
||||||
|
@ -54,7 +52,6 @@ foreach($loadedSheetNames as $sheetIndex => $loadedSheetName) {
|
||||||
echo '<br /><br />';
|
echo '<br /><br />';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<body>
|
<body>
|
||||||
</html>
|
</html>
|
|
@ -20,7 +20,6 @@ set_include_path(get_include_path() . PATH_SEPARATOR . '../../../Classes/');
|
||||||
/** PHPExcel_IOFactory */
|
/** PHPExcel_IOFactory */
|
||||||
include 'PHPExcel/IOFactory.php';
|
include 'PHPExcel/IOFactory.php';
|
||||||
|
|
||||||
|
|
||||||
$inputFileType = 'CSV';
|
$inputFileType = 'CSV';
|
||||||
$inputFileName = './sampleData/example2.csv';
|
$inputFileName = './sampleData/example2.csv';
|
||||||
|
|
||||||
|
@ -32,62 +31,60 @@ class chunkReadFilter implements PHPExcel_Reader_IReadFilter
|
||||||
private $_endRow = 0;
|
private $_endRow = 0;
|
||||||
|
|
||||||
/** Set the list of rows that we want to read */
|
/** Set the list of rows that we want to read */
|
||||||
public function setRows($startRow, $chunkSize) {
|
public function setRows($startRow, $chunkSize)
|
||||||
|
{
|
||||||
$this->_startRow = $startRow;
|
$this->_startRow = $startRow;
|
||||||
$this->_endRow = $startRow + $chunkSize;
|
$this->_endRow = $startRow + $chunkSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function readCell($column, $row, $worksheetName = '') {
|
public function readCell($column, $row, $worksheetName = '')
|
||||||
|
{
|
||||||
// Only read the heading row, and the rows that are configured in $this->_startRow and $this->_endRow
|
// 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)) {
|
if (($row == 1) || ($row >= $this->_startRow && $row < $this->_endRow)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
echo 'Loading file ',pathinfo($inputFileName, PATHINFO_BASENAME),' using IOFactory with a defined reader type of ',$inputFileType,'<br />';
|
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 **/
|
/* Create a new Reader of the type defined in $inputFileType **/
|
||||||
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
|
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
|
||||||
|
|
||||||
|
|
||||||
echo '<hr />';
|
echo '<hr />';
|
||||||
|
|
||||||
|
/* Define how many rows we want to read for each "chunk" **/
|
||||||
/** Define how many rows we want to read for each "chunk" **/
|
|
||||||
$chunkSize = 100;
|
$chunkSize = 100;
|
||||||
/** Create a new Instance of our Read Filter **/
|
/* Create a new Instance of our Read Filter **/
|
||||||
$chunkFilter = new chunkReadFilter();
|
$chunkFilter = new chunkReadFilter();
|
||||||
|
|
||||||
/** Tell the Reader that we want to use the Read Filter that we've Instantiated **/
|
/* 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 **/
|
/* and that we want to store it in contiguous rows/columns **/
|
||||||
$objReader->setReadFilter($chunkFilter)
|
$objReader->setReadFilter($chunkFilter)
|
||||||
->setContiguous(true);
|
->setContiguous(true);
|
||||||
|
|
||||||
|
/* Instantiate a new PHPExcel object manually **/
|
||||||
/** Instantiate a new PHPExcel object manually **/
|
|
||||||
$objPHPExcel = new PHPExcel();
|
$objPHPExcel = new PHPExcel();
|
||||||
|
|
||||||
/** Set a sheet index **/
|
/* Set a sheet index **/
|
||||||
$sheet = 0;
|
$sheet = 0;
|
||||||
/** Loop to read our worksheet in "chunk size" blocks **/
|
/* Loop to read our worksheet in "chunk size" blocks **/
|
||||||
/** $startRow is set to 2 initially because we always read the headings in row #1 **/
|
/** $startRow is set to 2 initially because we always read the headings in row #1 **/
|
||||||
for ($startRow = 2; $startRow <= 240; $startRow += $chunkSize) {
|
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 />';
|
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 **/
|
/* Tell the Read Filter, the limits on which rows we want to read this iteration **/
|
||||||
$chunkFilter->setRows($startRow, $chunkSize);
|
$chunkFilter->setRows($startRow, $chunkSize);
|
||||||
|
|
||||||
/** Increment the worksheet index pointer for the Reader **/
|
/* Increment the worksheet index pointer for the Reader **/
|
||||||
$objReader->setSheetIndex($sheet);
|
$objReader->setSheetIndex($sheet);
|
||||||
/** Load only the rows that match our filter into a new worksheet in the PHPExcel Object **/
|
/* Load only the rows that match our filter into a new worksheet in the PHPExcel Object **/
|
||||||
$objReader->loadIntoExisting($inputFileName, $objPHPExcel);
|
$objReader->loadIntoExisting($inputFileName, $objPHPExcel);
|
||||||
/** Set the worksheet title (to reference the "sheet" of data that we've loaded) **/
|
/* Set the worksheet title (to reference the "sheet" of data that we've loaded) **/
|
||||||
/** and increment the sheet index as well **/
|
/* and increment the sheet index as well **/
|
||||||
$objPHPExcel->getActiveSheet()->setTitle('Country Data #' . (++$sheet));
|
$objPHPExcel->getActiveSheet()->setTitle('Country Data #' . (++$sheet));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
echo '<hr />';
|
echo '<hr />';
|
||||||
|
|
||||||
echo $objPHPExcel->getSheetCount(),' worksheet',(($objPHPExcel->getSheetCount() == 1) ? '' : 's'),' loaded<br /><br />';
|
echo $objPHPExcel->getSheetCount(),' worksheet',(($objPHPExcel->getSheetCount() == 1) ? '' : 's'),' loaded<br /><br />';
|
||||||
|
|
|
@ -20,10 +20,8 @@ set_include_path(get_include_path() . PATH_SEPARATOR . '../../../Classes/');
|
||||||
/** PHPExcel_IOFactory */
|
/** PHPExcel_IOFactory */
|
||||||
include 'PHPExcel/IOFactory.php';
|
include 'PHPExcel/IOFactory.php';
|
||||||
|
|
||||||
|
|
||||||
PHPExcel_Cell::setValueBinder(new PHPExcel_Cell_AdvancedValueBinder());
|
PHPExcel_Cell::setValueBinder(new PHPExcel_Cell_AdvancedValueBinder());
|
||||||
|
|
||||||
|
|
||||||
$inputFileType = 'CSV';
|
$inputFileType = 'CSV';
|
||||||
$inputFileName = './sampleData/example1.tsv';
|
$inputFileName = './sampleData/example1.tsv';
|
||||||
|
|
||||||
|
@ -33,7 +31,6 @@ $objReader->setDelimiter("\t");
|
||||||
$objPHPExcel = $objReader->load($inputFileName);
|
$objPHPExcel = $objReader->load($inputFileName);
|
||||||
$objPHPExcel->getActiveSheet()->setTitle(pathinfo($inputFileName, PATHINFO_BASENAME));
|
$objPHPExcel->getActiveSheet()->setTitle(pathinfo($inputFileName, PATHINFO_BASENAME));
|
||||||
|
|
||||||
|
|
||||||
echo '<hr />';
|
echo '<hr />';
|
||||||
|
|
||||||
echo $objPHPExcel->getSheetCount(),' worksheet',(($objPHPExcel->getSheetCount() == 1) ? '' : 's'),' loaded<br /><br />';
|
echo $objPHPExcel->getSheetCount(),' worksheet',(($objPHPExcel->getSheetCount() == 1) ? '' : 's'),' loaded<br /><br />';
|
||||||
|
|
|
@ -25,7 +25,6 @@ set_include_path(get_include_path() . PATH_SEPARATOR . '../../../Classes/');
|
||||||
/** PHPExcel_IOFactory */
|
/** PHPExcel_IOFactory */
|
||||||
include 'PHPExcel/IOFactory.php';
|
include 'PHPExcel/IOFactory.php';
|
||||||
|
|
||||||
|
|
||||||
$inputFileName = './sampleData/example_1.xls';
|
$inputFileName = './sampleData/example_1.xls';
|
||||||
echo 'Loading file ',pathinfo($inputFileName, PATHINFO_BASENAME),' using IOFactory to identify the format<br />';
|
echo 'Loading file ',pathinfo($inputFileName, PATHINFO_BASENAME),' using IOFactory to identify the format<br />';
|
||||||
try {
|
try {
|
||||||
|
@ -34,13 +33,11 @@ try {
|
||||||
die('Error loading file "' . pathinfo($inputFileName, PATHINFO_BASENAME) . '": ' . $e->getMessage());
|
die('Error loading file "' . pathinfo($inputFileName, PATHINFO_BASENAME) . '": ' . $e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
echo '<hr />';
|
echo '<hr />';
|
||||||
|
|
||||||
$sheetData = $objPHPExcel->getActiveSheet()->toArray(null, true, true, true);
|
$sheetData = $objPHPExcel->getActiveSheet()->toArray(null, true, true, true);
|
||||||
var_dump($sheetData);
|
var_dump($sheetData);
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<body>
|
<body>
|
||||||
</html>
|
</html>
|
|
@ -25,7 +25,6 @@ set_include_path(get_include_path() . PATH_SEPARATOR . '../../../Classes/');
|
||||||
/** PHPExcel_IOFactory */
|
/** PHPExcel_IOFactory */
|
||||||
include 'PHPExcel/IOFactory.php';
|
include 'PHPExcel/IOFactory.php';
|
||||||
|
|
||||||
|
|
||||||
$inputFileType = 'Xls';
|
$inputFileType = 'Xls';
|
||||||
// $inputFileType = 'Xlsx';
|
// $inputFileType = 'Xlsx';
|
||||||
// $inputFileType = 'Excel2003XML';
|
// $inputFileType = 'Excel2003XML';
|
||||||
|
@ -36,8 +35,7 @@ $inputFileName = './sampleData/example1.xls';
|
||||||
echo 'Loading file ',pathinfo($inputFileName, PATHINFO_BASENAME),' using IOFactory with a defined reader type of ',$inputFileType,'<br />';
|
echo 'Loading file ',pathinfo($inputFileName, PATHINFO_BASENAME),' using IOFactory with a defined reader type of ',$inputFileType,'<br />';
|
||||||
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
|
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
|
||||||
|
|
||||||
|
/* Read the list of Worksheet Names from the Workbook file **/
|
||||||
/** Read the list of Worksheet Names from the Workbook file **/
|
|
||||||
echo 'Read the list of Worksheets in the WorkBook<br />';
|
echo 'Read the list of Worksheets in the WorkBook<br />';
|
||||||
$worksheetNames = $objReader->listWorksheetNames($inputFileName);
|
$worksheetNames = $objReader->listWorksheetNames($inputFileName);
|
||||||
|
|
||||||
|
@ -46,7 +44,6 @@ foreach($worksheetNames as $worksheetName) {
|
||||||
echo $worksheetName,'<br />';
|
echo $worksheetName,'<br />';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<body>
|
<body>
|
||||||
</html>
|
</html>
|
|
@ -20,7 +20,6 @@ date_default_timezone_set('Europe/London');
|
||||||
$exampleTypeList = glob('./*', GLOB_ONLYDIR);
|
$exampleTypeList = glob('./*', GLOB_ONLYDIR);
|
||||||
|
|
||||||
foreach ($exampleTypeList as $exampleType) {
|
foreach ($exampleTypeList as $exampleType) {
|
||||||
|
|
||||||
echo '<h1>PHPExcel ' . pathinfo($exampleType, PATHINFO_BASENAME) . ' Examples</h1>';
|
echo '<h1>PHPExcel ' . pathinfo($exampleType, PATHINFO_BASENAME) . ' Examples</h1>';
|
||||||
|
|
||||||
$exampleList = glob('./' . $exampleType . '/*.php');
|
$exampleList = glob('./' . $exampleType . '/*.php');
|
||||||
|
@ -41,7 +40,6 @@ foreach($exampleTypeList as $exampleType) {
|
||||||
echo $h2Text,'<br />';
|
echo $h2Text,'<br />';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue