@@ -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 |
@@ -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 |
@@ -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 |
@@ -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 |
@@ -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 |
@@ -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 |
@@ -43,34 +43,34 @@ |
||
43 | 43 | echo '<b>Custom Properties: </b><br />'; |
44 | 44 | /** Loop through the list of custom properties **/ |
45 | 45 | foreach($customPropertyList as $customPropertyName) { |
46 | - echo '<b>',$customPropertyName,': </b>'; |
|
47 | - /** Retrieve the property value **/ |
|
48 | - $propertyValue = $objPHPExcel->getProperties()->getCustomPropertyValue($customPropertyName); |
|
49 | - /** Retrieve the property type **/ |
|
50 | - $propertyType = $objPHPExcel->getProperties()->getCustomPropertyType($customPropertyName); |
|
51 | - |
|
52 | - /** Manipulate properties as appropriate for display purposes **/ |
|
53 | - switch($propertyType) { |
|
54 | - case 'i' : // integer |
|
55 | - $propertyType = 'integer number'; |
|
56 | - break; |
|
57 | - case 'f' : // float |
|
58 | - $propertyType = 'floating point number'; |
|
59 | - break; |
|
60 | - case 's' : // string |
|
61 | - $propertyType = 'string'; |
|
62 | - break; |
|
63 | - case 'd' : // date |
|
64 | - $propertyValue = date('l, d<\s\up>S</\s\up> F Y g:i A',$propertyValue); |
|
65 | - $propertyType = 'date'; |
|
66 | - break; |
|
67 | - case 'b' : // boolean |
|
68 | - $propertyValue = ($propertyValue) ? 'TRUE' : 'FALSE'; |
|
69 | - $propertyType = 'boolean'; |
|
70 | - break; |
|
71 | - } |
|
72 | - |
|
73 | - echo $propertyValue,' (',$propertyType,')<br />'; |
|
46 | + echo '<b>',$customPropertyName,': </b>'; |
|
47 | + /** Retrieve the property value **/ |
|
48 | + $propertyValue = $objPHPExcel->getProperties()->getCustomPropertyValue($customPropertyName); |
|
49 | + /** Retrieve the property type **/ |
|
50 | + $propertyType = $objPHPExcel->getProperties()->getCustomPropertyType($customPropertyName); |
|
51 | + |
|
52 | + /** Manipulate properties as appropriate for display purposes **/ |
|
53 | + switch($propertyType) { |
|
54 | + case 'i' : // integer |
|
55 | + $propertyType = 'integer number'; |
|
56 | + break; |
|
57 | + case 'f' : // float |
|
58 | + $propertyType = 'floating point number'; |
|
59 | + break; |
|
60 | + case 's' : // string |
|
61 | + $propertyType = 'string'; |
|
62 | + break; |
|
63 | + case 'd' : // date |
|
64 | + $propertyValue = date('l, d<\s\up>S</\s\up> F Y g:i A',$propertyValue); |
|
65 | + $propertyType = 'date'; |
|
66 | + break; |
|
67 | + case 'b' : // boolean |
|
68 | + $propertyValue = ($propertyValue) ? 'TRUE' : 'FALSE'; |
|
69 | + $propertyType = 'boolean'; |
|
70 | + break; |
|
71 | + } |
|
72 | + |
|
73 | + echo $propertyValue,' (',$propertyType,')<br />'; |
|
74 | 74 | } |
75 | 75 | |
76 | 76 |
@@ -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 |