@@ -77,23 +77,23 @@ |
||
77 | 77 | // Export to PDF (.pdf) |
78 | 78 | echo date('H:i:s') , " Write to PDF format" , EOL; |
79 | 79 | try { |
80 | - if (!\PHPExcel\Settings::setPdfRenderer( |
|
81 | - $rendererName, |
|
82 | - $rendererLibraryPath |
|
83 | - )) { |
|
84 | - echo ( |
|
85 | - 'NOTICE: Please set the $rendererName and $rendererLibraryPath values' . |
|
86 | - EOL . |
|
87 | - 'at the top of this script as appropriate for your directory structure' . |
|
88 | - EOL |
|
89 | - ); |
|
90 | - } else { |
|
91 | - $objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'PDF'); |
|
92 | - $objWriter->save(str_replace('.php', '.pdf', __FILE__)); |
|
93 | - echo date('H:i:s') , " File written to " , str_replace('.php', '.pdf', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; |
|
94 | - } |
|
80 | + if (!\PHPExcel\Settings::setPdfRenderer( |
|
81 | + $rendererName, |
|
82 | + $rendererLibraryPath |
|
83 | + )) { |
|
84 | + echo ( |
|
85 | + 'NOTICE: Please set the $rendererName and $rendererLibraryPath values' . |
|
86 | + EOL . |
|
87 | + 'at the top of this script as appropriate for your directory structure' . |
|
88 | + EOL |
|
89 | + ); |
|
90 | + } else { |
|
91 | + $objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'PDF'); |
|
92 | + $objWriter->save(str_replace('.php', '.pdf', __FILE__)); |
|
93 | + echo date('H:i:s') , " File written to " , str_replace('.php', '.pdf', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; |
|
94 | + } |
|
95 | 95 | } catch (Exception $e) { |
96 | - echo date('H:i:s') , ' EXCEPTION: ', $e->getMessage() , EOL; |
|
96 | + echo date('H:i:s') , ' EXCEPTION: ', $e->getMessage() , EOL; |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | // Remove first two rows with field headers before exporting to CSV |
@@ -52,12 +52,12 @@ discard block |
||
52 | 52 | // Set document properties |
53 | 53 | echo date('H:i:s') , " Set properties" , EOL; |
54 | 54 | $objPHPExcel->getProperties()->setCreator("Maarten Balliauw") |
55 | - ->setLastModifiedBy("Maarten Balliauw") |
|
56 | - ->setTitle("Office 2007 XLSX Test Document") |
|
57 | - ->setSubject("Office 2007 XLSX Test Document") |
|
58 | - ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.") |
|
59 | - ->setKeywords("office 2007 openxml php") |
|
60 | - ->setCategory("Test result file"); |
|
55 | + ->setLastModifiedBy("Maarten Balliauw") |
|
56 | + ->setTitle("Office 2007 XLSX Test Document") |
|
57 | + ->setSubject("Office 2007 XLSX Test Document") |
|
58 | + ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.") |
|
59 | + ->setKeywords("office 2007 openxml php") |
|
60 | + ->setCategory("Test result file"); |
|
61 | 61 | |
62 | 62 | |
63 | 63 | // Create a first sheet |
@@ -79,8 +79,8 @@ discard block |
||
79 | 79 | // Set outline levels |
80 | 80 | echo date('H:i:s') , " Set outline levels" , EOL; |
81 | 81 | $objPHPExcel->getActiveSheet()->getColumnDimension('E')->setOutlineLevel(1) |
82 | - ->setVisible(false) |
|
83 | - ->setCollapsed(true); |
|
82 | + ->setVisible(false) |
|
83 | + ->setCollapsed(true); |
|
84 | 84 | |
85 | 85 | // Freeze panes |
86 | 86 | echo date('H:i:s') , " Freeze panes" , EOL; |
@@ -94,11 +94,11 @@ discard block |
||
94 | 94 | |
95 | 95 | // Add data |
96 | 96 | for ($i = 2; $i <= 5000; $i++) { |
97 | - $objPHPExcel->getActiveSheet()->setCellValue('A' . $i, "FName $i") |
|
98 | - ->setCellValue('B' . $i, "LName $i") |
|
99 | - ->setCellValue('C' . $i, "PhoneNo $i") |
|
100 | - ->setCellValue('D' . $i, "FaxNo $i") |
|
101 | - ->setCellValue('E' . $i, true); |
|
97 | + $objPHPExcel->getActiveSheet()->setCellValue('A' . $i, "FName $i") |
|
98 | + ->setCellValue('B' . $i, "LName $i") |
|
99 | + ->setCellValue('C' . $i, "PhoneNo $i") |
|
100 | + ->setCellValue('D' . $i, "FaxNo $i") |
|
101 | + ->setCellValue('E' . $i, true); |
|
102 | 102 | } |
103 | 103 | |
104 | 104 |
@@ -43,13 +43,13 @@ discard block |
||
43 | 43 | $objPHPExcel = new \PHPExcel\Spreadsheet(); |
44 | 44 | $objWorksheet = $objPHPExcel->getActiveSheet(); |
45 | 45 | $objWorksheet->fromArray( |
46 | - array( |
|
47 | - array('', 2010, 2011, 2012), |
|
48 | - array('Q1', 12, 15, 21), |
|
49 | - array('Q2', 56, 73, 86), |
|
50 | - array('Q3', 52, 61, 69), |
|
51 | - array('Q4', 30, 32, 0), |
|
52 | - ) |
|
46 | + array( |
|
47 | + array('', 2010, 2011, 2012), |
|
48 | + array('Q1', 12, 15, 21), |
|
49 | + array('Q2', 56, 73, 86), |
|
50 | + array('Q3', 52, 61, 69), |
|
51 | + array('Q4', 30, 32, 0), |
|
52 | + ) |
|
53 | 53 | ); |
54 | 54 | |
55 | 55 | // Set the Labels for each data series we want to plot |
@@ -60,9 +60,9 @@ discard block |
||
60 | 60 | // Data values |
61 | 61 | // Data Marker |
62 | 62 | $dataSeriesLabels = array( |
63 | - new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$B$1', NULL, 1), // 2010 |
|
64 | - new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$C$1', NULL, 1), // 2011 |
|
65 | - new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$D$1', NULL, 1), // 2012 |
|
63 | + new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$B$1', NULL, 1), // 2010 |
|
64 | + new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$C$1', NULL, 1), // 2011 |
|
65 | + new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$D$1', NULL, 1), // 2012 |
|
66 | 66 | ); |
67 | 67 | // Set the X-Axis Labels |
68 | 68 | // Datatype |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | // Data values |
73 | 73 | // Data Marker |
74 | 74 | $xAxisTickValues = array( |
75 | - new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$5', NULL, 4), // Q1 to Q4 |
|
75 | + new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$5', NULL, 4), // Q1 to Q4 |
|
76 | 76 | ); |
77 | 77 | // Set the Data values for each data series we want to plot |
78 | 78 | // Datatype |
@@ -82,19 +82,19 @@ discard block |
||
82 | 82 | // Data values |
83 | 83 | // Data Marker |
84 | 84 | $dataSeriesValues = array( |
85 | - new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$B$2:$B$5', NULL, 4), |
|
86 | - new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', NULL, 4), |
|
87 | - new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$D$2:$D$5', NULL, 4), |
|
85 | + new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$B$2:$B$5', NULL, 4), |
|
86 | + new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', NULL, 4), |
|
87 | + new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$D$2:$D$5', NULL, 4), |
|
88 | 88 | ); |
89 | 89 | |
90 | 90 | // Build the dataseries |
91 | 91 | $series = new \PHPExcel\Chart\DataSeries( |
92 | - \PHPExcel\Chart\DataSeries::TYPE_BARCHART, // plotType |
|
93 | - \PHPExcel\Chart\DataSeries::GROUPING_CLUSTERED, // plotGrouping |
|
94 | - range(0, count($dataSeriesValues)-1), // plotOrder |
|
95 | - $dataSeriesLabels, // plotLabel |
|
96 | - $xAxisTickValues, // plotCategory |
|
97 | - $dataSeriesValues // plotValues |
|
92 | + \PHPExcel\Chart\DataSeries::TYPE_BARCHART, // plotType |
|
93 | + \PHPExcel\Chart\DataSeries::GROUPING_CLUSTERED, // plotGrouping |
|
94 | + range(0, count($dataSeriesValues)-1), // plotOrder |
|
95 | + $dataSeriesLabels, // plotLabel |
|
96 | + $xAxisTickValues, // plotCategory |
|
97 | + $dataSeriesValues // plotValues |
|
98 | 98 | ); |
99 | 99 | // Set additional dataseries parameters |
100 | 100 | // Make it a horizontal bar rather than a vertical column graph |
@@ -111,14 +111,14 @@ discard block |
||
111 | 111 | |
112 | 112 | // Create the chart |
113 | 113 | $chart = new \PHPExcel\Chart( |
114 | - 'chart1', // name |
|
115 | - $title, // title |
|
116 | - $legend, // legend |
|
117 | - $plotArea, // plotArea |
|
118 | - true, // plotVisibleOnly |
|
119 | - 0, // displayBlanksAs |
|
120 | - NULL, // xAxisLabel |
|
121 | - $yAxisLabel // yAxisLabel |
|
114 | + 'chart1', // name |
|
115 | + $title, // title |
|
116 | + $legend, // legend |
|
117 | + $plotArea, // plotArea |
|
118 | + true, // plotVisibleOnly |
|
119 | + 0, // displayBlanksAs |
|
120 | + NULL, // xAxisLabel |
|
121 | + $yAxisLabel // yAxisLabel |
|
122 | 122 | ); |
123 | 123 | |
124 | 124 | // Set the position where the chart should appear in the worksheet |
@@ -44,12 +44,12 @@ |
||
44 | 44 | // Set document properties |
45 | 45 | echo date('H:i:s') , " Set document properties" , EOL; |
46 | 46 | $objPHPExcel->getProperties()->setCreator("PHPOffice") |
47 | - ->setLastModifiedBy("PHPOffice") |
|
48 | - ->setTitle("PHPExcel Test Document") |
|
49 | - ->setSubject("PHPExcel Test Document") |
|
50 | - ->setDescription("Test document for PHPExcel, generated using PHP classes.") |
|
51 | - ->setKeywords("Office PHPExcel php") |
|
52 | - ->setCategory("Test result file"); |
|
47 | + ->setLastModifiedBy("PHPOffice") |
|
48 | + ->setTitle("PHPExcel Test Document") |
|
49 | + ->setSubject("PHPExcel Test Document") |
|
50 | + ->setDescription("Test document for PHPExcel, generated using PHP classes.") |
|
51 | + ->setKeywords("Office PHPExcel php") |
|
52 | + ->setCategory("Test result file"); |
|
53 | 53 | |
54 | 54 | |
55 | 55 | // Add some data |
@@ -44,12 +44,12 @@ |
||
44 | 44 | // Set document properties |
45 | 45 | echo date('H:i:s') , " Set document properties" , EOL; |
46 | 46 | $objPHPExcel->getProperties()->setCreator("Maarten Balliauw") |
47 | - ->setLastModifiedBy("Maarten Balliauw") |
|
48 | - ->setTitle("PHPExcel Test Document") |
|
49 | - ->setSubject("PHPExcel Test Document") |
|
50 | - ->setDescription("Test document for PHPExcel, generated using PHP classes.") |
|
51 | - ->setKeywords("office PHPExcel php") |
|
52 | - ->setCategory("Test result file"); |
|
47 | + ->setLastModifiedBy("Maarten Balliauw") |
|
48 | + ->setTitle("PHPExcel Test Document") |
|
49 | + ->setSubject("PHPExcel Test Document") |
|
50 | + ->setDescription("Test document for PHPExcel, generated using PHP classes.") |
|
51 | + ->setKeywords("office PHPExcel php") |
|
52 | + ->setCategory("Test result file"); |
|
53 | 53 | |
54 | 54 | |
55 | 55 | // Add some data |
@@ -45,12 +45,12 @@ |
||
45 | 45 | echo date('H:i:s') , " Set document properties" , EOL; |
46 | 46 | $objPHPExcel->getProperties() |
47 | 47 | ->setCreator("PHPOffice") |
48 | - ->setLastModifiedBy("PHPOffice") |
|
49 | - ->setTitle("PHPExcel Test Document") |
|
50 | - ->setSubject("PHPExcel Test Document") |
|
51 | - ->setDescription("Test document for PHPExcel, generated using PHP classes.") |
|
52 | - ->setKeywords("Office PHPExcel php") |
|
53 | - ->setCategory("Test result file"); |
|
48 | + ->setLastModifiedBy("PHPOffice") |
|
49 | + ->setTitle("PHPExcel Test Document") |
|
50 | + ->setSubject("PHPExcel Test Document") |
|
51 | + ->setDescription("Test document for PHPExcel, generated using PHP classes.") |
|
52 | + ->setKeywords("Office PHPExcel php") |
|
53 | + ->setCategory("Test result file"); |
|
54 | 54 | |
55 | 55 | |
56 | 56 | function transpose($value) { |
@@ -33,33 +33,33 @@ |
||
33 | 33 | <?php |
34 | 34 | /** If the user has submitted the form, then we need to execute a calculation **/ |
35 | 35 | if (isset($_POST['submit'])) { |
36 | - if ($_POST['A'] == 0) { |
|
37 | - echo 'The equation is not quadratic'; |
|
38 | - } else { |
|
39 | - /** So we include PHPExcel to perform the calculations **/ |
|
40 | - include 'PHPExcel/IOFactory.php'; |
|
36 | + if ($_POST['A'] == 0) { |
|
37 | + echo 'The equation is not quadratic'; |
|
38 | + } else { |
|
39 | + /** So we include PHPExcel to perform the calculations **/ |
|
40 | + include 'PHPExcel/IOFactory.php'; |
|
41 | 41 | |
42 | - /** Load the quadratic equation solver worksheet into memory **/ |
|
43 | - $objPHPExcel = \PHPExcel\IOFactory::load('./Quadratic.xlsx'); |
|
42 | + /** Load the quadratic equation solver worksheet into memory **/ |
|
43 | + $objPHPExcel = \PHPExcel\IOFactory::load('./Quadratic.xlsx'); |
|
44 | 44 | |
45 | - /** Set our A, B and C values **/ |
|
46 | - $objPHPExcel->getActiveSheet()->setCellValue('A1', $_POST['A']); |
|
47 | - $objPHPExcel->getActiveSheet()->setCellValue('B1', $_POST['B']); |
|
48 | - $objPHPExcel->getActiveSheet()->setCellValue('C1', $_POST['C']); |
|
45 | + /** Set our A, B and C values **/ |
|
46 | + $objPHPExcel->getActiveSheet()->setCellValue('A1', $_POST['A']); |
|
47 | + $objPHPExcel->getActiveSheet()->setCellValue('B1', $_POST['B']); |
|
48 | + $objPHPExcel->getActiveSheet()->setCellValue('C1', $_POST['C']); |
|
49 | 49 | |
50 | 50 | |
51 | - /** Calculate and Display the results **/ |
|
52 | - echo '<hr /><b>Roots:</b><br />'; |
|
51 | + /** Calculate and Display the results **/ |
|
52 | + echo '<hr /><b>Roots:</b><br />'; |
|
53 | 53 | |
54 | - $callStartTime = microtime(true); |
|
55 | - echo $objPHPExcel->getActiveSheet()->getCell('B5')->getCalculatedValue().'<br />'; |
|
56 | - echo $objPHPExcel->getActiveSheet()->getCell('B6')->getCalculatedValue().'<br />'; |
|
57 | - $callEndTime = microtime(true); |
|
58 | - $callTime = $callEndTime - $callStartTime; |
|
54 | + $callStartTime = microtime(true); |
|
55 | + echo $objPHPExcel->getActiveSheet()->getCell('B5')->getCalculatedValue().'<br />'; |
|
56 | + echo $objPHPExcel->getActiveSheet()->getCell('B6')->getCalculatedValue().'<br />'; |
|
57 | + $callEndTime = microtime(true); |
|
58 | + $callTime = $callEndTime - $callStartTime; |
|
59 | 59 | |
60 | - echo '<hr />Call time for Quadratic Equation Solution was '.sprintf('%.4f',$callTime).' seconds<br /><hr />'; |
|
61 | - echo ' Peak memory usage: '.(memory_get_peak_usage(true) / 1024 / 1024).' MB<br />'; |
|
62 | - } |
|
60 | + echo '<hr />Call time for Quadratic Equation Solution was '.sprintf('%.4f',$callTime).' seconds<br /><hr />'; |
|
61 | + echo ' Peak memory usage: '.(memory_get_peak_usage(true) / 1024 / 1024).' MB<br />'; |
|
62 | + } |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | ?> |
@@ -38,7 +38,7 @@ |
||
38 | 38 | |
39 | 39 | |
40 | 40 | if (!file_exists("05featuredemo.xlsx")) { |
41 | - exit("Please run 05featuredemo.php first." . EOL); |
|
41 | + exit("Please run 05featuredemo.php first." . EOL); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | echo date('H:i:s') , " Load from Excel2007 file" , EOL; |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | require_once dirname(__FILE__) . '/../src/Bootstrap.php'; |
41 | 41 | |
42 | 42 | if (!file_exists("33chartcreate-bar.xlsx")) { |
43 | - exit("Please run 33chartcreate-bar.php first." . EOL); |
|
43 | + exit("Please run 33chartcreate-bar.php first." . EOL); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | echo date('H:i:s') , " Load from Excel2007 file" , EOL; |
@@ -52,14 +52,14 @@ discard block |
||
52 | 52 | echo date('H:i:s') , " Update cell data values that are displayed in the chart" , EOL; |
53 | 53 | $objWorksheet = $objPHPExcel->getActiveSheet(); |
54 | 54 | $objWorksheet->fromArray( |
55 | - array( |
|
56 | - array(50-12, 50-15, 50-21), |
|
57 | - array(50-56, 50-73, 50-86), |
|
58 | - array(50-52, 50-61, 50-69), |
|
59 | - array(50-30, 50-32, 50), |
|
60 | - ), |
|
61 | - NULL, |
|
62 | - 'B2' |
|
55 | + array( |
|
56 | + array(50-12, 50-15, 50-21), |
|
57 | + array(50-56, 50-73, 50-86), |
|
58 | + array(50-52, 50-61, 50-69), |
|
59 | + array(50-30, 50-32, 50), |
|
60 | + ), |
|
61 | + NULL, |
|
62 | + 'B2' |
|
63 | 63 | ); |
64 | 64 | |
65 | 65 | // Save Excel 2007 file |