@@ -27,23 +27,23 @@ discard block |
||
27 | 27 | /** Define a Read Filter class implementing PHPExcel_Reader_IReadFilter */ |
28 | 28 | class chunkReadFilter implements PHPExcel_Reader_IReadFilter |
29 | 29 | { |
30 | - private $_startRow = 0; |
|
31 | - |
|
32 | - private $_endRow = 0; |
|
33 | - |
|
34 | - /** Set the list of rows that we want to read */ |
|
35 | - public function setRows($startRow, $chunkSize) { |
|
36 | - $this->_startRow = $startRow; |
|
37 | - $this->_endRow = $startRow + $chunkSize; |
|
38 | - } |
|
39 | - |
|
40 | - public function readCell($column, $row, $worksheetName = '') { |
|
41 | - // Only read the heading row, and the rows that are configured in $this->_startRow and $this->_endRow |
|
42 | - if (($row == 1) || ($row >= $this->_startRow && $row < $this->_endRow)) { |
|
43 | - return true; |
|
44 | - } |
|
45 | - return false; |
|
46 | - } |
|
30 | + private $_startRow = 0; |
|
31 | + |
|
32 | + private $_endRow = 0; |
|
33 | + |
|
34 | + /** Set the list of rows that we want to read */ |
|
35 | + public function setRows($startRow, $chunkSize) { |
|
36 | + $this->_startRow = $startRow; |
|
37 | + $this->_endRow = $startRow + $chunkSize; |
|
38 | + } |
|
39 | + |
|
40 | + public function readCell($column, $row, $worksheetName = '') { |
|
41 | + // Only read the heading row, and the rows that are configured in $this->_startRow and $this->_endRow |
|
42 | + if (($row == 1) || ($row >= $this->_startRow && $row < $this->_endRow)) { |
|
43 | + return true; |
|
44 | + } |
|
45 | + return false; |
|
46 | + } |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | /** Tell the Reader that we want to use the Read Filter that we've Instantiated **/ |
64 | 64 | /** and that we want to store it in contiguous rows/columns **/ |
65 | 65 | $objReader->setReadFilter($chunkFilter) |
66 | - ->setContiguous(true); |
|
66 | + ->setContiguous(true); |
|
67 | 67 | |
68 | 68 | |
69 | 69 | /** Instantiate a new PHPExcel object manually **/ |
@@ -74,13 +74,13 @@ discard block |
||
74 | 74 | /** Loop to read our worksheet in "chunk size" blocks **/ |
75 | 75 | /** $startRow is set to 2 initially because we always read the headings in row #1 **/ |
76 | 76 | for ($startRow = 2; $startRow <= 240; $startRow += $chunkSize) { |
77 | - echo 'Loading WorkSheet #',($sheet+1),' using configurable filter for headings row 1 and for rows ',$startRow,' to ',($startRow+$chunkSize-1),'<br />'; |
|
78 | - /** Tell the Read Filter, the limits on which rows we want to read this iteration **/ |
|
79 | - $chunkFilter->setRows($startRow,$chunkSize); |
|
77 | + echo 'Loading WorkSheet #',($sheet+1),' using configurable filter for headings row 1 and for rows ',$startRow,' to ',($startRow+$chunkSize-1),'<br />'; |
|
78 | + /** Tell the Read Filter, the limits on which rows we want to read this iteration **/ |
|
79 | + $chunkFilter->setRows($startRow,$chunkSize); |
|
80 | 80 | |
81 | 81 | /** Increment the worksheet index pointer for the Reader **/ |
82 | 82 | $objReader->setSheetIndex($sheet); |
83 | - /** Load only the rows that match our filter into a new worksheet in the PHPExcel Object **/ |
|
83 | + /** Load only the rows that match our filter into a new worksheet in the PHPExcel Object **/ |
|
84 | 84 | $objReader->loadIntoExisting($inputFileName,$objPHPExcel); |
85 | 85 | /** Set the worksheet title (to reference the "sheet" of data that we've loaded) **/ |
86 | 86 | /** and increment the sheet index as well **/ |
@@ -93,11 +93,11 @@ discard block |
||
93 | 93 | echo $objPHPExcel->getSheetCount(),' worksheet',(($objPHPExcel->getSheetCount() == 1) ? '' : 's'),' loaded<br /><br />'; |
94 | 94 | $loadedSheetNames = $objPHPExcel->getSheetNames(); |
95 | 95 | foreach($loadedSheetNames as $sheetIndex => $loadedSheetName) { |
96 | - echo '<b>Worksheet #',$sheetIndex,' -> ',$loadedSheetName,'</b><br />'; |
|
97 | - $objPHPExcel->setActiveSheetIndexByName($loadedSheetName); |
|
98 | - $sheetData = $objPHPExcel->getActiveSheet()->toArray(null,false,false,true); |
|
99 | - var_dump($sheetData); |
|
100 | - echo '<br />'; |
|
96 | + echo '<b>Worksheet #',$sheetIndex,' -> ',$loadedSheetName,'</b><br />'; |
|
97 | + $objPHPExcel->setActiveSheetIndexByName($loadedSheetName); |
|
98 | + $sheetData = $objPHPExcel->getActiveSheet()->toArray(null,false,false,true); |
|
99 | + var_dump($sheetData); |
|
100 | + echo '<br />'; |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | ?> |
@@ -33,8 +33,8 @@ discard block |
||
33 | 33 | |
34 | 34 | /** Set the list of rows that we want to read */ |
35 | 35 | public function setRows($startRow, $chunkSize) { |
36 | - $this->_startRow = $startRow; |
|
37 | - $this->_endRow = $startRow + $chunkSize; |
|
36 | + $this->_startRow = $startRow; |
|
37 | + $this->_endRow = $startRow + $chunkSize; |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | public function readCell($column, $row, $worksheetName = '') { |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | } |
48 | 48 | |
49 | 49 | |
50 | -echo 'Loading file ',pathinfo($inputFileName,PATHINFO_BASENAME),' using IOFactory with a defined reader type of ',$inputFileType,'<br />'; |
|
50 | +echo 'Loading file ', pathinfo($inputFileName, PATHINFO_BASENAME), ' using IOFactory with a defined reader type of ', $inputFileType, '<br />'; |
|
51 | 51 | /** Create a new Reader of the type defined in $inputFileType **/ |
52 | 52 | $objReader = PHPExcel_IOFactory::createReader($inputFileType); |
53 | 53 | |
@@ -74,28 +74,28 @@ discard block |
||
74 | 74 | /** Loop to read our worksheet in "chunk size" blocks **/ |
75 | 75 | /** $startRow is set to 2 initially because we always read the headings in row #1 **/ |
76 | 76 | for ($startRow = 2; $startRow <= 240; $startRow += $chunkSize) { |
77 | - echo 'Loading WorkSheet #',($sheet+1),' using configurable filter for headings row 1 and for rows ',$startRow,' to ',($startRow+$chunkSize-1),'<br />'; |
|
77 | + echo 'Loading WorkSheet #', ($sheet + 1), ' using configurable filter for headings row 1 and for rows ', $startRow, ' to ', ($startRow + $chunkSize - 1), '<br />'; |
|
78 | 78 | /** Tell the Read Filter, the limits on which rows we want to read this iteration **/ |
79 | - $chunkFilter->setRows($startRow,$chunkSize); |
|
79 | + $chunkFilter->setRows($startRow, $chunkSize); |
|
80 | 80 | |
81 | 81 | /** Increment the worksheet index pointer for the Reader **/ |
82 | 82 | $objReader->setSheetIndex($sheet); |
83 | 83 | /** Load only the rows that match our filter into a new worksheet in the PHPExcel Object **/ |
84 | - $objReader->loadIntoExisting($inputFileName,$objPHPExcel); |
|
84 | + $objReader->loadIntoExisting($inputFileName, $objPHPExcel); |
|
85 | 85 | /** Set the worksheet title (to reference the "sheet" of data that we've loaded) **/ |
86 | 86 | /** and increment the sheet index as well **/ |
87 | - $objPHPExcel->getActiveSheet()->setTitle('Country Data #'.(++$sheet)); |
|
87 | + $objPHPExcel->getActiveSheet()->setTitle('Country Data #' . (++$sheet)); |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | |
91 | 91 | echo '<hr />'; |
92 | 92 | |
93 | -echo $objPHPExcel->getSheetCount(),' worksheet',(($objPHPExcel->getSheetCount() == 1) ? '' : 's'),' loaded<br /><br />'; |
|
93 | +echo $objPHPExcel->getSheetCount(), ' worksheet', (($objPHPExcel->getSheetCount() == 1) ? '' : 's'), ' loaded<br /><br />'; |
|
94 | 94 | $loadedSheetNames = $objPHPExcel->getSheetNames(); |
95 | -foreach($loadedSheetNames as $sheetIndex => $loadedSheetName) { |
|
96 | - echo '<b>Worksheet #',$sheetIndex,' -> ',$loadedSheetName,'</b><br />'; |
|
95 | +foreach ($loadedSheetNames as $sheetIndex => $loadedSheetName) { |
|
96 | + echo '<b>Worksheet #', $sheetIndex, ' -> ', $loadedSheetName, '</b><br />'; |
|
97 | 97 | $objPHPExcel->setActiveSheetIndexByName($loadedSheetName); |
98 | - $sheetData = $objPHPExcel->getActiveSheet()->toArray(null,false,false,true); |
|
98 | + $sheetData = $objPHPExcel->getActiveSheet()->toArray(null, false, false, true); |
|
99 | 99 | var_dump($sheetData); |
100 | 100 | echo '<br />'; |
101 | 101 | } |
@@ -41,7 +41,7 @@ |
||
41 | 41 | echo '<h3>Worksheet Names</h3>'; |
42 | 42 | echo '<ol>'; |
43 | 43 | foreach ($worksheetNames as $worksheetName) { |
44 | - echo '<li>', $worksheetName, '</li>'; |
|
44 | + echo '<li>', $worksheetName, '</li>'; |
|
45 | 45 | } |
46 | 46 | echo '</ol>'; |
47 | 47 |
@@ -33,7 +33,7 @@ |
||
33 | 33 | // $inputFileType = 'Gnumeric'; |
34 | 34 | $inputFileName = './sampleData/example1.xls'; |
35 | 35 | |
36 | -echo 'Loading file ',pathinfo($inputFileName,PATHINFO_BASENAME),' information using IOFactory with a defined reader type of ',$inputFileType,'<br />'; |
|
36 | +echo 'Loading file ', pathinfo($inputFileName, PATHINFO_BASENAME), ' information using IOFactory with a defined reader type of ', $inputFileType, '<br />'; |
|
37 | 37 | |
38 | 38 | $objReader = PHPExcel_IOFactory::createReader($inputFileType); |
39 | 39 | $worksheetData = $objReader->listWorksheetInfo($inputFileName); |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | // $inputFileType = 'Gnumeric'; |
34 | 34 | $inputFileName = './sampleData/example1.xls'; |
35 | 35 | |
36 | -echo 'Loading file ',pathinfo($inputFileName,PATHINFO_BASENAME),' using IOFactory with a defined reader type of ',$inputFileType,'<br />'; |
|
36 | +echo 'Loading file ', pathinfo($inputFileName, PATHINFO_BASENAME), ' using IOFactory with a defined reader type of ', $inputFileType, '<br />'; |
|
37 | 37 | $objReader = PHPExcel_IOFactory::createReader($inputFileType); |
38 | 38 | echo 'Turning Formatting off for Load<br />'; |
39 | 39 | $objReader->setReadDataOnly(true); |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | |
43 | 43 | echo '<hr />'; |
44 | 44 | |
45 | -$sheetData = $objPHPExcel->getActiveSheet()->toArray(null,true,true,true); |
|
45 | +$sheetData = $objPHPExcel->getActiveSheet()->toArray(null, true, true, true); |
|
46 | 46 | var_dump($sheetData); |
47 | 47 | |
48 | 48 |
@@ -41,10 +41,10 @@ |
||
41 | 41 | echo '<h3>Worksheet Information</h3>'; |
42 | 42 | echo '<ol>'; |
43 | 43 | foreach ($worksheetData as $worksheet) { |
44 | - echo '<li>', $worksheet['worksheetName'], '<br />'; |
|
45 | - echo 'Rows: ', $worksheet['totalRows'], ' Columns: ', $worksheet['totalColumns'], '<br />'; |
|
46 | - echo 'Cell Range: A1:', $worksheet['lastColumnLetter'], $worksheet['totalRows']; |
|
47 | - echo '</li>'; |
|
44 | + echo '<li>', $worksheet['worksheetName'], '<br />'; |
|
45 | + echo 'Rows: ', $worksheet['totalRows'], ' Columns: ', $worksheet['totalColumns'], '<br />'; |
|
46 | + echo 'Cell Range: A1:', $worksheet['lastColumnLetter'], $worksheet['totalRows']; |
|
47 | + echo '</li>'; |
|
48 | 48 | } |
49 | 49 | echo '</ol>'; |
50 | 50 |
@@ -33,7 +33,7 @@ |
||
33 | 33 | // $inputFileType = 'Gnumeric'; |
34 | 34 | $inputFileName = './sampleData/example1.xls'; |
35 | 35 | |
36 | -echo 'Loading file ',pathinfo($inputFileName,PATHINFO_BASENAME),' information using IOFactory with a defined reader type of ',$inputFileType,'<br />'; |
|
36 | +echo 'Loading file ', pathinfo($inputFileName, PATHINFO_BASENAME), ' information using IOFactory with a defined reader type of ', $inputFileType, '<br />'; |
|
37 | 37 | |
38 | 38 | $objReader = PHPExcel_IOFactory::createReader($inputFileType); |
39 | 39 | $worksheetData = $objReader->listWorksheetInfo($inputFileName); |
@@ -21,28 +21,28 @@ |
||
21 | 21 | |
22 | 22 | foreach($exampleTypeList as $exampleType) { |
23 | 23 | |
24 | - echo '<h1>PHPExcel ' . pathinfo($exampleType,PATHINFO_BASENAME) . ' Examples</h1>'; |
|
24 | + echo '<h1>PHPExcel ' . pathinfo($exampleType,PATHINFO_BASENAME) . ' Examples</h1>'; |
|
25 | 25 | |
26 | - $exampleList = glob('./'.$exampleType.'/*.php'); |
|
26 | + $exampleList = glob('./'.$exampleType.'/*.php'); |
|
27 | 27 | |
28 | - foreach($exampleList as $exampleFile) { |
|
29 | - $fileData = file_get_contents($exampleFile); |
|
28 | + foreach($exampleList as $exampleFile) { |
|
29 | + $fileData = file_get_contents($exampleFile); |
|
30 | 30 | |
31 | - $h1Pattern = '#<h1>(.*?)</h1>#'; |
|
32 | - $h2Pattern = '#<h2>(.*?)</h2>#'; |
|
31 | + $h1Pattern = '#<h1>(.*?)</h1>#'; |
|
32 | + $h2Pattern = '#<h2>(.*?)</h2>#'; |
|
33 | 33 | |
34 | - if (preg_match($h1Pattern, $fileData, $out)) { |
|
35 | - $h1Text = $out[1]; |
|
36 | - $h2Text = (preg_match($h2Pattern, $fileData, $out)) ? $out[1] : ''; |
|
34 | + if (preg_match($h1Pattern, $fileData, $out)) { |
|
35 | + $h1Text = $out[1]; |
|
36 | + $h2Text = (preg_match($h2Pattern, $fileData, $out)) ? $out[1] : ''; |
|
37 | 37 | |
38 | - echo '<a href="',$exampleFile,'">',$h1Text,'</a><br />'; |
|
39 | - if (($h2Text > '') && |
|
40 | - (pathinfo($exampleType,PATHINFO_BASENAME) != 'Calculations')) { |
|
41 | - echo $h2Text,'<br />'; |
|
42 | - } |
|
43 | - } |
|
38 | + echo '<a href="',$exampleFile,'">',$h1Text,'</a><br />'; |
|
39 | + if (($h2Text > '') && |
|
40 | + (pathinfo($exampleType,PATHINFO_BASENAME) != 'Calculations')) { |
|
41 | + echo $h2Text,'<br />'; |
|
42 | + } |
|
43 | + } |
|
44 | 44 | |
45 | - } |
|
45 | + } |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | ?> |
@@ -17,15 +17,15 @@ discard block |
||
17 | 17 | |
18 | 18 | <?php |
19 | 19 | |
20 | -$exampleTypeList = glob('./*',GLOB_ONLYDIR); |
|
20 | +$exampleTypeList = glob('./*', GLOB_ONLYDIR); |
|
21 | 21 | |
22 | -foreach($exampleTypeList as $exampleType) { |
|
22 | +foreach ($exampleTypeList as $exampleType) { |
|
23 | 23 | |
24 | - echo '<h1>PHPExcel ' . pathinfo($exampleType,PATHINFO_BASENAME) . ' Examples</h1>'; |
|
24 | + echo '<h1>PHPExcel ' . pathinfo($exampleType, PATHINFO_BASENAME) . ' Examples</h1>'; |
|
25 | 25 | |
26 | - $exampleList = glob('./'.$exampleType.'/*.php'); |
|
26 | + $exampleList = glob('./' . $exampleType . '/*.php'); |
|
27 | 27 | |
28 | - foreach($exampleList as $exampleFile) { |
|
28 | + foreach ($exampleList as $exampleFile) { |
|
29 | 29 | $fileData = file_get_contents($exampleFile); |
30 | 30 | |
31 | 31 | $h1Pattern = '#<h1>(.*?)</h1>#'; |
@@ -35,10 +35,10 @@ discard block |
||
35 | 35 | $h1Text = $out[1]; |
36 | 36 | $h2Text = (preg_match($h2Pattern, $fileData, $out)) ? $out[1] : ''; |
37 | 37 | |
38 | - echo '<a href="',$exampleFile,'">',$h1Text,'</a><br />'; |
|
38 | + echo '<a href="', $exampleFile, '">', $h1Text, '</a><br />'; |
|
39 | 39 | if (($h2Text > '') && |
40 | - (pathinfo($exampleType,PATHINFO_BASENAME) != 'Calculations')) { |
|
41 | - echo $h2Text,'<br />'; |
|
40 | + (pathinfo($exampleType, PATHINFO_BASENAME) != 'Calculations')) { |
|
41 | + echo $h2Text, '<br />'; |
|
42 | 42 | } |
43 | 43 | } |
44 | 44 |
@@ -85,9 +85,9 @@ discard block |
||
85 | 85 | $bFamily = 0; // Font family |
86 | 86 | $bCharSet = \PHPExcel\Shared\Font::getCharsetFromFontName($this->font->getName()); // Character set |
87 | 87 | |
88 | - $record = 0x31; // Record identifier |
|
89 | - $reserved = 0x00; // Reserved |
|
90 | - $grbit = 0x00; // Font attributes |
|
88 | + $record = 0x31; // Record identifier |
|
89 | + $reserved = 0x00; // Reserved |
|
90 | + $grbit = 0x00; // Font attributes |
|
91 | 91 | if ($this->font->getItalic()) { |
92 | 92 | $grbit |= 0x02; |
93 | 93 | } |
@@ -134,9 +134,9 @@ discard block |
||
134 | 134 | private static function mapBold($bold) |
135 | 135 | { |
136 | 136 | if ($bold) { |
137 | - return 0x2BC; // 700 = Bold font weight |
|
137 | + return 0x2BC; // 700 = Bold font weight |
|
138 | 138 | } |
139 | - return 0x190; // 400 = Normal font weight |
|
139 | + return 0x190; // 400 = Normal font weight |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | /** |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | // $inputFileType = 'Gnumeric'; |
34 | 34 | $inputFileName = './sampleData/example1.xls'; |
35 | 35 | |
36 | -echo 'Loading file ',pathinfo($inputFileName,PATHINFO_BASENAME),' using IOFactory with a defined reader type of ',$inputFileType,'<br />'; |
|
36 | +echo 'Loading file ', pathinfo($inputFileName, PATHINFO_BASENAME), ' using IOFactory with a defined reader type of ', $inputFileType, '<br />'; |
|
37 | 37 | $objReader = PHPExcel_IOFactory::createReader($inputFileType); |
38 | 38 | echo 'Turning Formatting off for Load<br />'; |
39 | 39 | $objReader->setReadDataOnly(true); |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | |
43 | 43 | echo '<hr />'; |
44 | 44 | |
45 | -$sheetData = $objPHPExcel->getActiveSheet()->toArray(null,true,true,true); |
|
45 | +$sheetData = $objPHPExcel->getActiveSheet()->toArray(null, true, true, true); |
|
46 | 46 | var_dump($sheetData); |
47 | 47 | |
48 | 48 |
@@ -33,17 +33,17 @@ |
||
33 | 33 | |
34 | 34 | // Add some data |
35 | 35 | $database = array( array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ), |
36 | - array( 'Apple', 18, 20, 14, 105.00 ), |
|
37 | - array( 'Pear', 12, 12, 10, 96.00 ), |
|
38 | - array( 'Cherry', 13, 14, 9, 105.00 ), |
|
39 | - array( 'Apple', 14, 15, 10, 75.00 ), |
|
40 | - array( 'Pear', 9, 8, 8, 76.80 ), |
|
41 | - array( 'Apple', 8, 9, 6, 45.00 ), |
|
42 | - ); |
|
36 | + array( 'Apple', 18, 20, 14, 105.00 ), |
|
37 | + array( 'Pear', 12, 12, 10, 96.00 ), |
|
38 | + array( 'Cherry', 13, 14, 9, 105.00 ), |
|
39 | + array( 'Apple', 14, 15, 10, 75.00 ), |
|
40 | + array( 'Pear', 9, 8, 8, 76.80 ), |
|
41 | + array( 'Apple', 8, 9, 6, 45.00 ), |
|
42 | + ); |
|
43 | 43 | $criteria = array( array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ), |
44 | - array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ), |
|
45 | - array( '="=Pear"', NULL, NULL, NULL, NULL, NULL ) |
|
46 | - ); |
|
44 | + array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ), |
|
45 | + array( '="=Pear"', NULL, NULL, NULL, NULL, NULL ) |
|
46 | + ); |
|
47 | 47 | |
48 | 48 | $worksheet->fromArray( $criteria, NULL, 'A1' ); |
49 | 49 | $worksheet->fromArray( $database, NULL, 'A4' ); |
@@ -32,21 +32,21 @@ discard block |
||
32 | 32 | $worksheet = $objPHPExcel->getActiveSheet(); |
33 | 33 | |
34 | 34 | // Add some data |
35 | -$database = array( array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ), |
|
36 | - array( 'Apple', 18, 20, 14, 105.00 ), |
|
37 | - array( 'Pear', 12, 12, 10, 96.00 ), |
|
38 | - array( 'Cherry', 13, 14, 9, 105.00 ), |
|
39 | - array( 'Apple', 14, 15, 10, 75.00 ), |
|
40 | - array( 'Pear', 9, 8, 8, 76.80 ), |
|
41 | - array( 'Apple', 8, 9, 6, 45.00 ), |
|
35 | +$database = array(array('Tree', 'Height', 'Age', 'Yield', 'Profit'), |
|
36 | + array('Apple', 18, 20, 14, 105.00), |
|
37 | + array('Pear', 12, 12, 10, 96.00), |
|
38 | + array('Cherry', 13, 14, 9, 105.00), |
|
39 | + array('Apple', 14, 15, 10, 75.00), |
|
40 | + array('Pear', 9, 8, 8, 76.80), |
|
41 | + array('Apple', 8, 9, 6, 45.00), |
|
42 | 42 | ); |
43 | -$criteria = array( array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ), |
|
44 | - array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ), |
|
45 | - array( '="=Pear"', NULL, NULL, NULL, NULL, NULL ) |
|
43 | +$criteria = array(array('Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height'), |
|
44 | + array('="=Apple"', '>10', NULL, NULL, NULL, '<16'), |
|
45 | + array('="=Pear"', NULL, NULL, NULL, NULL, NULL) |
|
46 | 46 | ); |
47 | 47 | |
48 | -$worksheet->fromArray( $criteria, NULL, 'A1' ); |
|
49 | -$worksheet->fromArray( $database, NULL, 'A4' ); |
|
48 | +$worksheet->fromArray($criteria, NULL, 'A1'); |
|
49 | +$worksheet->fromArray($database, NULL, 'A4'); |
|
50 | 50 | |
51 | 51 | $worksheet->setCellValue('A12', 'The height of the Apple tree between 10\' and 16\' tall'); |
52 | 52 | $worksheet->setCellValue('B12', '=DGET(A4:E10,"Height",A1:F2)'); |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | |
58 | 58 | echo '<h4>Database</h4>'; |
59 | 59 | |
60 | -$databaseData = $worksheet->rangeToArray('A4:E10',null,true,true,true); |
|
60 | +$databaseData = $worksheet->rangeToArray('A4:E10', null, true, true, true); |
|
61 | 61 | var_dump($databaseData); |
62 | 62 | |
63 | 63 | |
@@ -69,15 +69,15 @@ discard block |
||
69 | 69 | |
70 | 70 | echo 'ALL' . '<br /><br />'; |
71 | 71 | |
72 | -echo $worksheet->getCell("A12")->getValue() .'<br />'; |
|
73 | -echo 'DMAX() Result is ' . $worksheet->getCell("B12")->getCalculatedValue() .'<br /><br />'; |
|
72 | +echo $worksheet->getCell("A12")->getValue() . '<br />'; |
|
73 | +echo 'DMAX() Result is ' . $worksheet->getCell("B12")->getCalculatedValue() . '<br /><br />'; |
|
74 | 74 | |
75 | 75 | echo '<h4>Criteria</h4>'; |
76 | 76 | |
77 | -$criteriaData = $worksheet->rangeToArray('A1:A2',null,true,true,true); |
|
77 | +$criteriaData = $worksheet->rangeToArray('A1:A2', null, true, true, true); |
|
78 | 78 | var_dump($criteriaData); |
79 | 79 | |
80 | -echo $worksheet->getCell("A13")->getValue() .'<br />'; |
|
80 | +echo $worksheet->getCell("A13")->getValue() . '<br />'; |
|
81 | 81 | echo 'DMAX() Result is ' . $worksheet->getCell("B13")->getCalculatedValue(); |
82 | 82 | |
83 | 83 |
@@ -33,17 +33,17 @@ |
||
33 | 33 | |
34 | 34 | // Add some data |
35 | 35 | $database = array( array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ), |
36 | - array( 'Apple', 18, 20, 14, 105.00 ), |
|
37 | - array( 'Pear', 12, 12, 10, 96.00 ), |
|
38 | - array( 'Cherry', 13, 14, 9, 105.00 ), |
|
39 | - array( 'Apple', 14, 15, 10, 75.00 ), |
|
40 | - array( 'Pear', 9, 8, 8, 76.80 ), |
|
41 | - array( 'Apple', 8, 9, 6, 45.00 ), |
|
42 | - ); |
|
36 | + array( 'Apple', 18, 20, 14, 105.00 ), |
|
37 | + array( 'Pear', 12, 12, 10, 96.00 ), |
|
38 | + array( 'Cherry', 13, 14, 9, 105.00 ), |
|
39 | + array( 'Apple', 14, 15, 10, 75.00 ), |
|
40 | + array( 'Pear', 9, 8, 8, 76.80 ), |
|
41 | + array( 'Apple', 8, 9, 6, 45.00 ), |
|
42 | + ); |
|
43 | 43 | $criteria = array( array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ), |
44 | - array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ), |
|
45 | - array( '="=Pear"', NULL, NULL, NULL, NULL, NULL ) |
|
46 | - ); |
|
44 | + array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ), |
|
45 | + array( '="=Pear"', NULL, NULL, NULL, NULL, NULL ) |
|
46 | + ); |
|
47 | 47 | |
48 | 48 | $worksheet->fromArray( $criteria, NULL, 'A1' ); |
49 | 49 | $worksheet->fromArray( $database, NULL, 'A4' ); |
@@ -32,21 +32,21 @@ discard block |
||
32 | 32 | $worksheet = $objPHPExcel->getActiveSheet(); |
33 | 33 | |
34 | 34 | // Add some data |
35 | -$database = array( array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ), |
|
36 | - array( 'Apple', 18, 20, 14, 105.00 ), |
|
37 | - array( 'Pear', 12, 12, 10, 96.00 ), |
|
38 | - array( 'Cherry', 13, 14, 9, 105.00 ), |
|
39 | - array( 'Apple', 14, 15, 10, 75.00 ), |
|
40 | - array( 'Pear', 9, 8, 8, 76.80 ), |
|
41 | - array( 'Apple', 8, 9, 6, 45.00 ), |
|
35 | +$database = array(array('Tree', 'Height', 'Age', 'Yield', 'Profit'), |
|
36 | + array('Apple', 18, 20, 14, 105.00), |
|
37 | + array('Pear', 12, 12, 10, 96.00), |
|
38 | + array('Cherry', 13, 14, 9, 105.00), |
|
39 | + array('Apple', 14, 15, 10, 75.00), |
|
40 | + array('Pear', 9, 8, 8, 76.80), |
|
41 | + array('Apple', 8, 9, 6, 45.00), |
|
42 | 42 | ); |
43 | -$criteria = array( array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ), |
|
44 | - array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ), |
|
45 | - array( '="=Pear"', NULL, NULL, NULL, NULL, NULL ) |
|
43 | +$criteria = array(array('Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height'), |
|
44 | + array('="=Apple"', '>10', NULL, NULL, NULL, '<16'), |
|
45 | + array('="=Pear"', NULL, NULL, NULL, NULL, NULL) |
|
46 | 46 | ); |
47 | 47 | |
48 | -$worksheet->fromArray( $criteria, NULL, 'A1' ); |
|
49 | -$worksheet->fromArray( $database, NULL, 'A4' ); |
|
48 | +$worksheet->fromArray($criteria, NULL, 'A1'); |
|
49 | +$worksheet->fromArray($database, NULL, 'A4'); |
|
50 | 50 | |
51 | 51 | $worksheet->setCellValue('A12', 'The height of the Apple tree between 10\' and 16\' tall'); |
52 | 52 | $worksheet->setCellValue('B12', '=DGET(A4:E10,"Height",A1:F2)'); |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | |
58 | 58 | echo '<h4>Database</h4>'; |
59 | 59 | |
60 | -$databaseData = $worksheet->rangeToArray('A4:E10',null,true,true,true); |
|
60 | +$databaseData = $worksheet->rangeToArray('A4:E10', null, true, true, true); |
|
61 | 61 | var_dump($databaseData); |
62 | 62 | |
63 | 63 | |
@@ -69,15 +69,15 @@ discard block |
||
69 | 69 | |
70 | 70 | echo 'ALL' . '<br /><br />'; |
71 | 71 | |
72 | -echo $worksheet->getCell("A12")->getValue() .'<br />'; |
|
73 | -echo 'DMAX() Result is ' . $worksheet->getCell("B12")->getCalculatedValue() .'<br /><br />'; |
|
72 | +echo $worksheet->getCell("A12")->getValue() . '<br />'; |
|
73 | +echo 'DMAX() Result is ' . $worksheet->getCell("B12")->getCalculatedValue() . '<br /><br />'; |
|
74 | 74 | |
75 | 75 | echo '<h4>Criteria</h4>'; |
76 | 76 | |
77 | -$criteriaData = $worksheet->rangeToArray('A1:A2',null,true,true,true); |
|
77 | +$criteriaData = $worksheet->rangeToArray('A1:A2', null, true, true, true); |
|
78 | 78 | var_dump($criteriaData); |
79 | 79 | |
80 | -echo $worksheet->getCell("A13")->getValue() .'<br />'; |
|
80 | +echo $worksheet->getCell("A13")->getValue() . '<br />'; |
|
81 | 81 | echo 'DMAX() Result is ' . $worksheet->getCell("B13")->getCalculatedValue(); |
82 | 82 | |
83 | 83 |