@@ -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 standard deviation in the yield of Apple and Pear trees'); |
52 | 52 | $worksheet->setCellValue('B12', '=DSTDEVP(A4:E10,"Yield",A1:A3)'); |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | |
61 | 61 | echo '<h4>Database</h4>'; |
62 | 62 | |
63 | -$databaseData = $worksheet->rangeToArray('A4:E10',null,true,true,true); |
|
63 | +$databaseData = $worksheet->rangeToArray('A4:E10', null, true, true, true); |
|
64 | 64 | var_dump($databaseData); |
65 | 65 | |
66 | 66 | |
@@ -70,18 +70,18 @@ discard block |
||
70 | 70 | // Test the formulae |
71 | 71 | echo '<h4>Criteria</h4>'; |
72 | 72 | |
73 | -$criteriaData = $worksheet->rangeToArray('A1:A3',null,true,true,true); |
|
73 | +$criteriaData = $worksheet->rangeToArray('A1:A3', null, true, true, true); |
|
74 | 74 | var_dump($criteriaData); |
75 | 75 | |
76 | -echo $worksheet->getCell("A12")->getValue() .'<br />'; |
|
77 | -echo 'DSTDEVP() Result is ' . $worksheet->getCell("B12")->getCalculatedValue() .'<br /><br />'; |
|
76 | +echo $worksheet->getCell("A12")->getValue() . '<br />'; |
|
77 | +echo 'DSTDEVP() Result is ' . $worksheet->getCell("B12")->getCalculatedValue() . '<br /><br />'; |
|
78 | 78 | |
79 | 79 | echo '<h4>Criteria</h4>'; |
80 | 80 | |
81 | -$criteriaData = $worksheet->rangeToArray('A1:A3',null,true,true,true); |
|
81 | +$criteriaData = $worksheet->rangeToArray('A1:A3', null, true, true, true); |
|
82 | 82 | var_dump($criteriaData); |
83 | 83 | |
84 | -echo $worksheet->getCell("A13")->getValue() .'<br />'; |
|
84 | +echo $worksheet->getCell("A13")->getValue() . '<br />'; |
|
85 | 85 | echo 'DSTDEVP() Result is ' . $worksheet->getCell("B13")->getCalculatedValue(); |
86 | 86 | |
87 | 87 |
@@ -33,21 +33,21 @@ discard block |
||
33 | 33 | |
34 | 34 | // Add some data |
35 | 35 | $testDates = array( '26 March 2012', '29 Feb 2012', 'April 1, 2012', '25/12/2012', |
36 | - '2012-Oct-31', '5th November', 'January 1st', 'April 2012', |
|
37 | - '17-03', '03-2012', '29 Feb 2011', '03-05-07', |
|
38 | - '03-MAY-07', '03-13-07', |
|
39 | - ); |
|
36 | + '2012-Oct-31', '5th November', 'January 1st', 'April 2012', |
|
37 | + '17-03', '03-2012', '29 Feb 2011', '03-05-07', |
|
38 | + '03-MAY-07', '03-13-07', |
|
39 | + ); |
|
40 | 40 | $testDateCount = count($testDates); |
41 | 41 | |
42 | 42 | for($row = 1; $row <= $testDateCount; ++$row) { |
43 | - $worksheet->setCellValue('A'.$row, $testDates[$row-1]); |
|
44 | - $worksheet->setCellValue('B'.$row, '=DATEVALUE(A'.$row.')'); |
|
45 | - $worksheet->setCellValue('C'.$row, '=B'.$row); |
|
43 | + $worksheet->setCellValue('A'.$row, $testDates[$row-1]); |
|
44 | + $worksheet->setCellValue('B'.$row, '=DATEVALUE(A'.$row.')'); |
|
45 | + $worksheet->setCellValue('C'.$row, '=B'.$row); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | $worksheet->getStyle('C1:C'.$testDateCount) |
49 | - ->getNumberFormat() |
|
50 | - ->setFormatCode('yyyy-mmm-dd'); |
|
49 | + ->getNumberFormat() |
|
50 | + ->setFormatCode('yyyy-mmm-dd'); |
|
51 | 51 | |
52 | 52 | |
53 | 53 | echo '<hr />'; |
@@ -64,13 +64,13 @@ discard block |
||
64 | 64 | <th>Formatted DateStamp</th> |
65 | 65 | </tr> |
66 | 66 | <?php |
67 | - for ($row = 1; $row <= $testDateCount; ++$row) { |
|
68 | - echo '<tr>'; |
|
69 | - echo '<td>' , $worksheet->getCell('A'.$row)->getFormattedValue() , '</td>'; |
|
70 | - echo '<td>' , $worksheet->getCell('B'.$row)->getValue() , '</td>'; |
|
71 | - echo '<td>' , $worksheet->getCell('B'.$row)->getFormattedValue() , '</td>'; |
|
72 | - echo '<td>' , $worksheet->getCell('C'.$row)->getFormattedValue() , '</td>'; |
|
73 | - echo '</tr>'; |
|
74 | - } |
|
75 | - ?> |
|
67 | + for ($row = 1; $row <= $testDateCount; ++$row) { |
|
68 | + echo '<tr>'; |
|
69 | + echo '<td>' , $worksheet->getCell('A'.$row)->getFormattedValue() , '</td>'; |
|
70 | + echo '<td>' , $worksheet->getCell('B'.$row)->getValue() , '</td>'; |
|
71 | + echo '<td>' , $worksheet->getCell('B'.$row)->getFormattedValue() , '</td>'; |
|
72 | + echo '<td>' , $worksheet->getCell('C'.$row)->getFormattedValue() , '</td>'; |
|
73 | + echo '</tr>'; |
|
74 | + } |
|
75 | + ?> |
|
76 | 76 | </table> |
77 | 77 | \ No newline at end of file |
@@ -32,20 +32,20 @@ discard block |
||
32 | 32 | $worksheet = $objPHPExcel->getActiveSheet(); |
33 | 33 | |
34 | 34 | // Add some data |
35 | -$testDates = array( '26 March 2012', '29 Feb 2012', 'April 1, 2012', '25/12/2012', |
|
36 | - '2012-Oct-31', '5th November', 'January 1st', 'April 2012', |
|
37 | - '17-03', '03-2012', '29 Feb 2011', '03-05-07', |
|
38 | - '03-MAY-07', '03-13-07', |
|
35 | +$testDates = array('26 March 2012', '29 Feb 2012', 'April 1, 2012', '25/12/2012', |
|
36 | + '2012-Oct-31', '5th November', 'January 1st', 'April 2012', |
|
37 | + '17-03', '03-2012', '29 Feb 2011', '03-05-07', |
|
38 | + '03-MAY-07', '03-13-07', |
|
39 | 39 | ); |
40 | 40 | $testDateCount = count($testDates); |
41 | 41 | |
42 | -for($row = 1; $row <= $testDateCount; ++$row) { |
|
43 | - $worksheet->setCellValue('A'.$row, $testDates[$row-1]); |
|
44 | - $worksheet->setCellValue('B'.$row, '=DATEVALUE(A'.$row.')'); |
|
45 | - $worksheet->setCellValue('C'.$row, '=B'.$row); |
|
42 | +for ($row = 1; $row <= $testDateCount; ++$row) { |
|
43 | + $worksheet->setCellValue('A' . $row, $testDates[$row - 1]); |
|
44 | + $worksheet->setCellValue('B' . $row, '=DATEVALUE(A' . $row . ')'); |
|
45 | + $worksheet->setCellValue('C' . $row, '=B' . $row); |
|
46 | 46 | } |
47 | 47 | |
48 | -$worksheet->getStyle('C1:C'.$testDateCount) |
|
48 | +$worksheet->getStyle('C1:C' . $testDateCount) |
|
49 | 49 | ->getNumberFormat() |
50 | 50 | ->setFormatCode('yyyy-mmm-dd'); |
51 | 51 | |
@@ -66,10 +66,10 @@ discard block |
||
66 | 66 | <?php |
67 | 67 | for ($row = 1; $row <= $testDateCount; ++$row) { |
68 | 68 | echo '<tr>'; |
69 | - echo '<td>' , $worksheet->getCell('A'.$row)->getFormattedValue() , '</td>'; |
|
70 | - echo '<td>' , $worksheet->getCell('B'.$row)->getValue() , '</td>'; |
|
71 | - echo '<td>' , $worksheet->getCell('B'.$row)->getFormattedValue() , '</td>'; |
|
72 | - echo '<td>' , $worksheet->getCell('C'.$row)->getFormattedValue() , '</td>'; |
|
69 | + echo '<td>', $worksheet->getCell('A' . $row)->getFormattedValue(), '</td>'; |
|
70 | + echo '<td>', $worksheet->getCell('B' . $row)->getValue(), '</td>'; |
|
71 | + echo '<td>', $worksheet->getCell('B' . $row)->getFormattedValue(), '</td>'; |
|
72 | + echo '<td>', $worksheet->getCell('C' . $row)->getFormattedValue(), '</td>'; |
|
73 | 73 | echo '</tr>'; |
74 | 74 | } |
75 | 75 | ?> |
@@ -33,22 +33,22 @@ discard block |
||
33 | 33 | |
34 | 34 | // Add some data |
35 | 35 | $testDates = array( array(2012,3,26), array(2012,2,29), array(2012,4,1), array(2012,12,25), |
36 | - array(2012,10,31), array(2012,11,5), array(2012,1,1), array(2012,3,17), |
|
37 | - array(2011,2,29), array(7,5,3), array(2012,13,1), array(2012,11,45), |
|
38 | - array(2012,0,0), array(2012,1,0), array(2012,0,1), |
|
39 | - array(2012,-2,2), array(2012,2,-2), array(2012,-2,-2), |
|
40 | - ); |
|
36 | + array(2012,10,31), array(2012,11,5), array(2012,1,1), array(2012,3,17), |
|
37 | + array(2011,2,29), array(7,5,3), array(2012,13,1), array(2012,11,45), |
|
38 | + array(2012,0,0), array(2012,1,0), array(2012,0,1), |
|
39 | + array(2012,-2,2), array(2012,2,-2), array(2012,-2,-2), |
|
40 | + ); |
|
41 | 41 | $testDateCount = count($testDates); |
42 | 42 | |
43 | 43 | $worksheet->fromArray($testDates,NULL,'A1',true); |
44 | 44 | |
45 | 45 | for ($row = 1; $row <= $testDateCount; ++$row) { |
46 | - $worksheet->setCellValue('D'.$row, '=DATE(A'.$row.',B'.$row.',C'.$row.')'); |
|
47 | - $worksheet->setCellValue('E'.$row, '=D'.$row); |
|
46 | + $worksheet->setCellValue('D'.$row, '=DATE(A'.$row.',B'.$row.',C'.$row.')'); |
|
47 | + $worksheet->setCellValue('E'.$row, '=D'.$row); |
|
48 | 48 | } |
49 | 49 | $worksheet->getStyle('E1:E'.$testDateCount) |
50 | - ->getNumberFormat() |
|
51 | - ->setFormatCode('yyyy-mmm-dd'); |
|
50 | + ->getNumberFormat() |
|
51 | + ->setFormatCode('yyyy-mmm-dd'); |
|
52 | 52 | |
53 | 53 | |
54 | 54 | echo '<hr />'; |
@@ -69,15 +69,15 @@ discard block |
||
69 | 69 | <th>Day</th> |
70 | 70 | <tr> |
71 | 71 | <?php |
72 | - for ($row = 1; $row <= $testDateCount; ++$row) { |
|
73 | - echo '<tr>'; |
|
74 | - echo '<td>' , $worksheet->getCell('A'.$row)->getFormattedValue() , '</td>'; |
|
75 | - echo '<td>' , $worksheet->getCell('B'.$row)->getFormattedValue() , '</td>'; |
|
76 | - echo '<td>' , $worksheet->getCell('C'.$row)->getFormattedValue() , '</td>'; |
|
77 | - echo '<td>' , $worksheet->getCell('D'.$row)->getValue() , '</td>'; |
|
78 | - echo '<td>' , $worksheet->getCell('D'.$row)->getFormattedValue() , '</td>'; |
|
79 | - echo '<td>' , $worksheet->getCell('E'.$row)->getFormattedValue() , '</td>'; |
|
80 | - echo '</tr>'; |
|
81 | - } |
|
82 | - ?> |
|
72 | + for ($row = 1; $row <= $testDateCount; ++$row) { |
|
73 | + echo '<tr>'; |
|
74 | + echo '<td>' , $worksheet->getCell('A'.$row)->getFormattedValue() , '</td>'; |
|
75 | + echo '<td>' , $worksheet->getCell('B'.$row)->getFormattedValue() , '</td>'; |
|
76 | + echo '<td>' , $worksheet->getCell('C'.$row)->getFormattedValue() , '</td>'; |
|
77 | + echo '<td>' , $worksheet->getCell('D'.$row)->getValue() , '</td>'; |
|
78 | + echo '<td>' , $worksheet->getCell('D'.$row)->getFormattedValue() , '</td>'; |
|
79 | + echo '<td>' , $worksheet->getCell('E'.$row)->getFormattedValue() , '</td>'; |
|
80 | + echo '</tr>'; |
|
81 | + } |
|
82 | + ?> |
|
83 | 83 | </table> |
84 | 84 | \ No newline at end of file |
@@ -32,21 +32,21 @@ discard block |
||
32 | 32 | $worksheet = $objPHPExcel->getActiveSheet(); |
33 | 33 | |
34 | 34 | // Add some data |
35 | -$testDates = array( array(2012,3,26), array(2012,2,29), array(2012,4,1), array(2012,12,25), |
|
36 | - array(2012,10,31), array(2012,11,5), array(2012,1,1), array(2012,3,17), |
|
37 | - array(2011,2,29), array(7,5,3), array(2012,13,1), array(2012,11,45), |
|
38 | - array(2012,0,0), array(2012,1,0), array(2012,0,1), |
|
39 | - array(2012,-2,2), array(2012,2,-2), array(2012,-2,-2), |
|
35 | +$testDates = array(array(2012, 3, 26), array(2012, 2, 29), array(2012, 4, 1), array(2012, 12, 25), |
|
36 | + array(2012, 10, 31), array(2012, 11, 5), array(2012, 1, 1), array(2012, 3, 17), |
|
37 | + array(2011, 2, 29), array(7, 5, 3), array(2012, 13, 1), array(2012, 11, 45), |
|
38 | + array(2012, 0, 0), array(2012, 1, 0), array(2012, 0, 1), |
|
39 | + array(2012, -2, 2), array(2012, 2, -2), array(2012, -2, -2), |
|
40 | 40 | ); |
41 | 41 | $testDateCount = count($testDates); |
42 | 42 | |
43 | -$worksheet->fromArray($testDates,NULL,'A1',true); |
|
43 | +$worksheet->fromArray($testDates, NULL, 'A1', true); |
|
44 | 44 | |
45 | 45 | for ($row = 1; $row <= $testDateCount; ++$row) { |
46 | - $worksheet->setCellValue('D'.$row, '=DATE(A'.$row.',B'.$row.',C'.$row.')'); |
|
47 | - $worksheet->setCellValue('E'.$row, '=D'.$row); |
|
46 | + $worksheet->setCellValue('D' . $row, '=DATE(A' . $row . ',B' . $row . ',C' . $row . ')'); |
|
47 | + $worksheet->setCellValue('E' . $row, '=D' . $row); |
|
48 | 48 | } |
49 | -$worksheet->getStyle('E1:E'.$testDateCount) |
|
49 | +$worksheet->getStyle('E1:E' . $testDateCount) |
|
50 | 50 | ->getNumberFormat() |
51 | 51 | ->setFormatCode('yyyy-mmm-dd'); |
52 | 52 | |
@@ -71,12 +71,12 @@ discard block |
||
71 | 71 | <?php |
72 | 72 | for ($row = 1; $row <= $testDateCount; ++$row) { |
73 | 73 | echo '<tr>'; |
74 | - echo '<td>' , $worksheet->getCell('A'.$row)->getFormattedValue() , '</td>'; |
|
75 | - echo '<td>' , $worksheet->getCell('B'.$row)->getFormattedValue() , '</td>'; |
|
76 | - echo '<td>' , $worksheet->getCell('C'.$row)->getFormattedValue() , '</td>'; |
|
77 | - echo '<td>' , $worksheet->getCell('D'.$row)->getValue() , '</td>'; |
|
78 | - echo '<td>' , $worksheet->getCell('D'.$row)->getFormattedValue() , '</td>'; |
|
79 | - echo '<td>' , $worksheet->getCell('E'.$row)->getFormattedValue() , '</td>'; |
|
74 | + echo '<td>', $worksheet->getCell('A' . $row)->getFormattedValue(), '</td>'; |
|
75 | + echo '<td>', $worksheet->getCell('B' . $row)->getFormattedValue(), '</td>'; |
|
76 | + echo '<td>', $worksheet->getCell('C' . $row)->getFormattedValue(), '</td>'; |
|
77 | + echo '<td>', $worksheet->getCell('D' . $row)->getValue(), '</td>'; |
|
78 | + echo '<td>', $worksheet->getCell('D' . $row)->getFormattedValue(), '</td>'; |
|
79 | + echo '<td>', $worksheet->getCell('E' . $row)->getFormattedValue(), '</td>'; |
|
80 | 80 | echo '</tr>'; |
81 | 81 | } |
82 | 82 | ?> |
@@ -33,20 +33,20 @@ discard block |
||
33 | 33 | |
34 | 34 | // Add some data |
35 | 35 | $testDates = array( array(3,15), array(13,15), array(15,15,15), array(3,15,30), |
36 | - array(15,15,15), array(5), array(9,15,0), array(9,15,-1), |
|
37 | - array(13,-14,-15), array(0,0,-1) |
|
38 | - ); |
|
36 | + array(15,15,15), array(5), array(9,15,0), array(9,15,-1), |
|
37 | + array(13,-14,-15), array(0,0,-1) |
|
38 | + ); |
|
39 | 39 | $testDateCount = count($testDates); |
40 | 40 | |
41 | 41 | $worksheet->fromArray($testDates,NULL,'A1',true); |
42 | 42 | |
43 | 43 | for ($row = 1; $row <= $testDateCount; ++$row) { |
44 | - $worksheet->setCellValue('D'.$row, '=TIME(A'.$row.',B'.$row.',C'.$row.')'); |
|
45 | - $worksheet->setCellValue('E'.$row, '=D'.$row); |
|
44 | + $worksheet->setCellValue('D'.$row, '=TIME(A'.$row.',B'.$row.',C'.$row.')'); |
|
45 | + $worksheet->setCellValue('E'.$row, '=D'.$row); |
|
46 | 46 | } |
47 | 47 | $worksheet->getStyle('E1:E'.$testDateCount) |
48 | - ->getNumberFormat() |
|
49 | - ->setFormatCode('hh:mm:ss'); |
|
48 | + ->getNumberFormat() |
|
49 | + ->setFormatCode('hh:mm:ss'); |
|
50 | 50 | |
51 | 51 | |
52 | 52 | echo '<hr />'; |
@@ -67,15 +67,15 @@ discard block |
||
67 | 67 | <th>Second</th> |
68 | 68 | <tr> |
69 | 69 | <?php |
70 | - for ($row = 1; $row <= $testDateCount; ++$row) { |
|
71 | - echo '<tr>'; |
|
72 | - echo '<td>' , $worksheet->getCell('A'.$row)->getFormattedValue() , '</td>'; |
|
73 | - echo '<td>' , $worksheet->getCell('B'.$row)->getFormattedValue() , '</td>'; |
|
74 | - echo '<td>' , $worksheet->getCell('C'.$row)->getFormattedValue() , '</td>'; |
|
75 | - echo '<td>' , $worksheet->getCell('D'.$row)->getValue() , '</td>'; |
|
76 | - echo '<td>' , $worksheet->getCell('D'.$row)->getFormattedValue() , '</td>'; |
|
77 | - echo '<td>' , $worksheet->getCell('E'.$row)->getFormattedValue() , '</td>'; |
|
78 | - echo '</tr>'; |
|
79 | - } |
|
80 | - ?> |
|
70 | + for ($row = 1; $row <= $testDateCount; ++$row) { |
|
71 | + echo '<tr>'; |
|
72 | + echo '<td>' , $worksheet->getCell('A'.$row)->getFormattedValue() , '</td>'; |
|
73 | + echo '<td>' , $worksheet->getCell('B'.$row)->getFormattedValue() , '</td>'; |
|
74 | + echo '<td>' , $worksheet->getCell('C'.$row)->getFormattedValue() , '</td>'; |
|
75 | + echo '<td>' , $worksheet->getCell('D'.$row)->getValue() , '</td>'; |
|
76 | + echo '<td>' , $worksheet->getCell('D'.$row)->getFormattedValue() , '</td>'; |
|
77 | + echo '<td>' , $worksheet->getCell('E'.$row)->getFormattedValue() , '</td>'; |
|
78 | + echo '</tr>'; |
|
79 | + } |
|
80 | + ?> |
|
81 | 81 | </table> |
82 | 82 | \ No newline at end of file |
@@ -32,19 +32,19 @@ discard block |
||
32 | 32 | $worksheet = $objPHPExcel->getActiveSheet(); |
33 | 33 | |
34 | 34 | // Add some data |
35 | -$testDates = array( array(3,15), array(13,15), array(15,15,15), array(3,15,30), |
|
36 | - array(15,15,15), array(5), array(9,15,0), array(9,15,-1), |
|
37 | - array(13,-14,-15), array(0,0,-1) |
|
35 | +$testDates = array(array(3, 15), array(13, 15), array(15, 15, 15), array(3, 15, 30), |
|
36 | + array(15, 15, 15), array(5), array(9, 15, 0), array(9, 15, -1), |
|
37 | + array(13, -14, -15), array(0, 0, -1) |
|
38 | 38 | ); |
39 | 39 | $testDateCount = count($testDates); |
40 | 40 | |
41 | -$worksheet->fromArray($testDates,NULL,'A1',true); |
|
41 | +$worksheet->fromArray($testDates, NULL, 'A1', true); |
|
42 | 42 | |
43 | 43 | for ($row = 1; $row <= $testDateCount; ++$row) { |
44 | - $worksheet->setCellValue('D'.$row, '=TIME(A'.$row.',B'.$row.',C'.$row.')'); |
|
45 | - $worksheet->setCellValue('E'.$row, '=D'.$row); |
|
44 | + $worksheet->setCellValue('D' . $row, '=TIME(A' . $row . ',B' . $row . ',C' . $row . ')'); |
|
45 | + $worksheet->setCellValue('E' . $row, '=D' . $row); |
|
46 | 46 | } |
47 | -$worksheet->getStyle('E1:E'.$testDateCount) |
|
47 | +$worksheet->getStyle('E1:E' . $testDateCount) |
|
48 | 48 | ->getNumberFormat() |
49 | 49 | ->setFormatCode('hh:mm:ss'); |
50 | 50 | |
@@ -69,12 +69,12 @@ discard block |
||
69 | 69 | <?php |
70 | 70 | for ($row = 1; $row <= $testDateCount; ++$row) { |
71 | 71 | echo '<tr>'; |
72 | - echo '<td>' , $worksheet->getCell('A'.$row)->getFormattedValue() , '</td>'; |
|
73 | - echo '<td>' , $worksheet->getCell('B'.$row)->getFormattedValue() , '</td>'; |
|
74 | - echo '<td>' , $worksheet->getCell('C'.$row)->getFormattedValue() , '</td>'; |
|
75 | - echo '<td>' , $worksheet->getCell('D'.$row)->getValue() , '</td>'; |
|
76 | - echo '<td>' , $worksheet->getCell('D'.$row)->getFormattedValue() , '</td>'; |
|
77 | - echo '<td>' , $worksheet->getCell('E'.$row)->getFormattedValue() , '</td>'; |
|
72 | + echo '<td>', $worksheet->getCell('A' . $row)->getFormattedValue(), '</td>'; |
|
73 | + echo '<td>', $worksheet->getCell('B' . $row)->getFormattedValue(), '</td>'; |
|
74 | + echo '<td>', $worksheet->getCell('C' . $row)->getFormattedValue(), '</td>'; |
|
75 | + echo '<td>', $worksheet->getCell('D' . $row)->getValue(), '</td>'; |
|
76 | + echo '<td>', $worksheet->getCell('D' . $row)->getFormattedValue(), '</td>'; |
|
77 | + echo '<td>', $worksheet->getCell('E' . $row)->getFormattedValue(), '</td>'; |
|
78 | 78 | echo '</tr>'; |
79 | 79 | } |
80 | 80 | ?> |
@@ -33,18 +33,18 @@ discard block |
||
33 | 33 | |
34 | 34 | // Add some data |
35 | 35 | $testDates = array( '3:15', '13:15', '15:15:15', '3:15 AM', '3:15 PM', '5PM', '9:15AM', '13:15AM' |
36 | - ); |
|
36 | + ); |
|
37 | 37 | $testDateCount = count($testDates); |
38 | 38 | |
39 | 39 | for($row = 1; $row <= $testDateCount; ++$row) { |
40 | - $worksheet->setCellValue('A'.$row, $testDates[$row-1]); |
|
41 | - $worksheet->setCellValue('B'.$row, '=TIMEVALUE(A'.$row.')'); |
|
42 | - $worksheet->setCellValue('C'.$row, '=B'.$row); |
|
40 | + $worksheet->setCellValue('A'.$row, $testDates[$row-1]); |
|
41 | + $worksheet->setCellValue('B'.$row, '=TIMEVALUE(A'.$row.')'); |
|
42 | + $worksheet->setCellValue('C'.$row, '=B'.$row); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | $worksheet->getStyle('C1:C'.$testDateCount) |
46 | - ->getNumberFormat() |
|
47 | - ->setFormatCode('hh:mm:ss'); |
|
46 | + ->getNumberFormat() |
|
47 | + ->setFormatCode('hh:mm:ss'); |
|
48 | 48 | |
49 | 49 | |
50 | 50 | echo '<hr />'; |
@@ -60,13 +60,13 @@ discard block |
||
60 | 60 | <th>Formatted TimeStamp</th> |
61 | 61 | </tr> |
62 | 62 | <?php |
63 | - for ($row = 1; $row <= $testDateCount; ++$row) { |
|
64 | - echo '<tr>'; |
|
65 | - echo '<td>' , $worksheet->getCell('A'.$row)->getFormattedValue() , '</td>'; |
|
66 | - echo '<td>' , $worksheet->getCell('B'.$row)->getValue() , '</td>'; |
|
67 | - echo '<td>' , $worksheet->getCell('B'.$row)->getFormattedValue() , '</td>'; |
|
68 | - echo '<td>' , $worksheet->getCell('C'.$row)->getFormattedValue() , '</td>'; |
|
69 | - echo '</tr>'; |
|
70 | - } |
|
71 | - ?> |
|
63 | + for ($row = 1; $row <= $testDateCount; ++$row) { |
|
64 | + echo '<tr>'; |
|
65 | + echo '<td>' , $worksheet->getCell('A'.$row)->getFormattedValue() , '</td>'; |
|
66 | + echo '<td>' , $worksheet->getCell('B'.$row)->getValue() , '</td>'; |
|
67 | + echo '<td>' , $worksheet->getCell('B'.$row)->getFormattedValue() , '</td>'; |
|
68 | + echo '<td>' , $worksheet->getCell('C'.$row)->getFormattedValue() , '</td>'; |
|
69 | + echo '</tr>'; |
|
70 | + } |
|
71 | + ?> |
|
72 | 72 | </table> |
73 | 73 | \ No newline at end of file |
@@ -32,17 +32,17 @@ discard block |
||
32 | 32 | $worksheet = $objPHPExcel->getActiveSheet(); |
33 | 33 | |
34 | 34 | // Add some data |
35 | -$testDates = array( '3:15', '13:15', '15:15:15', '3:15 AM', '3:15 PM', '5PM', '9:15AM', '13:15AM' |
|
35 | +$testDates = array('3:15', '13:15', '15:15:15', '3:15 AM', '3:15 PM', '5PM', '9:15AM', '13:15AM' |
|
36 | 36 | ); |
37 | 37 | $testDateCount = count($testDates); |
38 | 38 | |
39 | -for($row = 1; $row <= $testDateCount; ++$row) { |
|
40 | - $worksheet->setCellValue('A'.$row, $testDates[$row-1]); |
|
41 | - $worksheet->setCellValue('B'.$row, '=TIMEVALUE(A'.$row.')'); |
|
42 | - $worksheet->setCellValue('C'.$row, '=B'.$row); |
|
39 | +for ($row = 1; $row <= $testDateCount; ++$row) { |
|
40 | + $worksheet->setCellValue('A' . $row, $testDates[$row - 1]); |
|
41 | + $worksheet->setCellValue('B' . $row, '=TIMEVALUE(A' . $row . ')'); |
|
42 | + $worksheet->setCellValue('C' . $row, '=B' . $row); |
|
43 | 43 | } |
44 | 44 | |
45 | -$worksheet->getStyle('C1:C'.$testDateCount) |
|
45 | +$worksheet->getStyle('C1:C' . $testDateCount) |
|
46 | 46 | ->getNumberFormat() |
47 | 47 | ->setFormatCode('hh:mm:ss'); |
48 | 48 | |
@@ -62,10 +62,10 @@ discard block |
||
62 | 62 | <?php |
63 | 63 | for ($row = 1; $row <= $testDateCount; ++$row) { |
64 | 64 | echo '<tr>'; |
65 | - echo '<td>' , $worksheet->getCell('A'.$row)->getFormattedValue() , '</td>'; |
|
66 | - echo '<td>' , $worksheet->getCell('B'.$row)->getValue() , '</td>'; |
|
67 | - echo '<td>' , $worksheet->getCell('B'.$row)->getFormattedValue() , '</td>'; |
|
68 | - echo '<td>' , $worksheet->getCell('C'.$row)->getFormattedValue() , '</td>'; |
|
65 | + echo '<td>', $worksheet->getCell('A' . $row)->getFormattedValue(), '</td>'; |
|
66 | + echo '<td>', $worksheet->getCell('B' . $row)->getValue(), '</td>'; |
|
67 | + echo '<td>', $worksheet->getCell('B' . $row)->getFormattedValue(), '</td>'; |
|
68 | + echo '<td>', $worksheet->getCell('C' . $row)->getFormattedValue(), '</td>'; |
|
69 | 69 | echo '</tr>'; |
70 | 70 | } |
71 | 71 | ?> |
@@ -23,27 +23,27 @@ |
||
23 | 23 | |
24 | 24 | foreach($exampleTypeList as $exampleType) { |
25 | 25 | |
26 | - echo '<h2>' . pathinfo($exampleType,PATHINFO_BASENAME) . ' Function Examples</h2>'; |
|
26 | + echo '<h2>' . pathinfo($exampleType,PATHINFO_BASENAME) . ' Function Examples</h2>'; |
|
27 | 27 | |
28 | - $exampleList = glob('./'.$exampleType.'/*.php'); |
|
28 | + $exampleList = glob('./'.$exampleType.'/*.php'); |
|
29 | 29 | |
30 | - foreach($exampleList as $exampleFile) { |
|
31 | - $fileData = file_get_contents($exampleFile); |
|
30 | + foreach($exampleList as $exampleFile) { |
|
31 | + $fileData = file_get_contents($exampleFile); |
|
32 | 32 | |
33 | - $h1Pattern = '#<h1>(.*?)</h1>#'; |
|
34 | - $h2Pattern = '#<h2>(.*?)</h2>#'; |
|
33 | + $h1Pattern = '#<h1>(.*?)</h1>#'; |
|
34 | + $h2Pattern = '#<h2>(.*?)</h2>#'; |
|
35 | 35 | |
36 | - if (preg_match($h1Pattern, $fileData, $out)) { |
|
37 | - $h1Text = $out[1]; |
|
38 | - $h2Text = (preg_match($h2Pattern, $fileData, $out)) ? $out[1] : ''; |
|
36 | + if (preg_match($h1Pattern, $fileData, $out)) { |
|
37 | + $h1Text = $out[1]; |
|
38 | + $h2Text = (preg_match($h2Pattern, $fileData, $out)) ? $out[1] : ''; |
|
39 | 39 | |
40 | - echo '<a href="',$exampleFile,'">',$h1Text,'</a><br />'; |
|
41 | - if ($h2Text > '') { |
|
42 | - echo $h2Text,'<br />'; |
|
43 | - } |
|
44 | - } |
|
40 | + echo '<a href="',$exampleFile,'">',$h1Text,'</a><br />'; |
|
41 | + if ($h2Text > '') { |
|
42 | + echo $h2Text,'<br />'; |
|
43 | + } |
|
44 | + } |
|
45 | 45 | |
46 | - } |
|
46 | + } |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | ?> |
@@ -19,15 +19,15 @@ discard block |
||
19 | 19 | |
20 | 20 | echo '<h1>PHPExcel Calculation Function Examples</h1>'; |
21 | 21 | |
22 | -$exampleTypeList = glob('./*',GLOB_ONLYDIR); |
|
22 | +$exampleTypeList = glob('./*', GLOB_ONLYDIR); |
|
23 | 23 | |
24 | -foreach($exampleTypeList as $exampleType) { |
|
24 | +foreach ($exampleTypeList as $exampleType) { |
|
25 | 25 | |
26 | - echo '<h2>' . pathinfo($exampleType,PATHINFO_BASENAME) . ' Function Examples</h2>'; |
|
26 | + echo '<h2>' . pathinfo($exampleType, PATHINFO_BASENAME) . ' Function Examples</h2>'; |
|
27 | 27 | |
28 | - $exampleList = glob('./'.$exampleType.'/*.php'); |
|
28 | + $exampleList = glob('./' . $exampleType . '/*.php'); |
|
29 | 29 | |
30 | - foreach($exampleList as $exampleFile) { |
|
30 | + foreach ($exampleList as $exampleFile) { |
|
31 | 31 | $fileData = file_get_contents($exampleFile); |
32 | 32 | |
33 | 33 | $h1Pattern = '#<h1>(.*?)</h1>#'; |
@@ -37,9 +37,9 @@ discard block |
||
37 | 37 | $h1Text = $out[1]; |
38 | 38 | $h2Text = (preg_match($h2Pattern, $fileData, $out)) ? $out[1] : ''; |
39 | 39 | |
40 | - echo '<a href="',$exampleFile,'">',$h1Text,'</a><br />'; |
|
40 | + echo '<a href="', $exampleFile, '">', $h1Text, '</a><br />'; |
|
41 | 41 | if ($h2Text > '') { |
42 | - echo $h2Text,'<br />'; |
|
42 | + echo $h2Text, '<br />'; |
|
43 | 43 | } |
44 | 44 | } |
45 | 45 |
@@ -39,53 +39,53 @@ |
||
39 | 39 | |
40 | 40 | /** Read the document's creator property **/ |
41 | 41 | $creator = $objPHPExcel->getProperties()->getCreator(); |
42 | -echo '<b>Document Creator: </b>',$creator,'<br />'; |
|
42 | +echo '<b>Document Creator: </b>', $creator, '<br />'; |
|
43 | 43 | |
44 | 44 | /** Read the Date when the workbook was created (as a PHP timestamp value) **/ |
45 | 45 | $creationDatestamp = $objPHPExcel->getProperties()->getCreated(); |
46 | 46 | /** Format the date and time using the standard PHP date() function **/ |
47 | -$creationDate = date('l, d<\s\up>S</\s\up> F Y',$creationDatestamp); |
|
48 | -$creationTime = date('g:i A',$creationDatestamp); |
|
49 | -echo '<b>Created On: </b>',$creationDate,' at ',$creationTime,'<br />'; |
|
47 | +$creationDate = date('l, d<\s\up>S</\s\up> F Y', $creationDatestamp); |
|
48 | +$creationTime = date('g:i A', $creationDatestamp); |
|
49 | +echo '<b>Created On: </b>', $creationDate, ' at ', $creationTime, '<br />'; |
|
50 | 50 | |
51 | 51 | /** Read the name of the last person to modify this workbook **/ |
52 | 52 | $modifiedBy = $objPHPExcel->getProperties()->getLastModifiedBy(); |
53 | -echo '<b>Last Modified By: </b>',$modifiedBy,'<br />'; |
|
53 | +echo '<b>Last Modified By: </b>', $modifiedBy, '<br />'; |
|
54 | 54 | |
55 | 55 | /** Read the Date when the workbook was last modified (as a PHP timestamp value) **/ |
56 | 56 | $modifiedDatestamp = $objPHPExcel->getProperties()->getModified(); |
57 | 57 | /** Format the date and time using the standard PHP date() function **/ |
58 | -$modifiedDate = date('l, d<\s\up>S</\s\up> F Y',$modifiedDatestamp); |
|
59 | -$modifiedTime = date('g:i A',$modifiedDatestamp); |
|
60 | -echo '<b>Last Modified On: </b>',$modifiedDate,' at ',$modifiedTime,'<br />'; |
|
58 | +$modifiedDate = date('l, d<\s\up>S</\s\up> F Y', $modifiedDatestamp); |
|
59 | +$modifiedTime = date('g:i A', $modifiedDatestamp); |
|
60 | +echo '<b>Last Modified On: </b>', $modifiedDate, ' at ', $modifiedTime, '<br />'; |
|
61 | 61 | |
62 | 62 | /** Read the workbook title property **/ |
63 | 63 | $workbookTitle = $objPHPExcel->getProperties()->getTitle(); |
64 | -echo '<b>Title: </b>',$workbookTitle,'<br />'; |
|
64 | +echo '<b>Title: </b>', $workbookTitle, '<br />'; |
|
65 | 65 | |
66 | 66 | /** Read the workbook description property **/ |
67 | 67 | $description = $objPHPExcel->getProperties()->getDescription(); |
68 | -echo '<b>Description: </b>',$description,'<br />'; |
|
68 | +echo '<b>Description: </b>', $description, '<br />'; |
|
69 | 69 | |
70 | 70 | /** Read the workbook subject property **/ |
71 | 71 | $subject = $objPHPExcel->getProperties()->getSubject(); |
72 | -echo '<b>Subject: </b>',$subject,'<br />'; |
|
72 | +echo '<b>Subject: </b>', $subject, '<br />'; |
|
73 | 73 | |
74 | 74 | /** Read the workbook keywords property **/ |
75 | 75 | $keywords = $objPHPExcel->getProperties()->getKeywords(); |
76 | -echo '<b>Keywords: </b>',$keywords,'<br />'; |
|
76 | +echo '<b>Keywords: </b>', $keywords, '<br />'; |
|
77 | 77 | |
78 | 78 | /** Read the workbook category property **/ |
79 | 79 | $category = $objPHPExcel->getProperties()->getCategory(); |
80 | -echo '<b>Category: </b>',$category,'<br />'; |
|
80 | +echo '<b>Category: </b>', $category, '<br />'; |
|
81 | 81 | |
82 | 82 | /** Read the workbook company property **/ |
83 | 83 | $company = $objPHPExcel->getProperties()->getCompany(); |
84 | -echo '<b>Company: </b>',$company,'<br />'; |
|
84 | +echo '<b>Company: </b>', $company, '<br />'; |
|
85 | 85 | |
86 | 86 | /** Read the workbook manager property **/ |
87 | 87 | $manager = $objPHPExcel->getProperties()->getManager(); |
88 | -echo '<b>Manager: </b>',$manager,'<br />'; |
|
88 | +echo '<b>Manager: </b>', $manager, '<br />'; |
|
89 | 89 | |
90 | 90 | |
91 | 91 | ?> |
@@ -46,7 +46,7 @@ |
||
46 | 46 | /** Use the PHPExcel object's getSheetNames() method to get an array listing the names/titles of the WorkSheets in the WorkBook */ |
47 | 47 | $sheetNames = $objPHPExcel->getSheetNames(); |
48 | 48 | foreach($sheetNames as $sheetIndex => $sheetName) { |
49 | - echo 'WorkSheet #',$sheetIndex,' is named "',$sheetName,'"<br />'; |
|
49 | + echo 'WorkSheet #',$sheetIndex,' is named "',$sheetName,'"<br />'; |
|
50 | 50 | } |
51 | 51 | |
52 | 52 |
@@ -40,13 +40,13 @@ |
||
40 | 40 | echo 'Reading the number of Worksheets in the WorkBook<br />'; |
41 | 41 | /** Use the PHPExcel object's getSheetCount() method to get a count of the number of WorkSheets in the WorkBook */ |
42 | 42 | $sheetCount = $objPHPExcel->getSheetCount(); |
43 | -echo 'There ',(($sheetCount == 1) ? 'is' : 'are'),' ',$sheetCount,' WorkSheet',(($sheetCount == 1) ? '' : 's'),' in the WorkBook<br /><br />'; |
|
43 | +echo 'There ', (($sheetCount == 1) ? 'is' : 'are'), ' ', $sheetCount, ' WorkSheet', (($sheetCount == 1) ? '' : 's'), ' in the WorkBook<br /><br />'; |
|
44 | 44 | |
45 | 45 | echo 'Reading the names of Worksheets in the WorkBook<br />'; |
46 | 46 | /** Use the PHPExcel object's getSheetNames() method to get an array listing the names/titles of the WorkSheets in the WorkBook */ |
47 | 47 | $sheetNames = $objPHPExcel->getSheetNames(); |
48 | -foreach($sheetNames as $sheetIndex => $sheetName) { |
|
49 | - echo 'WorkSheet #',$sheetIndex,' is named "',$sheetName,'"<br />'; |
|
48 | +foreach ($sheetNames as $sheetIndex => $sheetName) { |
|
49 | + echo 'WorkSheet #', $sheetIndex, ' is named "', $sheetName, '"<br />'; |
|
50 | 50 | } |
51 | 51 | |
52 | 52 |
@@ -42,7 +42,7 @@ |
||
42 | 42 | |
43 | 43 | echo '<b>Custom Property names: </b><br />'; |
44 | 44 | foreach($customPropertyList as $customPropertyName) { |
45 | - echo $customPropertyName,'<br />'; |
|
45 | + echo $customPropertyName,'<br />'; |
|
46 | 46 | } |
47 | 47 | |
48 | 48 |
@@ -41,8 +41,8 @@ |
||
41 | 41 | $customPropertyList = $objPHPExcel->getProperties()->getCustomProperties(); |
42 | 42 | |
43 | 43 | echo '<b>Custom Property names: </b><br />'; |
44 | -foreach($customPropertyList as $customPropertyName) { |
|
45 | - echo $customPropertyName,'<br />'; |
|
44 | +foreach ($customPropertyList as $customPropertyName) { |
|
45 | + echo $customPropertyName, '<br />'; |
|
46 | 46 | } |
47 | 47 | |
48 | 48 |