@@ -46,7 +46,7 @@ |
||
46 | 46 | echo $objPHPExcel->getSheetCount(),' worksheet',(($objPHPExcel->getSheetCount() == 1) ? '' : 's'),' loaded<br /><br />'; |
47 | 47 | $loadedSheetNames = $objPHPExcel->getSheetNames(); |
48 | 48 | foreach($loadedSheetNames as $sheetIndex => $loadedSheetName) { |
49 | - echo $sheetIndex,' -> ',$loadedSheetName,'<br />'; |
|
49 | + echo $sheetIndex,' -> ',$loadedSheetName,'<br />'; |
|
50 | 50 | } |
51 | 51 | |
52 | 52 |
@@ -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 | ?> |
@@ -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 |
@@ -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 |
@@ -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 | ?> |
@@ -13,8 +13,8 @@ |
||
13 | 13 | ->disableOriginalConstructor() |
14 | 14 | ->getMock(); |
15 | 15 | $this->mockWorksheet->expects($this->any()) |
16 | - ->method('getHighestColumn') |
|
17 | - ->will($this->returnValue('E')); |
|
16 | + ->method('getHighestColumn') |
|
17 | + ->will($this->returnValue('E')); |
|
18 | 18 | } |
19 | 19 | |
20 | 20 |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | { |
112 | 112 | $attributeSet = array( 'val' => 100, |
113 | 113 | 'maxVal' => 200 |
114 | - ); |
|
114 | + ); |
|
115 | 115 | |
116 | 116 | // Setters return the instance to implement the fluent interface |
117 | 117 | $result = $this->_testAutoFilterColumnObject->setAttributes($attributeSet); |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | { |
123 | 123 | $attributeSet = array( 'val' => 100, |
124 | 124 | 'maxVal' => 200 |
125 | - ); |
|
125 | + ); |
|
126 | 126 | |
127 | 127 | $this->_testAutoFilterColumnObject->setAttributes($attributeSet); |
128 | 128 | |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | { |
136 | 136 | $attributeSet = array( 'val' => 100, |
137 | 137 | 'maxVal' => 200 |
138 | - ); |
|
138 | + ); |
|
139 | 139 | |
140 | 140 | foreach ($attributeSet as $attributeName => $attributeValue) { |
141 | 141 | // Setters return the instance to implement the fluent interface |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | { |
149 | 149 | $attributeSet = array( 'val' => 100, |
150 | 150 | 'maxVal' => 200 |
151 | - ); |
|
151 | + ); |
|
152 | 152 | |
153 | 153 | $this->_testAutoFilterColumnObject->setAttributes($attributeSet); |
154 | 154 |
@@ -18,11 +18,11 @@ |
||
18 | 18 | ->getMock(); |
19 | 19 | |
20 | 20 | $this->mockWorksheet->expects($this->any()) |
21 | - ->method('getHighestRow') |
|
22 | - ->will($this->returnValue(5)); |
|
21 | + ->method('getHighestRow') |
|
22 | + ->will($this->returnValue(5)); |
|
23 | 23 | $this->mockWorksheet->expects($this->any()) |
24 | - ->method('current') |
|
25 | - ->will($this->returnValue($this->mockRow)); |
|
24 | + ->method('current') |
|
25 | + ->will($this->returnValue($this->mockRow)); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 |
@@ -18,11 +18,11 @@ |
||
18 | 18 | ->getMock(); |
19 | 19 | |
20 | 20 | $this->mockWorksheet->expects($this->any()) |
21 | - ->method('getHighestRow') |
|
22 | - ->will($this->returnValue(5)); |
|
21 | + ->method('getHighestRow') |
|
22 | + ->will($this->returnValue(5)); |
|
23 | 23 | $this->mockWorksheet->expects($this->any()) |
24 | - ->method('getCellByColumnAndRow') |
|
25 | - ->will($this->returnValue($this->mockCell)); |
|
24 | + ->method('getCellByColumnAndRow') |
|
25 | + ->will($this->returnValue($this->mockCell)); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 |