From 2922a13764dc30aa4c808a038af942de3274d048 Mon Sep 17 00:00:00 2001 From: Adrien Crivelli Date: Thu, 1 Sep 2016 01:15:54 +0900 Subject: [PATCH] Reorganize code samples This introduce a helper class that should be used to log things, avoiding a lot of boilerplate code. Also all output are made in /tmp folder instead of beside the script itself. This is because there is a high chance that the folder containing the script is not writtable by webserver. So using the /tmp folder makes it more likely to works in a variety of setup. --- .php_cs | 1 + .travis.yml | 2 +- Examples/.gitignore | 12 - Examples/01pharSimple.php | 112 - Examples/01simple-download-ods.php | 88 - Examples/01simple-download-pdf.php | 103 - Examples/01simple-download-xls.php | 88 - Examples/01simple-download-xlsx.php | 88 - Examples/01simple.php | 140 - Examples/01simplePCLZip.php | 105 - Examples/02types.php | 229 - Examples/03formulas.php | 175 - Examples/04printing.php | 135 - Examples/05featuredemo.inc.php | 394 - Examples/05featuredemo.php | 74 - .../06largescale-with-cellcaching-sqlite.php | 129 - .../06largescale-with-cellcaching-sqlite3.php | 129 - Examples/06largescale-with-cellcaching.php | 128 - Examples/06largescale-xls.php | 136 - Examples/06largescale.php | 136 - Examples/07reader.php | 76 - Examples/07readerPCLZip.php | 79 - Examples/08conditionalformatting.php | 189 - Examples/08conditionalformatting2.php | 136 - Examples/09pagebreaks.php | 134 - Examples/10autofilter-selection-1.php | 221 - Examples/10autofilter-selection-2.php | 212 - Examples/10autofilter-selection-display.php | 198 - Examples/10autofilter.php | 171 - Examples/11documentsecurity-xls.php | 109 - Examples/11documentsecurity.php | 109 - Examples/12cellProtection.php | 107 - Examples/13calculation.php | 235 - Examples/13calculationCyclicFormulae.php | 97 - Examples/14excel5.php | 63 - Examples/15datavalidation-xls.php | 142 - Examples/15datavalidation.php | 143 - Examples/16csv.php | 105 - Examples/17html.php | 64 - Examples/18extendedcalculation.php | 108 - Examples/19namedrange.php | 129 - Examples/20readexcel5.php | 79 - Examples/21pdf.php | 94 - Examples/22heavilyformatted.php | 116 - Examples/23sharedstyles.php | 124 - Examples/24readfilter.php | 77 - Examples/25inmemoryimage.php | 89 - Examples/26utf8.php | 122 - Examples/27imagesexcel5.php | 64 - Examples/28iterator.php | 67 - Examples/29advancedvaluebinder.php | 183 - Examples/30template.php | 91 - Examples/31docproperties_write-xls.php | 119 - Examples/31docproperties_write.php | 119 - Examples/32chartreadwrite.php | 102 - Examples/33chartcreate-area.php | 142 - Examples/33chartcreate-bar-stacked.php | 145 - Examples/33chartcreate-bar.php | 145 - Examples/33chartcreate-column-2.php | 154 - Examples/33chartcreate-column.php | 145 - Examples/33chartcreate-composite.php | 203 - Examples/33chartcreate-line.php | 142 - Examples/33chartcreate-multiple-charts.php | 220 - Examples/33chartcreate-pie.php | 215 - Examples/33chartcreate-radar.php | 155 - Examples/33chartcreate-scatter.php | 139 - Examples/33chartcreate-stock.php | 151 - Examples/34chartupdate.php | 78 - Examples/35chartrender.php | 105 - Examples/36chartreadwriteHTML.php | 122 - Examples/36chartreadwritePDF.php | 145 - Examples/37page_layout_view.php | 83 - Examples/38cloneWorksheet.php | 118 - Examples/39dropdown.php | 175 - Examples/40duplicateStyle.php | 51 - Examples/41password.php | 84 - Examples/42richText.php | 171 - Examples/43mergeWorkbooks.php | 91 - Examples/44worksheetInfo.php | 57 - Examples/Excel2003XMLReader.php | 61 - Examples/Excel2003XMLTest.xml | 1 - Examples/GnumericReader.php | 60 - Examples/OOCalcReader.php | 61 - Examples/OOCalcReaderPCLZip.php | 64 - Examples/Quadratic.php | 68 - Examples/Quadratic.xlsx | Bin 8908 -> 0 bytes Examples/Quadratic2.php | 65 - Examples/SylkReader.php | 50 - Examples/XMLReader.php | 60 - Examples/XMLTest.xml | 450 - Examples/runall.php | 133 - samples/01_Simple.php | 63 + samples/01_Simple_PCLZip.php | 50 + samples/01_Simple_download_ods.php | 57 + samples/01_Simple_download_pdf.php | 66 + samples/01_Simple_download_xls.php | 57 + samples/01_Simple_download_xlsx.php | 56 + samples/02_Types.php | 156 + samples/03_Formulas.php | 79 + samples/04_Printing.php | 59 + samples/05_Feature_demo.php | 7 + samples/06_Largescale.php | 8 + samples/06_Largescale_with_cellcaching.php | 15 + .../06_Largescale_with_cellcaching_sqlite.php | 15 + ...06_Largescale_with_cellcaching_sqlite3.php | 15 + samples/07_Reader.php | 16 + samples/07_Reader_PCLZip.php | 20 + samples/08_Conditional_formatting.php | 109 + samples/08_Conditional_formatting_2.php | 65 + samples/09_Pagebreaks.php | 60 + samples/10_Autofilter.php | 99 + samples/10_Autofilter_selection_1.php | 150 + samples/10_Autofilter_selection_2.php | 142 + samples/10_Autofilter_selection_display.php | 165 + samples/11_Documentsecurity.php | 46 + samples/12_CellProtection.php | 44 + samples/13_Calculation.php | 175 + samples/13_CalculationCyclicFormulae.php | 31 + samples/14_Excel5.php | 11 + samples/15_Datavalidation.php | 77 + samples/16_Csv.php | 36 + samples/17_Html.php | 11 + samples/18_Extendedcalculation.php | 67 + samples/19_Namedrange.php | 67 + samples/20_Read_Excel2003XML.php | 11 + samples/20_Read_Excel5.php | 20 + samples/20_Read_Gnumeric.php | 11 + samples/20_Read_OOCalc.php | 11 + samples/20_Read_OOCalc_with_PCLZip.php | 14 + samples/20_Read_Sylk.php | 11 + samples/21_Pdf.php | 29 + samples/22_Heavily_formatted.php | 44 + samples/23_Sharedstyles.php | 54 + samples/24_Readfilter.php | 38 + samples/25_In_memory_image.php | 37 + samples/26_Utf8.php | 54 + samples/27_Images_excel5.php | 11 + samples/28_Iterator.php | 31 + samples/29_Advanced_value_binder.php | 129 + samples/30_Template.php | 40 + samples/31_Document_properties_write.php | 67 + samples/31_Document_properties_write_xls.php | 67 + samples/32_Chart_read_write.php | 80 + samples/32_Chart_read_write_HTML.php | 94 + samples/32_Chart_read_write_PDF.php | 110 + samples/33_Chart_create_area.php | 96 + samples/33_Chart_create_bar.php | 14 + samples/33_Chart_create_bar_stacked.php | 99 + samples/33_Chart_create_column.php | 99 + samples/33_Chart_create_column_2.php | 108 + samples/33_Chart_create_composite.php | 152 + samples/33_Chart_create_line.php | 96 + samples/33_Chart_create_multiple_charts.php | 171 + samples/33_Chart_create_pie.php | 166 + samples/33_Chart_create_radar.php | 108 + samples/33_Chart_create_scatter.php | 93 + samples/33_Chart_create_stock.php | 104 + samples/34_Chart_update.php | 36 + samples/35_Chart_render.php | 79 + samples/37_Page_layout_view.php | 29 + samples/38_Clone_worksheet.php | 55 + samples/39_Dropdown.php | 125 + samples/40_Duplicate_style.php | 32 + samples/41_Password.php | 12 + samples/42_RichText.php | 95 + samples/43_Merge_workbooks.php | 24 + samples/44_Worksheet_info.php | 23 + samples/45_Quadratic_equation_solver.php | 41 + samples/Header.php | 62 + samples/bootstrap/css/bootstrap.min.css | 6 + samples/bootstrap/css/font-awesome.min.css | 4 + samples/bootstrap/css/phpspreadsheet.css | 13 + samples/bootstrap/fonts/FontAwesome.otf | Bin 0 -> 124988 bytes .../bootstrap/fonts/fontawesome-webfont.eot | Bin 0 -> 76518 bytes .../bootstrap/fonts/fontawesome-webfont.svg | 685 + .../bootstrap/fonts/fontawesome-webfont.ttf | Bin 0 -> 152796 bytes .../bootstrap/fonts/fontawesome-webfont.woff | Bin 0 -> 90412 bytes .../bootstrap/fonts/fontawesome-webfont.woff2 | Bin 0 -> 71896 bytes samples/bootstrap/js/bootstrap.min.js | 7 + samples/bootstrap/js/jquery.min.js | 4 + .../data/continents/Africa.txt | 0 .../data/continents/Asia.txt | 0 .../data/continents/Europe.txt | 0 .../data/continents/North America.txt | 0 .../data/continents/Oceania.txt | 0 .../data/continents/South America.txt | 0 .../images/PhpSpreadsheet_logo.gif | Bin {Examples => samples}/images/officelogo.jpg | Bin {Examples => samples}/images/paid.png | Bin .../images/termsconditions.jpg | Bin samples/index.php | 39 + .../templates/26template.xlsx | Bin .../templates/27template.xls | Bin .../templates/28iterators.xlsx | Bin .../templates/30template.xls | Bin .../templates/31docproperties.xls | Bin .../templates/31docproperties.xlsx | Bin .../templates/32chartreadwrite.xlsx | Bin .../templates/32complexChartreadwrite.xlsx | Bin .../templates/32readwriteAreaChart1.xlsx | Bin .../templates/32readwriteAreaChart2.xlsx | Bin .../templates/32readwriteAreaChart3.xlsx | Bin .../templates/32readwriteAreaChart3D1.xlsx | Bin .../32readwriteAreaPercentageChart1.xlsx | Bin .../32readwriteAreaPercentageChart2.xlsx | Bin .../32readwriteAreaPercentageChart3D1.xlsx | Bin .../32readwriteAreaStackedChart1.xlsx | Bin .../32readwriteAreaStackedChart2.xlsx | Bin .../32readwriteAreaStackedChart3D1.xlsx | Bin .../templates/32readwriteBarChart1.xlsx | Bin .../templates/32readwriteBarChart2.xlsx | Bin .../templates/32readwriteBarChart3.xlsx | Bin .../templates/32readwriteBarChart3D1.xlsx | Bin .../32readwriteBarPercentageChart1.xlsx | Bin .../32readwriteBarPercentageChart2.xlsx | Bin .../32readwriteBarPercentageChart3D1.xlsx | Bin .../32readwriteBarStackedChart1.xlsx | Bin .../32readwriteBarStackedChart2.xlsx | Bin .../32readwriteBarStackedChart3D1.xlsx | Bin .../templates/32readwriteBubbleChart1.xlsx | Bin .../templates/32readwriteBubbleChart3D1.xlsx | Bin .../32readwriteChartWithImages1.xlsx | Bin .../templates/32readwriteColumnChart1.xlsx | Bin .../templates/32readwriteColumnChart2.xlsx | Bin .../templates/32readwriteColumnChart3.xlsx | Bin .../templates/32readwriteColumnChart3D1.xlsx | Bin .../templates/32readwriteColumnChart4.xlsx | Bin .../32readwriteColumnPercentageChart1.xlsx | Bin .../32readwriteColumnPercentageChart2.xlsx | Bin .../32readwriteColumnPercentageChart3D1.xlsx | Bin .../32readwriteColumnStackedChart1.xlsx | Bin .../32readwriteColumnStackedChart2.xlsx | Bin .../32readwriteColumnStackedChart3D1.xlsx | Bin .../templates/32readwriteDonutChart1.xlsx | Bin .../templates/32readwriteDonutChart2.xlsx | Bin .../templates/32readwriteDonutChart3.xlsx | Bin .../templates/32readwriteDonutChart4.xlsx | Bin .../32readwriteDonutChartExploded1.xlsx | Bin .../32readwriteDonutChartMultiseries1.xlsx | Bin .../templates/32readwriteLineChart1.xlsx | Bin .../templates/32readwriteLineChart2.xlsx | Bin .../templates/32readwriteLineChart3.xlsx | Bin .../templates/32readwriteLineChart3D1.xlsx | Bin .../32readwriteLineChartNoPointMarkers1.xlsx | Bin .../32readwriteLinePercentageChart1.xlsx | Bin .../32readwriteLinePercentageChart2.xlsx | Bin .../32readwriteLineStackedChart1.xlsx | Bin .../32readwriteLineStackedChart2.xlsx | Bin .../templates/32readwritePieChart1.xlsx | Bin .../templates/32readwritePieChart2.xlsx | Bin .../templates/32readwritePieChart3.xlsx | Bin .../templates/32readwritePieChart3D1.xlsx | Bin .../templates/32readwritePieChart4.xlsx | Bin .../32readwritePieChartExploded1.xlsx | Bin .../32readwritePieChartExploded3D1.xlsx | Bin .../templates/32readwriteRadarChart1.xlsx | Bin .../templates/32readwriteRadarChart2.xlsx | Bin .../templates/32readwriteRadarChart3.xlsx | Bin .../templates/32readwriteScatterChart1.xlsx | Bin .../templates/32readwriteScatterChart2.xlsx | Bin .../templates/32readwriteScatterChart3.xlsx | Bin .../templates/32readwriteScatterChart4.xlsx | Bin .../templates/32readwriteScatterChart5.xlsx | Bin .../templates/32readwriteStockChart1.xlsx | Bin .../templates/32readwriteStockChart2.xlsx | Bin .../templates/32readwriteStockChart3.xlsx | Bin .../templates/32readwriteStockChart4.xlsx | Bin .../templates/32readwriteSurfaceChart1.xlsx | Bin .../templates/32readwriteSurfaceChart2.xlsx | Bin .../templates/32readwriteSurfaceChart3.xlsx | Bin .../templates/32readwriteSurfaceChart4.xlsx | Bin .../templates/36writeLineChart1.xlsx | Bin .../templates/43mergeBook1.xlsx | Bin .../templates/43mergeBook2.xlsx | Bin samples/templates/Excel2003XMLTest.xml | 39529 ++++++++++++++++ .../templates}/GnumericTest.gnumeric | Bin .../templates}/OOCalcTest.ods | Bin {Examples => samples/templates}/SylkTest.slk | 0 samples/templates/chartSpreadsheet.php | 90 + samples/templates/largeSpreadsheet.php | 54 + samples/templates/sampleSpreadsheet.php | 358 + src/PhpSpreadsheet/Helper/Sample.php | 185 + src/PhpSpreadsheet/Reader/Excel2003XML.php | 2 +- src/PhpSpreadsheet/Reader/Excel2007.php | 3 +- src/PhpSpreadsheet/Reader/Gnumeric.php | 1 + src/PhpSpreadsheet/Reader/OOCalc.php | 3 + src/PhpSpreadsheet/Settings.php | 4 +- src/PhpSpreadsheet/Writer/HTML.php | 224 +- src/PhpSpreadsheet/Writer/PDF.php | 6 +- tests/PhpSpreadsheetTests/SampleTest.php | 38 + tests/bootstrap.php | 27 +- 291 files changed, 46119 insertions(+), 11125 deletions(-) delete mode 100644 Examples/.gitignore delete mode 100644 Examples/01pharSimple.php delete mode 100644 Examples/01simple-download-ods.php delete mode 100644 Examples/01simple-download-pdf.php delete mode 100644 Examples/01simple-download-xls.php delete mode 100644 Examples/01simple-download-xlsx.php delete mode 100644 Examples/01simple.php delete mode 100644 Examples/01simplePCLZip.php delete mode 100644 Examples/02types.php delete mode 100644 Examples/03formulas.php delete mode 100644 Examples/04printing.php delete mode 100644 Examples/05featuredemo.inc.php delete mode 100644 Examples/05featuredemo.php delete mode 100644 Examples/06largescale-with-cellcaching-sqlite.php delete mode 100644 Examples/06largescale-with-cellcaching-sqlite3.php delete mode 100644 Examples/06largescale-with-cellcaching.php delete mode 100644 Examples/06largescale-xls.php delete mode 100644 Examples/06largescale.php delete mode 100644 Examples/07reader.php delete mode 100644 Examples/07readerPCLZip.php delete mode 100644 Examples/08conditionalformatting.php delete mode 100644 Examples/08conditionalformatting2.php delete mode 100644 Examples/09pagebreaks.php delete mode 100644 Examples/10autofilter-selection-1.php delete mode 100644 Examples/10autofilter-selection-2.php delete mode 100644 Examples/10autofilter-selection-display.php delete mode 100644 Examples/10autofilter.php delete mode 100644 Examples/11documentsecurity-xls.php delete mode 100644 Examples/11documentsecurity.php delete mode 100644 Examples/12cellProtection.php delete mode 100644 Examples/13calculation.php delete mode 100644 Examples/13calculationCyclicFormulae.php delete mode 100644 Examples/14excel5.php delete mode 100644 Examples/15datavalidation-xls.php delete mode 100644 Examples/15datavalidation.php delete mode 100644 Examples/16csv.php delete mode 100644 Examples/17html.php delete mode 100644 Examples/18extendedcalculation.php delete mode 100644 Examples/19namedrange.php delete mode 100644 Examples/20readexcel5.php delete mode 100644 Examples/21pdf.php delete mode 100644 Examples/22heavilyformatted.php delete mode 100644 Examples/23sharedstyles.php delete mode 100644 Examples/24readfilter.php delete mode 100644 Examples/25inmemoryimage.php delete mode 100644 Examples/26utf8.php delete mode 100644 Examples/27imagesexcel5.php delete mode 100644 Examples/28iterator.php delete mode 100644 Examples/29advancedvaluebinder.php delete mode 100644 Examples/30template.php delete mode 100644 Examples/31docproperties_write-xls.php delete mode 100644 Examples/31docproperties_write.php delete mode 100644 Examples/32chartreadwrite.php delete mode 100644 Examples/33chartcreate-area.php delete mode 100644 Examples/33chartcreate-bar-stacked.php delete mode 100644 Examples/33chartcreate-bar.php delete mode 100644 Examples/33chartcreate-column-2.php delete mode 100644 Examples/33chartcreate-column.php delete mode 100644 Examples/33chartcreate-composite.php delete mode 100644 Examples/33chartcreate-line.php delete mode 100644 Examples/33chartcreate-multiple-charts.php delete mode 100644 Examples/33chartcreate-pie.php delete mode 100644 Examples/33chartcreate-radar.php delete mode 100644 Examples/33chartcreate-scatter.php delete mode 100644 Examples/33chartcreate-stock.php delete mode 100644 Examples/34chartupdate.php delete mode 100644 Examples/35chartrender.php delete mode 100644 Examples/36chartreadwriteHTML.php delete mode 100644 Examples/36chartreadwritePDF.php delete mode 100644 Examples/37page_layout_view.php delete mode 100644 Examples/38cloneWorksheet.php delete mode 100644 Examples/39dropdown.php delete mode 100644 Examples/40duplicateStyle.php delete mode 100644 Examples/41password.php delete mode 100644 Examples/42richText.php delete mode 100644 Examples/43mergeWorkbooks.php delete mode 100644 Examples/44worksheetInfo.php delete mode 100644 Examples/Excel2003XMLReader.php delete mode 100644 Examples/Excel2003XMLTest.xml delete mode 100644 Examples/GnumericReader.php delete mode 100644 Examples/OOCalcReader.php delete mode 100644 Examples/OOCalcReaderPCLZip.php delete mode 100644 Examples/Quadratic.php delete mode 100644 Examples/Quadratic.xlsx delete mode 100644 Examples/Quadratic2.php delete mode 100644 Examples/SylkReader.php delete mode 100644 Examples/XMLReader.php delete mode 100644 Examples/XMLTest.xml delete mode 100644 Examples/runall.php create mode 100644 samples/01_Simple.php create mode 100644 samples/01_Simple_PCLZip.php create mode 100644 samples/01_Simple_download_ods.php create mode 100644 samples/01_Simple_download_pdf.php create mode 100644 samples/01_Simple_download_xls.php create mode 100644 samples/01_Simple_download_xlsx.php create mode 100644 samples/02_Types.php create mode 100644 samples/03_Formulas.php create mode 100644 samples/04_Printing.php create mode 100644 samples/05_Feature_demo.php create mode 100644 samples/06_Largescale.php create mode 100644 samples/06_Largescale_with_cellcaching.php create mode 100644 samples/06_Largescale_with_cellcaching_sqlite.php create mode 100644 samples/06_Largescale_with_cellcaching_sqlite3.php create mode 100644 samples/07_Reader.php create mode 100644 samples/07_Reader_PCLZip.php create mode 100644 samples/08_Conditional_formatting.php create mode 100644 samples/08_Conditional_formatting_2.php create mode 100644 samples/09_Pagebreaks.php create mode 100644 samples/10_Autofilter.php create mode 100644 samples/10_Autofilter_selection_1.php create mode 100644 samples/10_Autofilter_selection_2.php create mode 100644 samples/10_Autofilter_selection_display.php create mode 100644 samples/11_Documentsecurity.php create mode 100644 samples/12_CellProtection.php create mode 100644 samples/13_Calculation.php create mode 100644 samples/13_CalculationCyclicFormulae.php create mode 100644 samples/14_Excel5.php create mode 100644 samples/15_Datavalidation.php create mode 100644 samples/16_Csv.php create mode 100644 samples/17_Html.php create mode 100644 samples/18_Extendedcalculation.php create mode 100644 samples/19_Namedrange.php create mode 100644 samples/20_Read_Excel2003XML.php create mode 100644 samples/20_Read_Excel5.php create mode 100644 samples/20_Read_Gnumeric.php create mode 100644 samples/20_Read_OOCalc.php create mode 100644 samples/20_Read_OOCalc_with_PCLZip.php create mode 100644 samples/20_Read_Sylk.php create mode 100644 samples/21_Pdf.php create mode 100644 samples/22_Heavily_formatted.php create mode 100644 samples/23_Sharedstyles.php create mode 100644 samples/24_Readfilter.php create mode 100644 samples/25_In_memory_image.php create mode 100644 samples/26_Utf8.php create mode 100644 samples/27_Images_excel5.php create mode 100644 samples/28_Iterator.php create mode 100644 samples/29_Advanced_value_binder.php create mode 100644 samples/30_Template.php create mode 100644 samples/31_Document_properties_write.php create mode 100644 samples/31_Document_properties_write_xls.php create mode 100644 samples/32_Chart_read_write.php create mode 100644 samples/32_Chart_read_write_HTML.php create mode 100644 samples/32_Chart_read_write_PDF.php create mode 100644 samples/33_Chart_create_area.php create mode 100644 samples/33_Chart_create_bar.php create mode 100644 samples/33_Chart_create_bar_stacked.php create mode 100644 samples/33_Chart_create_column.php create mode 100644 samples/33_Chart_create_column_2.php create mode 100644 samples/33_Chart_create_composite.php create mode 100644 samples/33_Chart_create_line.php create mode 100644 samples/33_Chart_create_multiple_charts.php create mode 100644 samples/33_Chart_create_pie.php create mode 100644 samples/33_Chart_create_radar.php create mode 100644 samples/33_Chart_create_scatter.php create mode 100644 samples/33_Chart_create_stock.php create mode 100644 samples/34_Chart_update.php create mode 100644 samples/35_Chart_render.php create mode 100644 samples/37_Page_layout_view.php create mode 100644 samples/38_Clone_worksheet.php create mode 100644 samples/39_Dropdown.php create mode 100644 samples/40_Duplicate_style.php create mode 100644 samples/41_Password.php create mode 100644 samples/42_RichText.php create mode 100644 samples/43_Merge_workbooks.php create mode 100644 samples/44_Worksheet_info.php create mode 100644 samples/45_Quadratic_equation_solver.php create mode 100644 samples/Header.php create mode 100644 samples/bootstrap/css/bootstrap.min.css create mode 100644 samples/bootstrap/css/font-awesome.min.css create mode 100644 samples/bootstrap/css/phpspreadsheet.css create mode 100644 samples/bootstrap/fonts/FontAwesome.otf create mode 100644 samples/bootstrap/fonts/fontawesome-webfont.eot create mode 100644 samples/bootstrap/fonts/fontawesome-webfont.svg create mode 100644 samples/bootstrap/fonts/fontawesome-webfont.ttf create mode 100644 samples/bootstrap/fonts/fontawesome-webfont.woff create mode 100644 samples/bootstrap/fonts/fontawesome-webfont.woff2 create mode 100644 samples/bootstrap/js/bootstrap.min.js create mode 100644 samples/bootstrap/js/jquery.min.js rename {Examples => samples}/data/continents/Africa.txt (100%) rename {Examples => samples}/data/continents/Asia.txt (100%) rename {Examples => samples}/data/continents/Europe.txt (100%) rename {Examples => samples}/data/continents/North America.txt (100%) rename {Examples => samples}/data/continents/Oceania.txt (100%) rename {Examples => samples}/data/continents/South America.txt (100%) rename {Examples => samples}/images/PhpSpreadsheet_logo.gif (100%) rename {Examples => samples}/images/officelogo.jpg (100%) rename {Examples => samples}/images/paid.png (100%) rename {Examples => samples}/images/termsconditions.jpg (100%) create mode 100644 samples/index.php rename {Examples => samples}/templates/26template.xlsx (100%) rename {Examples => samples}/templates/27template.xls (100%) rename {Examples => samples}/templates/28iterators.xlsx (100%) rename {Examples => samples}/templates/30template.xls (100%) rename {Examples => samples}/templates/31docproperties.xls (100%) rename {Examples => samples}/templates/31docproperties.xlsx (100%) rename {Examples => samples}/templates/32chartreadwrite.xlsx (100%) rename {Examples => samples}/templates/32complexChartreadwrite.xlsx (100%) rename {Examples => samples}/templates/32readwriteAreaChart1.xlsx (100%) rename {Examples => samples}/templates/32readwriteAreaChart2.xlsx (100%) rename {Examples => samples}/templates/32readwriteAreaChart3.xlsx (100%) rename {Examples => samples}/templates/32readwriteAreaChart3D1.xlsx (100%) rename {Examples => samples}/templates/32readwriteAreaPercentageChart1.xlsx (100%) rename {Examples => samples}/templates/32readwriteAreaPercentageChart2.xlsx (100%) rename {Examples => samples}/templates/32readwriteAreaPercentageChart3D1.xlsx (100%) rename {Examples => samples}/templates/32readwriteAreaStackedChart1.xlsx (100%) rename {Examples => samples}/templates/32readwriteAreaStackedChart2.xlsx (100%) rename {Examples => samples}/templates/32readwriteAreaStackedChart3D1.xlsx (100%) rename {Examples => samples}/templates/32readwriteBarChart1.xlsx (100%) rename {Examples => samples}/templates/32readwriteBarChart2.xlsx (100%) rename {Examples => samples}/templates/32readwriteBarChart3.xlsx (100%) rename {Examples => samples}/templates/32readwriteBarChart3D1.xlsx (100%) rename {Examples => samples}/templates/32readwriteBarPercentageChart1.xlsx (100%) rename {Examples => samples}/templates/32readwriteBarPercentageChart2.xlsx (100%) rename {Examples => samples}/templates/32readwriteBarPercentageChart3D1.xlsx (100%) rename {Examples => samples}/templates/32readwriteBarStackedChart1.xlsx (100%) rename {Examples => samples}/templates/32readwriteBarStackedChart2.xlsx (100%) rename {Examples => samples}/templates/32readwriteBarStackedChart3D1.xlsx (100%) rename {Examples => samples}/templates/32readwriteBubbleChart1.xlsx (100%) rename {Examples => samples}/templates/32readwriteBubbleChart3D1.xlsx (100%) rename {Examples => samples}/templates/32readwriteChartWithImages1.xlsx (100%) rename {Examples => samples}/templates/32readwriteColumnChart1.xlsx (100%) rename {Examples => samples}/templates/32readwriteColumnChart2.xlsx (100%) rename {Examples => samples}/templates/32readwriteColumnChart3.xlsx (100%) rename {Examples => samples}/templates/32readwriteColumnChart3D1.xlsx (100%) rename {Examples => samples}/templates/32readwriteColumnChart4.xlsx (100%) rename {Examples => samples}/templates/32readwriteColumnPercentageChart1.xlsx (100%) rename {Examples => samples}/templates/32readwriteColumnPercentageChart2.xlsx (100%) rename {Examples => samples}/templates/32readwriteColumnPercentageChart3D1.xlsx (100%) rename {Examples => samples}/templates/32readwriteColumnStackedChart1.xlsx (100%) rename {Examples => samples}/templates/32readwriteColumnStackedChart2.xlsx (100%) rename {Examples => samples}/templates/32readwriteColumnStackedChart3D1.xlsx (100%) rename {Examples => samples}/templates/32readwriteDonutChart1.xlsx (100%) rename {Examples => samples}/templates/32readwriteDonutChart2.xlsx (100%) rename {Examples => samples}/templates/32readwriteDonutChart3.xlsx (100%) rename {Examples => samples}/templates/32readwriteDonutChart4.xlsx (100%) rename {Examples => samples}/templates/32readwriteDonutChartExploded1.xlsx (100%) rename {Examples => samples}/templates/32readwriteDonutChartMultiseries1.xlsx (100%) rename {Examples => samples}/templates/32readwriteLineChart1.xlsx (100%) rename {Examples => samples}/templates/32readwriteLineChart2.xlsx (100%) rename {Examples => samples}/templates/32readwriteLineChart3.xlsx (100%) rename {Examples => samples}/templates/32readwriteLineChart3D1.xlsx (100%) rename {Examples => samples}/templates/32readwriteLineChartNoPointMarkers1.xlsx (100%) rename {Examples => samples}/templates/32readwriteLinePercentageChart1.xlsx (100%) rename {Examples => samples}/templates/32readwriteLinePercentageChart2.xlsx (100%) rename {Examples => samples}/templates/32readwriteLineStackedChart1.xlsx (100%) rename {Examples => samples}/templates/32readwriteLineStackedChart2.xlsx (100%) rename {Examples => samples}/templates/32readwritePieChart1.xlsx (100%) rename {Examples => samples}/templates/32readwritePieChart2.xlsx (100%) rename {Examples => samples}/templates/32readwritePieChart3.xlsx (100%) rename {Examples => samples}/templates/32readwritePieChart3D1.xlsx (100%) rename {Examples => samples}/templates/32readwritePieChart4.xlsx (100%) rename {Examples => samples}/templates/32readwritePieChartExploded1.xlsx (100%) rename {Examples => samples}/templates/32readwritePieChartExploded3D1.xlsx (100%) rename {Examples => samples}/templates/32readwriteRadarChart1.xlsx (100%) rename {Examples => samples}/templates/32readwriteRadarChart2.xlsx (100%) rename {Examples => samples}/templates/32readwriteRadarChart3.xlsx (100%) rename {Examples => samples}/templates/32readwriteScatterChart1.xlsx (100%) rename {Examples => samples}/templates/32readwriteScatterChart2.xlsx (100%) rename {Examples => samples}/templates/32readwriteScatterChart3.xlsx (100%) rename {Examples => samples}/templates/32readwriteScatterChart4.xlsx (100%) rename {Examples => samples}/templates/32readwriteScatterChart5.xlsx (100%) rename {Examples => samples}/templates/32readwriteStockChart1.xlsx (100%) rename {Examples => samples}/templates/32readwriteStockChart2.xlsx (100%) rename {Examples => samples}/templates/32readwriteStockChart3.xlsx (100%) rename {Examples => samples}/templates/32readwriteStockChart4.xlsx (100%) rename {Examples => samples}/templates/32readwriteSurfaceChart1.xlsx (100%) rename {Examples => samples}/templates/32readwriteSurfaceChart2.xlsx (100%) rename {Examples => samples}/templates/32readwriteSurfaceChart3.xlsx (100%) rename {Examples => samples}/templates/32readwriteSurfaceChart4.xlsx (100%) rename {Examples => samples}/templates/36writeLineChart1.xlsx (100%) rename {Examples => samples}/templates/43mergeBook1.xlsx (100%) rename {Examples => samples}/templates/43mergeBook2.xlsx (100%) create mode 100644 samples/templates/Excel2003XMLTest.xml rename {Examples => samples/templates}/GnumericTest.gnumeric (100%) rename {Examples => samples/templates}/OOCalcTest.ods (100%) rename {Examples => samples/templates}/SylkTest.slk (100%) create mode 100644 samples/templates/chartSpreadsheet.php create mode 100644 samples/templates/largeSpreadsheet.php create mode 100644 samples/templates/sampleSpreadsheet.php create mode 100644 src/PhpSpreadsheet/Helper/Sample.php create mode 100644 tests/PhpSpreadsheetTests/SampleTest.php diff --git a/.php_cs b/.php_cs index ed5a0ebb..2278ffb0 100644 --- a/.php_cs +++ b/.php_cs @@ -2,6 +2,7 @@ $finder = Symfony\CS\Finder\DefaultFinder::create() ->exclude('vendor') + ->in('samples') ->in('src') ->in('tests'); diff --git a/.travis.yml b/.travis.yml index 67bda5e9..5bf19df4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -26,7 +26,7 @@ before_script: script: ## PHP_CodeSniffer - - ./vendor/bin/phpcs --report-width=200 --report-summary --report-full src/ tests/ --standard=PSR2 -n + - ./vendor/bin/phpcs --report-width=200 --report-summary --report-full samples/ src/ tests/ --standard=PSR2 -n ## PHP-CS-Fixer - ./vendor/bin/php-cs-fixer fix --diff --verbose ## PHPUnit diff --git a/Examples/.gitignore b/Examples/.gitignore deleted file mode 100644 index 9a415a71..00000000 --- a/Examples/.gitignore +++ /dev/null @@ -1,12 +0,0 @@ -*.xls -*.xlsx -*.csv -*.jpg -*.pdf -*.htm -*.html -*.log -!.gitignore -!data/** -!images/** -!templates/** diff --git a/Examples/01pharSimple.php b/Examples/01pharSimple.php deleted file mode 100644 index 04a0a4fd..00000000 --- a/Examples/01pharSimple.php +++ /dev/null @@ -1,112 +0,0 @@ -'); - -/** Include PHPExcel */ -require_once '../Build/PHPExcel.phar'; - - -// Create new PHPExcel object -echo date('H:i:s') , " Create new PHPExcel object" , EOL; -$objPHPExcel = new \PHPExcel\Spreadsheet(); - -// Set document properties -echo date('H:i:s') , " Set document properties" , EOL; -$objPHPExcel->getProperties()->setCreator("Maarten Balliauw") - ->setLastModifiedBy("Maarten Balliauw") - ->setTitle("PHPExcel Test Document") - ->setSubject("PHPExcel Test Document") - ->setDescription("Test document for PHPExcel, generated using PHP classes.") - ->setKeywords("office PHPExcel php") - ->setCategory("Test result file"); - - -// Add some data -echo date('H:i:s') , " Add some data" , EOL; -$objPHPExcel->setActiveSheetIndex(0) - ->setCellValue('A1', 'Hello') - ->setCellValue('B2', 'world!') - ->setCellValue('C1', 'Hello') - ->setCellValue('D2', 'world!'); - -// Miscellaneous glyphs, UTF-8 -$objPHPExcel->setActiveSheetIndex(0) - ->setCellValue('A4', 'Miscellaneous glyphs') - ->setCellValue('A5', 'éàèùâêîôûëïüÿäöüç'); - -// Rename worksheet -echo date('H:i:s') , " Rename worksheet" , EOL; -$objPHPExcel->getActiveSheet()->setTitle('Simple'); - - -// Set active sheet index to the first sheet, so Excel opens this as the first sheet -$objPHPExcel->setActiveSheetIndex(0); - - -// Save Excel 2007 file -echo date('H:i:s') , " Write to Excel2007 format" , EOL; -$callStartTime = microtime(true); - -$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007'); -$objWriter->save(str_replace('.php', '.xlsx', __FILE__)); -$callEndTime = microtime(true); -$callTime = $callEndTime - $callStartTime; - -echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; -echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; -// Echo memory usage -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; - - -// Save Excel5 file -echo date('H:i:s') , " Write to Excel5 format" , EOL; -$callStartTime = microtime(true); - -$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel5'); -$objWriter->save(str_replace('.php', '.xls', __FILE__)); -$callEndTime = microtime(true); -$callTime = $callEndTime - $callStartTime; - -echo date('H:i:s') , " File written to " , str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; -echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; -// Echo memory usage -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; - - -// Echo memory peak usage -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; - -// Echo done -echo date('H:i:s') , " Done writing files" , EOL; -echo 'Files have been created in ' , getcwd() , EOL; diff --git a/Examples/01simple-download-ods.php b/Examples/01simple-download-ods.php deleted file mode 100644 index 396ca5bd..00000000 --- a/Examples/01simple-download-ods.php +++ /dev/null @@ -1,88 +0,0 @@ -getProperties()->setCreator("Maarten Balliauw") - ->setLastModifiedBy("Maarten Balliauw") - ->setTitle("Office 2007 XLSX Test Document") - ->setSubject("Office 2007 XLSX Test Document") - ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.") - ->setKeywords("office 2007 openxml php") - ->setCategory("Test result file"); - - -// Add some data -$objPhpSpreadsheet->setActiveSheetIndex(0) - ->setCellValue('A1', 'Hello') - ->setCellValue('B2', 'world!') - ->setCellValue('C1', 'Hello') - ->setCellValue('D2', 'world!'); - -// Miscellaneous glyphs, UTF-8 -$objPhpSpreadsheet->setActiveSheetIndex(0) - ->setCellValue('A4', 'Miscellaneous glyphs') - ->setCellValue('A5', 'éàèùâêîôûëïüÿäöüç'); - -// Rename worksheet -$objPhpSpreadsheet->getActiveSheet()->setTitle('Simple'); - - -// Set active sheet index to the first sheet, so Excel opens this as the first sheet -$objPhpSpreadsheet->setActiveSheetIndex(0); - - -// Redirect output to a client’s web browser (OpenDocument) -header('Content-Type: application/vnd.oasis.opendocument.spreadsheet'); -header('Content-Disposition: attachment;filename="01simple.ods"'); -header('Cache-Control: max-age=0'); -// If you're serving to IE 9, then the following may be needed -header('Cache-Control: max-age=1'); - -// If you're serving to IE over SSL, then the following may be needed -header ('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past -header ('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); // always modified -header ('Cache-Control: cache, must-revalidate'); // HTTP/1.1 -header ('Pragma: public'); // HTTP/1.0 - -$objWriter = \PhpSpreadsheet\IOFactory::createWriter($objPhpSpreadsheet, 'OpenDocument'); -$objWriter->save('php://output'); -exit; diff --git a/Examples/01simple-download-pdf.php b/Examples/01simple-download-pdf.php deleted file mode 100644 index b65ae75e..00000000 --- a/Examples/01simple-download-pdf.php +++ /dev/null @@ -1,103 +0,0 @@ -getProperties()->setCreator("Maarten Balliauw") - ->setLastModifiedBy("Maarten Balliauw") - ->setTitle("PDF Test Document") - ->setSubject("PDF Test Document") - ->setDescription("Test document for PDF, generated using PHP classes.") - ->setKeywords("pdf php") - ->setCategory("Test result file"); - - -// Add some data -$objPhpSpreadsheet->setActiveSheetIndex(0) - ->setCellValue('A1', 'Hello') - ->setCellValue('B2', 'world!') - ->setCellValue('C1', 'Hello') - ->setCellValue('D2', 'world!'); - -// Miscellaneous glyphs, UTF-8 -$objPhpSpreadsheet->setActiveSheetIndex(0) - ->setCellValue('A4', 'Miscellaneous glyphs') - ->setCellValue('A5', 'éàèùâêîôûëïüÿäöüç'); - -// Rename worksheet -$objPhpSpreadsheet->getActiveSheet()->setTitle('Simple'); -$objPhpSpreadsheet->getActiveSheet()->setShowGridLines(false); - -// Set active sheet index to the first sheet, so Excel opens this as the first sheet -$objPhpSpreadsheet->setActiveSheetIndex(0); - - -if (!PhpSpreadsheet\Settings::setPdfRenderer( - $rendererName, - $rendererLibraryPath - )) { - die( - 'NOTICE: Please set the $rendererName and $rendererLibraryPath values' . - '
' . - 'at the top of this script as appropriate for your directory structure' - ); -} - - -// Redirect output to a client’s web browser (PDF) -header('Content-Type: application/pdf'); -header('Content-Disposition: attachment;filename="01simple.pdf"'); -header('Cache-Control: max-age=0'); - -$objWriter = \PhpSpreadsheet\IOFactory::createWriter($objPhpSpreadsheet, 'PDF'); -$objWriter->save('php://output'); -exit; diff --git a/Examples/01simple-download-xls.php b/Examples/01simple-download-xls.php deleted file mode 100644 index c1558366..00000000 --- a/Examples/01simple-download-xls.php +++ /dev/null @@ -1,88 +0,0 @@ -getProperties()->setCreator("Maarten Balliauw") - ->setLastModifiedBy("Maarten Balliauw") - ->setTitle("Office 2007 XLSX Test Document") - ->setSubject("Office 2007 XLSX Test Document") - ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.") - ->setKeywords("office 2007 openxml php") - ->setCategory("Test result file"); - - -// Add some data -$objPhpSpreadsheet->setActiveSheetIndex(0) - ->setCellValue('A1', 'Hello') - ->setCellValue('B2', 'world!') - ->setCellValue('C1', 'Hello') - ->setCellValue('D2', 'world!'); - -// Miscellaneous glyphs, UTF-8 -$objPhpSpreadsheet->setActiveSheetIndex(0) - ->setCellValue('A4', 'Miscellaneous glyphs') - ->setCellValue('A5', 'éàèùâêîôûëïüÿäöüç'); - -// Rename worksheet -$objPhpSpreadsheet->getActiveSheet()->setTitle('Simple'); - - -// Set active sheet index to the first sheet, so Excel opens this as the first sheet -$objPhpSpreadsheet->setActiveSheetIndex(0); - - -// Redirect output to a client’s web browser (Excel5) -header('Content-Type: application/vnd.ms-excel'); -header('Content-Disposition: attachment;filename="01simple.xls"'); -header('Cache-Control: max-age=0'); -// If you're serving to IE 9, then the following may be needed -header('Cache-Control: max-age=1'); - -// If you're serving to IE over SSL, then the following may be needed -header ('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past -header ('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); // always modified -header ('Cache-Control: cache, must-revalidate'); // HTTP/1.1 -header ('Pragma: public'); // HTTP/1.0 - -$objWriter = \PhpSpreadsheet\IOFactory::createWriter($objPhpSpreadsheet, 'Excel5'); -$objWriter->save('php://output'); -exit; diff --git a/Examples/01simple-download-xlsx.php b/Examples/01simple-download-xlsx.php deleted file mode 100644 index efc8ca69..00000000 --- a/Examples/01simple-download-xlsx.php +++ /dev/null @@ -1,88 +0,0 @@ -getProperties()->setCreator("Maarten Balliauw") - ->setLastModifiedBy("Maarten Balliauw") - ->setTitle("Office 2007 XLSX Test Document") - ->setSubject("Office 2007 XLSX Test Document") - ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.") - ->setKeywords("office 2007 openxml php") - ->setCategory("Test result file"); - - -// Add some data -$objPhpSpreadsheet->setActiveSheetIndex(0) - ->setCellValue('A1', 'Hello') - ->setCellValue('B2', 'world!') - ->setCellValue('C1', 'Hello') - ->setCellValue('D2', 'world!'); - -// Miscellaneous glyphs, UTF-8 -$objPhpSpreadsheet->setActiveSheetIndex(0) - ->setCellValue('A4', 'Miscellaneous glyphs') - ->setCellValue('A5', 'éàèùâêîôûëïüÿäöüç'); - -// Rename worksheet -$objPhpSpreadsheet->getActiveSheet()->setTitle('Simple'); - - -// Set active sheet index to the first sheet, so Excel opens this as the first sheet -$objPhpSpreadsheet->setActiveSheetIndex(0); - - -// Redirect output to a client’s web browser (Excel2007) -header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); -header('Content-Disposition: attachment;filename="01simple.xlsx"'); -header('Cache-Control: max-age=0'); -// If you're serving to IE 9, then the following may be needed -header('Cache-Control: max-age=1'); - -// If you're serving to IE over SSL, then the following may be needed -header ('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past -header ('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); // always modified -header ('Cache-Control: cache, must-revalidate'); // HTTP/1.1 -header ('Pragma: public'); // HTTP/1.0 - -$objWriter = \PhpSpreadsheet\IOFactory::createWriter($objPhpSpreadsheet, 'Excel2007'); -$objWriter->save('php://output'); -exit; diff --git a/Examples/01simple.php b/Examples/01simple.php deleted file mode 100644 index 4ccf8785..00000000 --- a/Examples/01simple.php +++ /dev/null @@ -1,140 +0,0 @@ -'); - -/** Include PhpSpreadsheet */ -require_once dirname(__FILE__) . '/../src/Bootstrap.php'; - - -// Create new Spreadsheet object -echo date('H:i:s') , " Create new Spreadsheet object" , EOL; -$objPhpSpreadsheet = new \PhpSpreadsheet\Spreadsheet(); - -// Set document properties -echo date('H:i:s') , " Set document properties" , EOL; -$objPhpSpreadsheet->getProperties() - ->setCreator("Maarten Balliauw") - ->setLastModifiedBy("Maarten Balliauw") - ->setTitle("PhpSpreadsheet Test Document") - ->setSubject("PhpSpreadsheet Test Document") - ->setDescription("Test document for PhpSpreadsheet, generated using PHP classes.") - ->setKeywords("office PhpSpreadsheet php") - ->setCategory("Test result file"); - - -// Add some data -echo date('H:i:s') , " Add some data" , EOL; -$objPhpSpreadsheet->setActiveSheetIndex(0) - ->setCellValue('A1', 'Hello') - ->setCellValue('B2', 'world!') - ->setCellValue('C1', 'Hello') - ->setCellValue('D2', 'world!'); - -// Miscellaneous glyphs, UTF-8 -$objPhpSpreadsheet->setActiveSheetIndex(0) - ->setCellValue('A4', 'Miscellaneous glyphs') - ->setCellValue('A5', 'éàèùâêîôûëïüÿäöüç'); - - -$objPhpSpreadsheet->getActiveSheet() - ->setCellValue('A8',"Hello\nWorld"); -$objPhpSpreadsheet->getActiveSheet() - ->getRowDimension(8) - ->setRowHeight(-1); -$objPhpSpreadsheet->getActiveSheet() - ->getStyle('A8') - ->getAlignment() - ->setWrapText(true); - - -$value = "-ValueA\n-Value B\n-Value C"; -$objPhpSpreadsheet->getActiveSheet() - ->setCellValue('A10', $value); -$objPhpSpreadsheet->getActiveSheet() - ->getRowDimension(10) - ->setRowHeight(-1); -$objPhpSpreadsheet->getActiveSheet() - ->getStyle('A10') - ->getAlignment() - ->setWrapText(true); -$objPhpSpreadsheet->getActiveSheet() - ->getStyle('A10') - ->setQuotePrefix(true); - - -// Rename worksheet -echo date('H:i:s') , " Rename worksheet" , EOL; -$objPhpSpreadsheet->getActiveSheet() - ->setTitle('Simple'); - - -// Set active sheet index to the first sheet, so Excel opens this as the first sheet -$objPhpSpreadsheet->setActiveSheetIndex(0); - - -// Save Excel 2007 file -echo date('H:i:s') , " Write to Excel2007 format" , EOL; -$callStartTime = microtime(true); - -$objWriter = \PhpSpreadsheet\IOFactory::createWriter($objPhpSpreadsheet, 'Excel2007'); -$objWriter->save(str_replace('.php', '.xlsx', __FILE__)); -$callEndTime = microtime(true); -$callTime = $callEndTime - $callStartTime; - -echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; -echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; -// Echo memory usage -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; - - -// Save Excel 95 file -echo date('H:i:s') , " Write to Excel5 format" , EOL; -$callStartTime = microtime(true); - -$objWriter = \PhpSpreadsheet\IOFactory::createWriter($objPhpSpreadsheet, 'Excel5'); -$objWriter->save(str_replace('.php', '.xls', __FILE__)); -$callEndTime = microtime(true); -$callTime = $callEndTime - $callStartTime; - -echo date('H:i:s') , " File written to " , str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; -echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; -// Echo memory usage -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; - - -// Echo memory peak usage -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; - -// Echo done -echo date('H:i:s') , " Done writing files" , EOL; -echo 'Files have been created in ' , getcwd() , EOL; diff --git a/Examples/01simplePCLZip.php b/Examples/01simplePCLZip.php deleted file mode 100644 index 09915d4c..00000000 --- a/Examples/01simplePCLZip.php +++ /dev/null @@ -1,105 +0,0 @@ -'); - -/** Include PhpSpreadsheet */ -require_once dirname(__FILE__) . '/../src/Bootstrap.php'; - - -// Create new PhpSpreadsheet object -echo date('H:i:s') , " Create new PhpSpreadsheet object" , EOL; -$objPhpSpreadsheet = new \PhpSpreadsheet\Spreadsheet(); - -// Set document properties -echo date('H:i:s') , " Set document properties" , EOL; -$objPhpSpreadsheet->getProperties()->setCreator("Maarten Balliauw") - ->setLastModifiedBy("Maarten Balliauw") - ->setTitle("PhpSpreadsheet Test Document") - ->setSubject("PhpSpreadsheet Test Document") - ->setDescription("Test document for PhpSpreadsheet, generated using PHP classes.") - ->setKeywords("office PhpSpreadsheet php") - ->setCategory("Test result file"); - - -// Add some data -echo date('H:i:s') , " Add some data" , EOL; -$objPhpSpreadsheet->setActiveSheetIndex(0) - ->setCellValue('A1', 'Hello') - ->setCellValue('B2', 'world!') - ->setCellValue('C1', 'Hello') - ->setCellValue('D2', 'world!'); - -// Miscellaneous glyphs, UTF-8 -$objPhpSpreadsheet->setActiveSheetIndex(0) - ->setCellValue('A4', 'Miscellaneous glyphs') - ->setCellValue('A5', 'éàèùâêîôûëïüÿäöüç'); - - -$objPhpSpreadsheet->getActiveSheet()->setCellValue('A8',"Hello\nWorld"); -$objPhpSpreadsheet->getActiveSheet()->getRowDimension(8)->setRowHeight(-1); -$objPhpSpreadsheet->getActiveSheet()->getStyle('A8')->getAlignment()->setWrapText(true); - - -// Rename worksheet -echo date('H:i:s') , " Rename worksheet" , EOL; -$objPhpSpreadsheet->getActiveSheet()->setTitle('Simple'); - - -// Set active sheet index to the first sheet, so Excel opens this as the first sheet -$objPhpSpreadsheet->setActiveSheetIndex(0); - - -// Save Excel 2007 file -echo date('H:i:s') , " Write to Excel2007 format" , EOL; -$callStartTime = microtime(true); - -// Use PCLZip rather than ZipArchive to create the Excel2007 OfficeOpenXML file -PhpSpreadsheet\Settings::setZipClass(PhpSpreadsheet\Settings::PCLZIP); - -$objWriter = \PhpSpreadsheet\IOFactory::createWriter($objPhpSpreadsheet, 'Excel2007'); -$objWriter->save(str_replace('.php', '.xlsx', __FILE__)); -$callEndTime = microtime(true); -$callTime = $callEndTime - $callStartTime; - -echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; -echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; -// Echo memory usage -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; - - -// Echo memory peak usage -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; - -// Echo done -echo date('H:i:s') , " Done writing files" , EOL; -echo 'Files have been created in ' , getcwd() , EOL; diff --git a/Examples/02types.php b/Examples/02types.php deleted file mode 100644 index ca16d668..00000000 --- a/Examples/02types.php +++ /dev/null @@ -1,229 +0,0 @@ -'); - -/** Include PhpSpreadsheet */ -require_once dirname(__FILE__) . '/../src/Bootstrap.php'; - - -// Create new PhpSpreadsheet object -echo date('H:i:s') , " Create new PhpSpreadsheet object" , EOL; -$objPhpSpreadsheet = new \PhpSpreadsheet\Spreadsheet(); - -// Set document properties -echo date('H:i:s') , " Set document properties" , EOL; -$objPhpSpreadsheet->getProperties() - ->setCreator("Maarten Balliauw") - ->setLastModifiedBy("Maarten Balliauw") - ->setTitle("Office 2007 XLSX Test Document") - ->setSubject("Office 2007 XLSX Test Document") - ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.") - ->setKeywords("office 2007 openxml php") - ->setCategory("Test result file"); - -// Set default font -echo date('H:i:s') , " Set default font" , EOL; -$objPhpSpreadsheet->getDefaultStyle() - ->getFont() - ->setName('Arial') - ->setSize(10); - -// Add some data, resembling some different data types -echo date('H:i:s') , " Add some data" , EOL; -$objPhpSpreadsheet->getActiveSheet() - ->setCellValue('A1', 'String') - ->setCellValue('B1', 'Simple') - ->setCellValue('C1', 'PhpSpreadsheet'); - -$objPhpSpreadsheet->getActiveSheet() - ->setCellValue('A2', 'String') - ->setCellValue('B2', 'Symbols') - ->setCellValue('C2', '!+&=()~§±æþ'); - -$objPhpSpreadsheet->getActiveSheet() - ->setCellValue('A3', 'String') - ->setCellValue('B3', 'UTF-8') - ->setCellValue('C3', 'Создать MS Excel Книги из PHP скриптов'); - -$objPhpSpreadsheet->getActiveSheet() - ->setCellValue('A4', 'Number') - ->setCellValue('B4', 'Integer') - ->setCellValue('C4', 12); - -$objPhpSpreadsheet->getActiveSheet() - ->setCellValue('A5', 'Number') - ->setCellValue('B5', 'Float') - ->setCellValue('C5', 34.56); - -$objPhpSpreadsheet->getActiveSheet() - ->setCellValue('A6', 'Number') - ->setCellValue('B6', 'Negative') - ->setCellValue('C6', -7.89); - -$objPhpSpreadsheet->getActiveSheet() - ->setCellValue('A7', 'Boolean') - ->setCellValue('B7', 'True') - ->setCellValue('C7', true); - -$objPhpSpreadsheet->getActiveSheet() - ->setCellValue('A8', 'Boolean') - ->setCellValue('B8', 'False') - ->setCellValue('C8', false); - -$dateTimeNow = time(); -$objPhpSpreadsheet->getActiveSheet() - ->setCellValue('A9', 'Date/Time') - ->setCellValue('B9', 'Date') - ->setCellValue('C9', \PhpSpreadsheet\Shared\Date::PHPToExcel( $dateTimeNow )); -$objPhpSpreadsheet->getActiveSheet() - ->getStyle('C9') - ->getNumberFormat() - ->setFormatCode(\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_YYYYMMDD2); - -$objPhpSpreadsheet->getActiveSheet() - ->setCellValue('A10', 'Date/Time') - ->setCellValue('B10', 'Time') - ->setCellValue('C10', \PhpSpreadsheet\Shared\Date::PHPToExcel( $dateTimeNow )); -$objPhpSpreadsheet->getActiveSheet() - ->getStyle('C10') - ->getNumberFormat() - ->setFormatCode(\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_TIME4); - -$objPhpSpreadsheet->getActiveSheet() - ->setCellValue('A11', 'Date/Time') - ->setCellValue('B11', 'Date and Time') - ->setCellValue('C11', \PhpSpreadsheet\Shared\Date::PHPToExcel( $dateTimeNow )); -$objPhpSpreadsheet->getActiveSheet() - ->getStyle('C11') - ->getNumberFormat() - ->setFormatCode(\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_DATETIME); - -$objPhpSpreadsheet->getActiveSheet() - ->setCellValue('A12', 'NULL') - ->setCellValue('C12', NULL); - -$objRichText = new \PhpSpreadsheet\RichText(); -$objRichText->createText('你好 '); - -$objPayable = $objRichText->createTextRun('你 好 吗?'); -$objPayable->getFont()->setBold(true); -$objPayable->getFont()->setItalic(true); -$objPayable->getFont()->setColor( new \PhpSpreadsheet\Style\Color( \PhpSpreadsheet\Style\Color::COLOR_DARKGREEN ) ); - -$objRichText->createText(', unless specified otherwise on the invoice.'); - -$objPhpSpreadsheet->getActiveSheet() - ->setCellValue('A13', 'Rich Text') - ->setCellValue('C13', $objRichText); - - -$objRichText2 = new \PhpSpreadsheet\RichText(); -$objRichText2->createText("black text\n"); - -$objRed = $objRichText2->createTextRun("red text"); -$objRed->getFont()->setColor( new \PhpSpreadsheet\Style\Color(\PhpSpreadsheet\Style\Color::COLOR_RED ) ); - -$objPhpSpreadsheet->getActiveSheet() - ->getCell("C14") - ->setValue($objRichText2); -$objPhpSpreadsheet->getActiveSheet() - ->getStyle("C14") - ->getAlignment()->setWrapText(true); - - -$objPhpSpreadsheet->getActiveSheet()->setCellValue('A17', 'Hyperlink'); - -$objPhpSpreadsheet->getActiveSheet() - ->setCellValue('C17', 'PhpSpreadsheet Web Site'); -$objPhpSpreadsheet->getActiveSheet() - ->getCell('C17') - ->getHyperlink() - ->setUrl('https://github.com/PHPOffice/PhpSpreadsheet') - ->setTooltip('Navigate to PhpSpreadsheet website'); - -$objPhpSpreadsheet->getActiveSheet() - ->setCellValue('C18', '=HYPERLINK("mailto:abc@def.com","abc@def.com")'); - - -$objPhpSpreadsheet->getActiveSheet() - ->getColumnDimension('B') - ->setAutoSize(true); -$objPhpSpreadsheet->getActiveSheet() - ->getColumnDimension('C') - ->setAutoSize(true); - -// Rename worksheet -echo date('H:i:s') , " Rename worksheet" , EOL; -$objPhpSpreadsheet->getActiveSheet()->setTitle('Datatypes'); - - -// Set active sheet index to the first sheet, so Excel opens this as the first sheet -$objPhpSpreadsheet->setActiveSheetIndex(0); - - -// Save Excel 2007 file -echo date('H:i:s') , " Write to Excel2007 format" , EOL; -$callStartTime = microtime(true); - -$objWriter = \PhpSpreadsheet\IOFactory::createWriter($objPhpSpreadsheet, 'Excel2007'); -$objWriter->save(str_replace('.php', '.xlsx', __FILE__)); -$callEndTime = microtime(true); -$callTime = $callEndTime - $callStartTime; - -echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; -echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; -// Echo memory usage -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; - - -// Save Excel 5 file -echo date('H:i:s') , " Write to Excel5 format" , EOL; -$callStartTime = microtime(true); - -$objWriter = \PhpSpreadsheet\IOFactory::createWriter($objPhpSpreadsheet, 'Excel5'); -$objWriter->save(str_replace('.php', '.xls', __FILE__)); -$callEndTime = microtime(true); -$callTime = $callEndTime - $callStartTime; - -echo date('H:i:s') , " File written to " , str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; -echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; -// Echo memory usage -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; - - -// Echo memory peak usage -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; - -// Echo done -echo date('H:i:s') , " Done testing file" , EOL; -echo 'Files have been created in ' , getcwd() , EOL; diff --git a/Examples/03formulas.php b/Examples/03formulas.php deleted file mode 100644 index 89283e59..00000000 --- a/Examples/03formulas.php +++ /dev/null @@ -1,175 +0,0 @@ -'); - -/** Include PhpSpreadsheet */ -require_once dirname(__FILE__) . '/../src/Bootstrap.php'; - - -// Create new PhpSpreadsheet object -echo date('H:i:s') , " Create new PhpSpreadsheet object" , EOL; -$objPhpSpreadsheet = new \PhpSpreadsheet\Spreadsheet(); - -// Set document properties -echo date('H:i:s') , " Set document properties" , EOL; -$objPhpSpreadsheet->getProperties()->setCreator("Maarten Balliauw") - ->setLastModifiedBy("Maarten Balliauw") - ->setTitle("Office 2007 XLSX Test Document") - ->setSubject("Office 2007 XLSX Test Document") - ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.") - ->setKeywords("office 2007 openxml php") - ->setCategory("Test result file"); - - -// Add some data, we will use some formulas here -echo date('H:i:s') , " Add some data" , EOL; -$objPhpSpreadsheet->getActiveSheet() - ->setCellValue('A5', 'Sum:'); - -$objPhpSpreadsheet->getActiveSheet()->setCellValue('B1', 'Range #1') - ->setCellValue('B2', 3) - ->setCellValue('B3', 7) - ->setCellValue('B4', 13) - ->setCellValue('B5', '=SUM(B2:B4)'); -echo date('H:i:s') , " Sum of Range #1 is " , -$objPhpSpreadsheet->getActiveSheet() - ->getCell('B5') - ->getCalculatedValue() , EOL; - -$objPhpSpreadsheet->getActiveSheet()->setCellValue('C1', 'Range #2') - ->setCellValue('C2', 5) - ->setCellValue('C3', 11) - ->setCellValue('C4', 17) - ->setCellValue('C5', '=SUM(C2:C4)'); -echo date('H:i:s') , " Sum of Range #2 is " , -$objPhpSpreadsheet->getActiveSheet() - ->getCell('C5') - ->getCalculatedValue() , EOL; - -$objPhpSpreadsheet->getActiveSheet() - ->setCellValue('A7', 'Total of both ranges:'); -$objPhpSpreadsheet->getActiveSheet() - ->setCellValue('B7', '=SUM(B5:C5)'); -echo date('H:i:s') , " Sum of both Ranges is " , -$objPhpSpreadsheet->getActiveSheet() - ->getCell('B7') - ->getCalculatedValue() , EOL; - -$objPhpSpreadsheet->getActiveSheet() - ->setCellValue('A8', 'Minimum of both ranges:'); -$objPhpSpreadsheet->getActiveSheet() - ->setCellValue('B8', '=MIN(B2:C4)'); -echo date('H:i:s') , " Minimum value in either Range is " , -$objPhpSpreadsheet->getActiveSheet() - ->getCell('B8') - ->getCalculatedValue() , EOL; - -$objPhpSpreadsheet->getActiveSheet() - ->setCellValue('A9', 'Maximum of both ranges:'); -$objPhpSpreadsheet->getActiveSheet() - ->setCellValue('B9', '=MAX(B2:C4)'); -echo date('H:i:s') , " Maximum value in either Range is " , -$objPhpSpreadsheet->getActiveSheet() - ->getCell('B9') - ->getCalculatedValue() , EOL; - -$objPhpSpreadsheet->getActiveSheet() - ->setCellValue('A10', 'Average of both ranges:'); -$objPhpSpreadsheet->getActiveSheet() - ->setCellValue('B10', '=AVERAGE(B2:C4)'); -echo date('H:i:s') , " Average value of both Ranges is " , -$objPhpSpreadsheet->getActiveSheet() - ->getCell('B10')->getCalculatedValue() , EOL; - - -$objPhpSpreadsheet->getActiveSheet() - ->getColumnDimension('A') - ->setAutoSize(true); - - -// Rename worksheet -echo date('H:i:s') , " Rename worksheet" , EOL; -$objPhpSpreadsheet->getActiveSheet() - ->setTitle('Formulas'); - - -// Set active sheet index to the first sheet, so Excel opens this as the first sheet -$objPhpSpreadsheet->setActiveSheetIndex(0); - - -// Save Excel 2007 file -echo date('H:i:s') , " Write to Excel2007 format" , EOL; -$callStartTime = microtime(true); - -$objWriter = \PhpSpreadsheet\IOFactory::createWriter($objPhpSpreadsheet, 'Excel2007'); - -// -// If we set Pre Calculated Formulas to true then PhpSpreadsheet will calculate all formulae in the -// workbook before saving. This adds time and memory overhead, and can cause some problems with formulae -// using functions or features (such as array formulae) that aren't yet supported by the calculation engine -// If the value is false (the default) for the Excel2007 Writer, then MS Excel (or the application used to -// open the file) will need to recalculate values itself to guarantee that the correct results are available. -// -//$objWriter->setPreCalculateFormulas(true); -$objWriter->save(str_replace('.php', '.xlsx', __FILE__)); -$callEndTime = microtime(true); -$callTime = $callEndTime - $callStartTime; - -echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; -echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; -// Echo memory usage -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; - - -// Save Excel 95 file -echo date('H:i:s') , " Write to Excel5 format" , EOL; -$callStartTime = microtime(true); - -$objWriter = \PhpSpreadsheet\IOFactory::createWriter($objPhpSpreadsheet, 'Excel5'); -$objWriter->save(str_replace('.php', '.xls', __FILE__)); -$callEndTime = microtime(true); -$callTime = $callEndTime - $callStartTime; - -echo date('H:i:s') , " File written to " , str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; -echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; -// Echo memory usage -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; - - -// Echo memory peak usage -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; - -// Echo done -echo date('H:i:s') , " Done writing files" , EOL; -echo 'Files have been created in ' , getcwd() , EOL; diff --git a/Examples/04printing.php b/Examples/04printing.php deleted file mode 100644 index 79edf444..00000000 --- a/Examples/04printing.php +++ /dev/null @@ -1,135 +0,0 @@ -'); - -date_default_timezone_set('Europe/London'); - -/** Include PhpSpreadsheet */ -require_once dirname(__FILE__) . '/../src/Bootstrap.php'; - - -// Create new PhpSpreadsheet object -echo date('H:i:s') , " Create new PhpSpreadsheet object" , EOL; -$objPhpSpreadsheet = new \PhpSpreadsheet\Spreadsheet(); - -// Set document properties -echo date('H:i:s') , " Set document properties" , EOL; -$objPhpSpreadsheet->getProperties()->setCreator("Maarten Balliauw") - ->setLastModifiedBy("Maarten Balliauw") - ->setTitle("Office 2007 XLSX Test Document") - ->setSubject("Office 2007 XLSX Test Document") - ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.") - ->setKeywords("office 2007 openxml php") - ->setCategory("Test result file"); - - -// Add some data, we will use printing features -echo date('H:i:s') , " Add some data" , EOL; -for ($i = 1; $i < 200; $i++) { - $objPhpSpreadsheet->getActiveSheet()->setCellValue('A' . $i, $i); - $objPhpSpreadsheet->getActiveSheet()->setCellValue('B' . $i, 'Test value'); -} - -// Set header and footer. When no different headers for odd/even are used, odd header is assumed. -echo date('H:i:s') , " Set header/footer" , EOL; -$objPhpSpreadsheet->getActiveSheet() - ->getHeaderFooter() - ->setOddHeader('&L&G&C&HPlease treat this document as confidential!'); -$objPhpSpreadsheet->getActiveSheet() - ->getHeaderFooter() - ->setOddFooter('&L&B' . $objPhpSpreadsheet->getProperties()->getTitle() . '&RPage &P of &N'); - -// Add a drawing to the header -echo date('H:i:s') , " Add a drawing to the header" , EOL; -$objDrawing = new \PhpSpreadsheet\Worksheet\HeaderFooterDrawing(); -$objDrawing->setName('PhpSpreadsheet logo'); -$objDrawing->setPath('./images/PhpSpreadsheet_logo.gif'); -$objDrawing->setHeight(36); -$objPhpSpreadsheet->getActiveSheet() - ->getHeaderFooter() - ->addImage($objDrawing, \PhpSpreadsheet\Worksheet\HeaderFooter::IMAGE_HEADER_LEFT); - -// Set page orientation and size -echo date('H:i:s') , " Set page orientation and size" , EOL; -$objPhpSpreadsheet->getActiveSheet() - ->getPageSetup() - ->setOrientation(\PhpSpreadsheet\Worksheet\PageSetup::ORIENTATION_LANDSCAPE); -$objPhpSpreadsheet->getActiveSheet() - ->getPageSetup() - ->setPaperSize(\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_A4); - -// Rename worksheet -echo date('H:i:s') , " Rename worksheet" , EOL; -$objPhpSpreadsheet->getActiveSheet()->setTitle('Printing'); - - -// Set active sheet index to the first sheet, so Excel opens this as the first sheet -$objPhpSpreadsheet->setActiveSheetIndex(0); - - -// Save Excel 2007 file -echo date('H:i:s') , " Write to Excel2007 format" , EOL; -$callStartTime = microtime(true); - -$objWriter = \PhpSpreadsheet\IOFactory::createWriter($objPhpSpreadsheet, 'Excel2007'); -$objWriter->save(str_replace('.php', '.xlsx', __FILE__)); -$callEndTime = microtime(true); -$callTime = $callEndTime - $callStartTime; - -echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; -echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; -// Echo memory usage -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; - - -// Save Excel 95 file -echo date('H:i:s') , " Write to Excel5 format" , EOL; -$callStartTime = microtime(true); - -$objWriter = \PhpSpreadsheet\IOFactory::createWriter($objPhpSpreadsheet, 'Excel5'); -$objWriter->save(str_replace('.php', '.xls', __FILE__)); -$callEndTime = microtime(true); -$callTime = $callEndTime - $callStartTime; - -echo date('H:i:s') , " File written to " , str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; -echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; -// Echo memory usage -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; - - -// Echo memory peak usage -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; - -// Echo done -echo date('H:i:s') , " Done writing files" , EOL; -echo 'Files have been created in ' , getcwd() , EOL; diff --git a/Examples/05featuredemo.inc.php b/Examples/05featuredemo.inc.php deleted file mode 100644 index 547dd184..00000000 --- a/Examples/05featuredemo.inc.php +++ /dev/null @@ -1,394 +0,0 @@ -getProperties()->setCreator("Maarten Balliauw") - ->setLastModifiedBy("Maarten Balliauw") - ->setTitle("Office 2007 XLSX Test Document") - ->setSubject("Office 2007 XLSX Test Document") - ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.") - ->setKeywords("office 2007 openxml php") - ->setCategory("Test result file"); - - -// Create a first sheet, representing sales data -echo date('H:i:s') , " Add some data" , EOL; -$objPHPExcel->setActiveSheetIndex(0); -$objPHPExcel->getActiveSheet()->setCellValue('B1', 'Invoice'); -$objPHPExcel->getActiveSheet()->setCellValue('D1', \PHPExcel\Shared\Date::PHPToExcel( gmmktime(0,0,0,date('m'),date('d'),date('Y')) )); -$objPHPExcel->getActiveSheet()->getStyle('D1')->getNumberFormat()->setFormatCode(\PHPExcel\Style\NumberFormat::FORMAT_DATE_XLSX15); -$objPHPExcel->getActiveSheet()->setCellValue('E1', '#12566'); - -$objPHPExcel->getActiveSheet()->setCellValue('A3', 'Product Id'); -$objPHPExcel->getActiveSheet()->setCellValue('B3', 'Description'); -$objPHPExcel->getActiveSheet()->setCellValue('C3', 'Price'); -$objPHPExcel->getActiveSheet()->setCellValue('D3', 'Amount'); -$objPHPExcel->getActiveSheet()->setCellValue('E3', 'Total'); - -$objPHPExcel->getActiveSheet()->setCellValue('A4', '1001'); -$objPHPExcel->getActiveSheet()->setCellValue('B4', 'PHP for dummies'); -$objPHPExcel->getActiveSheet()->setCellValue('C4', '20'); -$objPHPExcel->getActiveSheet()->setCellValue('D4', '1'); -$objPHPExcel->getActiveSheet()->setCellValue('E4', '=IF(D4<>"",C4*D4,"")'); - -$objPHPExcel->getActiveSheet()->setCellValue('A5', '1012'); -$objPHPExcel->getActiveSheet()->setCellValue('B5', 'OpenXML for dummies'); -$objPHPExcel->getActiveSheet()->setCellValue('C5', '22'); -$objPHPExcel->getActiveSheet()->setCellValue('D5', '2'); -$objPHPExcel->getActiveSheet()->setCellValue('E5', '=IF(D5<>"",C5*D5,"")'); - -$objPHPExcel->getActiveSheet()->setCellValue('E6', '=IF(D6<>"",C6*D6,"")'); -$objPHPExcel->getActiveSheet()->setCellValue('E7', '=IF(D7<>"",C7*D7,"")'); -$objPHPExcel->getActiveSheet()->setCellValue('E8', '=IF(D8<>"",C8*D8,"")'); -$objPHPExcel->getActiveSheet()->setCellValue('E9', '=IF(D9<>"",C9*D9,"")'); - -$objPHPExcel->getActiveSheet()->setCellValue('D11', 'Total excl.:'); -$objPHPExcel->getActiveSheet()->setCellValue('E11', '=SUM(E4:E9)'); - -$objPHPExcel->getActiveSheet()->setCellValue('D12', 'VAT:'); -$objPHPExcel->getActiveSheet()->setCellValue('E12', '=E11*0.21'); - -$objPHPExcel->getActiveSheet()->setCellValue('D13', 'Total incl.:'); -$objPHPExcel->getActiveSheet()->setCellValue('E13', '=E11+E12'); - -// Add comment -echo date('H:i:s') , " Add comments" , EOL; - -$objPHPExcel->getActiveSheet()->getComment('E11')->setAuthor('PHPExcel'); -$objCommentRichText = $objPHPExcel->getActiveSheet()->getComment('E11')->getText()->createTextRun('PHPExcel:'); -$objCommentRichText->getFont()->setBold(true); -$objPHPExcel->getActiveSheet()->getComment('E11')->getText()->createTextRun("\r\n"); -$objPHPExcel->getActiveSheet()->getComment('E11')->getText()->createTextRun('Total amount on the current invoice, excluding VAT.'); - -$objPHPExcel->getActiveSheet()->getComment('E12')->setAuthor('PHPExcel'); -$objCommentRichText = $objPHPExcel->getActiveSheet()->getComment('E12')->getText()->createTextRun('PHPExcel:'); -$objCommentRichText->getFont()->setBold(true); -$objPHPExcel->getActiveSheet()->getComment('E12')->getText()->createTextRun("\r\n"); -$objPHPExcel->getActiveSheet()->getComment('E12')->getText()->createTextRun('Total amount of VAT on the current invoice.'); - -$objPHPExcel->getActiveSheet()->getComment('E13')->setAuthor('PHPExcel'); -$objCommentRichText = $objPHPExcel->getActiveSheet()->getComment('E13')->getText()->createTextRun('PHPExcel:'); -$objCommentRichText->getFont()->setBold(true); -$objPHPExcel->getActiveSheet()->getComment('E13')->getText()->createTextRun("\r\n"); -$objPHPExcel->getActiveSheet()->getComment('E13')->getText()->createTextRun('Total amount on the current invoice, including VAT.'); -$objPHPExcel->getActiveSheet()->getComment('E13')->setWidth('100pt'); -$objPHPExcel->getActiveSheet()->getComment('E13')->setHeight('100pt'); -$objPHPExcel->getActiveSheet()->getComment('E13')->setMarginLeft('150pt'); -$objPHPExcel->getActiveSheet()->getComment('E13')->getFillColor()->setRGB('EEEEEE'); - - -// Add rich-text string -echo date('H:i:s') , " Add rich-text string" , EOL; -$objRichText = new \PHPExcel\RichText(); -$objRichText->createText('This invoice is '); - -$objPayable = $objRichText->createTextRun('payable within thirty days after the end of the month'); -$objPayable->getFont()->setBold(true); -$objPayable->getFont()->setItalic(true); -$objPayable->getFont()->setColor(new \PHPExcel\Style\Color(\PHPExcel\Style\Color::COLOR_DARKGREEN)); - -$objRichText->createText(', unless specified otherwise on the invoice.'); - -$objPHPExcel->getActiveSheet()->getCell('A18')->setValue($objRichText); - -// Merge cells -echo date('H:i:s') , " Merge cells" , EOL; -$objPHPExcel->getActiveSheet()->mergeCells('A18:E22'); -$objPHPExcel->getActiveSheet()->mergeCells('A28:B28'); // Just to test... -$objPHPExcel->getActiveSheet()->unmergeCells('A28:B28'); // Just to test... - -// Protect cells -echo date('H:i:s') , " Protect cells" , EOL; -$objPHPExcel->getActiveSheet()->getProtection()->setSheet(true); // Needs to be set to true in order to enable any worksheet protection! -$objPHPExcel->getActiveSheet()->protectCells('A3:E13', 'PHPExcel'); - -// Set cell number formats -echo date('H:i:s') , " Set cell number formats" , EOL; -$objPHPExcel->getActiveSheet()->getStyle('E4:E13')->getNumberFormat()->setFormatCode(\PHPExcel\Style\NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE); - -// Set column widths -echo date('H:i:s') , " Set column widths" , EOL; -$objPHPExcel->getActiveSheet()->getColumnDimension('B')->setAutoSize(true); -$objPHPExcel->getActiveSheet()->getColumnDimension('D')->setWidth(12); -$objPHPExcel->getActiveSheet()->getColumnDimension('E')->setWidth(12); - -// Set fonts -echo date('H:i:s') , " Set fonts" , EOL; -$objPHPExcel->getActiveSheet()->getStyle('B1')->getFont()->setName('Candara'); -$objPHPExcel->getActiveSheet()->getStyle('B1')->getFont()->setSize(20); -$objPHPExcel->getActiveSheet()->getStyle('B1')->getFont()->setBold(true); -$objPHPExcel->getActiveSheet()->getStyle('B1')->getFont()->setUnderline(\PHPExcel\Style\Font::UNDERLINE_SINGLE); -$objPHPExcel->getActiveSheet()->getStyle('B1')->getFont()->getColor()->setARGB(\PHPExcel\Style\Color::COLOR_WHITE); - -$objPHPExcel->getActiveSheet()->getStyle('D1')->getFont()->getColor()->setARGB(\PHPExcel\Style\Color::COLOR_WHITE); -$objPHPExcel->getActiveSheet()->getStyle('E1')->getFont()->getColor()->setARGB(\PHPExcel\Style\Color::COLOR_WHITE); - -$objPHPExcel->getActiveSheet()->getStyle('D13')->getFont()->setBold(true); -$objPHPExcel->getActiveSheet()->getStyle('E13')->getFont()->setBold(true); - -// Set alignments -echo date('H:i:s') , " Set alignments" , EOL; -$objPHPExcel->getActiveSheet()->getStyle('D11')->getAlignment()->setHorizontal(\PHPExcel\Style\Alignment::HORIZONTAL_RIGHT); -$objPHPExcel->getActiveSheet()->getStyle('D12')->getAlignment()->setHorizontal(\PHPExcel\Style\Alignment::HORIZONTAL_RIGHT); -$objPHPExcel->getActiveSheet()->getStyle('D13')->getAlignment()->setHorizontal(\PHPExcel\Style\Alignment::HORIZONTAL_RIGHT); - -$objPHPExcel->getActiveSheet()->getStyle('A18')->getAlignment()->setHorizontal(\PHPExcel\Style\Alignment::HORIZONTAL_JUSTIFY); -$objPHPExcel->getActiveSheet()->getStyle('A18')->getAlignment()->setVertical(\PHPExcel\Style\Alignment::VERTICAL_CENTER); - -$objPHPExcel->getActiveSheet()->getStyle('B5')->getAlignment()->setShrinkToFit(true); - -// Set thin black border outline around column -echo date('H:i:s') , " Set thin black border outline around column" , EOL; -$styleThinBlackBorderOutline = array( - 'borders' => array( - 'outline' => array( - 'style' => \PHPExcel\Style\Border::BORDER_THIN, - 'color' => array('argb' => 'FF000000'), - ), - ), -); -$objPHPExcel->getActiveSheet()->getStyle('A4:E10')->applyFromArray($styleThinBlackBorderOutline); - - -// Set thick brown border outline around "Total" -echo date('H:i:s') , " Set thick brown border outline around Total" , EOL; -$styleThickBrownBorderOutline = array( - 'borders' => array( - 'outline' => array( - 'style' => \PHPExcel\Style\Border::BORDER_THICK, - 'color' => array('argb' => 'FF993300'), - ), - ), -); -$objPHPExcel->getActiveSheet()->getStyle('D13:E13')->applyFromArray($styleThickBrownBorderOutline); - -// Set fills -echo date('H:i:s') , " Set fills" , EOL; -$objPHPExcel->getActiveSheet()->getStyle('A1:E1')->getFill()->setFillType(\PHPExcel\Style\Fill::FILL_SOLID); -$objPHPExcel->getActiveSheet()->getStyle('A1:E1')->getFill()->getStartColor()->setARGB('FF808080'); - -// Set style for header row using alternative method -echo date('H:i:s') , " Set style for header row using alternative method" , EOL; -$objPHPExcel->getActiveSheet()->getStyle('A3:E3')->applyFromArray( - array( - 'font' => array( - 'bold' => true - ), - 'alignment' => array( - 'horizontal' => \PHPExcel\Style\Alignment::HORIZONTAL_RIGHT, - ), - 'borders' => array( - 'top' => array( - 'style' => \PHPExcel\Style\Border::BORDER_THIN - ) - ), - 'fill' => array( - 'type' => \PHPExcel\Style\Fill::FILL_GRADIENT_LINEAR, - 'rotation' => 90, - 'startcolor' => array( - 'argb' => 'FFA0A0A0' - ), - 'endcolor' => array( - 'argb' => 'FFFFFFFF' - ) - ) - ) -); - -$objPHPExcel->getActiveSheet()->getStyle('A3')->applyFromArray( - array( - 'alignment' => array( - 'horizontal' => \PHPExcel\Style\Alignment::HORIZONTAL_LEFT, - ), - 'borders' => array( - 'left' => array( - 'style' => \PHPExcel\Style\Border::BORDER_THIN - ) - ) - ) -); - -$objPHPExcel->getActiveSheet()->getStyle('B3')->applyFromArray( - array( - 'alignment' => array( - 'horizontal' => \PHPExcel\Style\Alignment::HORIZONTAL_LEFT, - ) - ) -); - -$objPHPExcel->getActiveSheet()->getStyle('E3')->applyFromArray( - array( - 'borders' => array( - 'right' => array( - 'style' => \PHPExcel\Style\Border::BORDER_THIN - ) - ) - ) -); - -// Unprotect a cell -echo date('H:i:s') , " Unprotect a cell" , EOL; -$objPHPExcel->getActiveSheet()->getStyle('B1')->getProtection()->setLocked(\PHPExcel\Style\Protection::PROTECTION_UNPROTECTED); - -// Add a hyperlink to the sheet -echo date('H:i:s') , " Add a hyperlink to an external website" , EOL; -$objPHPExcel->getActiveSheet()->setCellValue('E26', 'www.phpexcel.net'); -$objPHPExcel->getActiveSheet()->getCell('E26')->getHyperlink()->setUrl('http://www.phpexcel.net'); -$objPHPExcel->getActiveSheet()->getCell('E26')->getHyperlink()->setTooltip('Navigate to website'); -$objPHPExcel->getActiveSheet()->getStyle('E26')->getAlignment()->setHorizontal(\PHPExcel\Style\Alignment::HORIZONTAL_RIGHT); - -echo date('H:i:s') , " Add a hyperlink to another cell on a different worksheet within the workbook" , EOL; -$objPHPExcel->getActiveSheet()->setCellValue('E27', 'Terms and conditions'); -$objPHPExcel->getActiveSheet()->getCell('E27')->getHyperlink()->setUrl("sheet://'Terms and conditions'!A1"); -$objPHPExcel->getActiveSheet()->getCell('E27')->getHyperlink()->setTooltip('Review terms and conditions'); -$objPHPExcel->getActiveSheet()->getStyle('E27')->getAlignment()->setHorizontal(\PHPExcel\Style\Alignment::HORIZONTAL_RIGHT); - -// Add a drawing to the worksheet -echo date('H:i:s') , " Add a drawing to the worksheet" , EOL; -$objDrawing = new \PHPExcel\Worksheet\Drawing(); -$objDrawing->setName('Logo'); -$objDrawing->setDescription('Logo'); -$objDrawing->setPath('./images/officelogo.jpg'); -$objDrawing->setHeight(36); -$objDrawing->setWorksheet($objPHPExcel->getActiveSheet()); - -// Add a drawing to the worksheet -echo date('H:i:s') , " Add a drawing to the worksheet" , EOL; -$objDrawing = new \PHPExcel\Worksheet\Drawing(); -$objDrawing->setName('Paid'); -$objDrawing->setDescription('Paid'); -$objDrawing->setPath('./images/paid.png'); -$objDrawing->setCoordinates('B15'); -$objDrawing->setOffsetX(110); -$objDrawing->setRotation(25); -$objDrawing->getShadow()->setVisible(true); -$objDrawing->getShadow()->setDirection(45); -$objDrawing->setWorksheet($objPHPExcel->getActiveSheet()); - -// Add a drawing to the worksheet -echo date('H:i:s') , " Add a drawing to the worksheet" , EOL; -$objDrawing = new \PHPExcel\Worksheet\Drawing(); -$objDrawing->setName('PHPExcel logo'); -$objDrawing->setDescription('PHPExcel logo'); -$objDrawing->setPath('./images/phpexcel_logo.gif'); -$objDrawing->setHeight(36); -$objDrawing->setCoordinates('D24'); -$objDrawing->setOffsetX(10); -$objDrawing->setWorksheet($objPHPExcel->getActiveSheet()); - -// Play around with inserting and removing rows and columns -echo date('H:i:s') , " Play around with inserting and removing rows and columns" , EOL; -$objPHPExcel->getActiveSheet()->insertNewRowBefore(6, 10); -$objPHPExcel->getActiveSheet()->removeRow(6, 10); -$objPHPExcel->getActiveSheet()->insertNewColumnBefore('E', 5); -$objPHPExcel->getActiveSheet()->removeColumn('E', 5); - -// Set header and footer. When no different headers for odd/even are used, odd header is assumed. -echo date('H:i:s') , " Set header/footer" , EOL; -$objPHPExcel->getActiveSheet()->getHeaderFooter()->setOddHeader('&L&BInvoice&RPrinted on &D'); -$objPHPExcel->getActiveSheet()->getHeaderFooter()->setOddFooter('&L&B' . $objPHPExcel->getProperties()->getTitle() . '&RPage &P of &N'); - -// Set page orientation and size -echo date('H:i:s') , " Set page orientation and size" , EOL; -$objPHPExcel->getActiveSheet()->getPageSetup()->setOrientation(\PHPExcel\Worksheet\PageSetup::ORIENTATION_PORTRAIT); -$objPHPExcel->getActiveSheet()->getPageSetup()->setPaperSize(\PHPExcel\Worksheet\PageSetup::PAPERSIZE_A4); - -// Rename first worksheet -echo date('H:i:s') , " Rename first worksheet" , EOL; -$objPHPExcel->getActiveSheet()->setTitle('Invoice'); - - -// Create a new worksheet, after the default sheet -echo date('H:i:s') , " Create a second Worksheet object" , EOL; -$objPHPExcel->createSheet(); - -// Llorem ipsum... -$sLloremIpsum = 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Vivamus eget ante. Sed cursus nunc semper tortor. Aliquam luctus purus non elit. Fusce vel elit commodo sapien dignissim dignissim. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Curabitur accumsan magna sed massa. Nullam bibendum quam ac ipsum. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Proin augue. Praesent malesuada justo sed orci. Pellentesque lacus ligula, sodales quis, ultricies a, ultricies vitae, elit. Sed luctus consectetuer dolor. Vivamus vel sem ut nisi sodales accumsan. Nunc et felis. Suspendisse semper viverra odio. Morbi at odio. Integer a orci a purus venenatis molestie. Nam mattis. Praesent rhoncus, nisi vel mattis auctor, neque nisi faucibus sem, non dapibus elit pede ac nisl. Cras turpis.'; - -// Add some data to the second sheet, resembling some different data types -echo date('H:i:s') , " Add some data" , EOL; -$objPHPExcel->setActiveSheetIndex(1); -$objPHPExcel->getActiveSheet()->setCellValue('A1', 'Terms and conditions'); -$objPHPExcel->getActiveSheet()->setCellValue('A3', $sLloremIpsum); -$objPHPExcel->getActiveSheet()->setCellValue('A4', $sLloremIpsum); -$objPHPExcel->getActiveSheet()->setCellValue('A5', $sLloremIpsum); -$objPHPExcel->getActiveSheet()->setCellValue('A6', $sLloremIpsum); - -// Set the worksheet tab color -echo date('H:i:s') , " Set the worksheet tab color" , EOL; -$objPHPExcel->getActiveSheet()->getTabColor()->setARGB('FF0094FF');; - -// Set alignments -echo date('H:i:s') , " Set alignments" , EOL; -$objPHPExcel->getActiveSheet()->getStyle('A3:A6')->getAlignment()->setWrapText(true); - -// Set column widths -echo date('H:i:s') , " Set column widths" , EOL; -$objPHPExcel->getActiveSheet()->getColumnDimension('A')->setWidth(80); - -// Set fonts -echo date('H:i:s') , " Set fonts" , EOL; -$objPHPExcel->getActiveSheet()->getStyle('A1')->getFont()->setName('Candara'); -$objPHPExcel->getActiveSheet()->getStyle('A1')->getFont()->setSize(20); -$objPHPExcel->getActiveSheet()->getStyle('A1')->getFont()->setBold(true); -$objPHPExcel->getActiveSheet()->getStyle('A1')->getFont()->setUnderline(\PHPExcel\Style\Font::UNDERLINE_SINGLE); - -$objPHPExcel->getActiveSheet()->getStyle('A3:A6')->getFont()->setSize(8); - -// Add a drawing to the worksheet -echo date('H:i:s') , " Add a drawing to the worksheet" , EOL; -$objDrawing = new \PHPExcel\Worksheet\Drawing(); -$objDrawing->setName('Terms and conditions'); -$objDrawing->setDescription('Terms and conditions'); -$objDrawing->setPath('./images/termsconditions.jpg'); -$objDrawing->setCoordinates('B14'); -$objDrawing->setWorksheet($objPHPExcel->getActiveSheet()); - -// Set page orientation and size -echo date('H:i:s') , " Set page orientation and size" , EOL; -$objPHPExcel->getActiveSheet()->getPageSetup()->setOrientation(\PHPExcel\Worksheet\PageSetup::ORIENTATION_LANDSCAPE); -$objPHPExcel->getActiveSheet()->getPageSetup()->setPaperSize(\PHPExcel\Worksheet\PageSetup::PAPERSIZE_A4); - -// Rename second worksheet -echo date('H:i:s') , " Rename second worksheet" , EOL; -$objPHPExcel->getActiveSheet()->setTitle('Terms and conditions'); - - -// Set active sheet index to the first sheet, so Excel opens this as the first sheet -$objPHPExcel->setActiveSheetIndex(0); diff --git a/Examples/05featuredemo.php b/Examples/05featuredemo.php deleted file mode 100644 index e8373ecd..00000000 --- a/Examples/05featuredemo.php +++ /dev/null @@ -1,74 +0,0 @@ -'); - -date_default_timezone_set('Europe/London'); - -include "05featuredemo.inc.php"; - -// Save Excel 2007 file -echo date('H:i:s') , " Write to Excel2007 format" , EOL; -$callStartTime = microtime(true); - -$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007'); -$objWriter->save(str_replace('.php', '.xlsx', __FILE__)); -$callEndTime = microtime(true); -$callTime = $callEndTime - $callStartTime; - -echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; -echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; -// Echo memory usage -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; - - -// Save Excel 95 file -echo date('H:i:s') , " Write to Excel5 format" , EOL; -$callStartTime = microtime(true); - -$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel5'); -$objWriter->save(str_replace('.php', '.xls', __FILE__)); -$callEndTime = microtime(true); -$callTime = $callEndTime - $callStartTime; - -echo date('H:i:s') , " File written to " , str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; -echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; -// Echo memory usage -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; - - -// Echo memory peak usage -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; - -// Echo done -echo date('H:i:s') , " Done writing files" , EOL; -echo 'Files have been created in ' , getcwd() , EOL; diff --git a/Examples/06largescale-with-cellcaching-sqlite.php b/Examples/06largescale-with-cellcaching-sqlite.php deleted file mode 100644 index 96be8a45..00000000 --- a/Examples/06largescale-with-cellcaching-sqlite.php +++ /dev/null @@ -1,129 +0,0 @@ -'); - -date_default_timezone_set('Europe/London'); - -/** Include PHPExcel */ -require_once dirname(__FILE__) . '/../src/Bootstrap.php'; - -$cacheMethod = \PHPExcel\CachedObjectStorageFactory::CACHE_TO_SQLITE; -if (\PHPExcel\Settings::setCacheStorageMethod($cacheMethod)) { - echo date('H:i:s') , " Enable Cell Caching using " , $cacheMethod , " method" , EOL; -} else { - echo date('H:i:s') , " Unable to set Cell Caching using " , $cacheMethod , " method, reverting to memory" , EOL; -} - - -// Create new PHPExcel object -echo date('H:i:s') , " Create new PHPExcel object" , EOL; -$objPHPExcel = new \PHPExcel\Spreadsheet(); - -// Set document properties -echo date('H:i:s') , " Set properties" , EOL; -$objPHPExcel->getProperties()->setCreator("Maarten Balliauw") - ->setLastModifiedBy("Maarten Balliauw") - ->setTitle("Office 2007 XLSX Test Document") - ->setSubject("Office 2007 XLSX Test Document") - ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.") - ->setKeywords("office 2007 openxml php") - ->setCategory("Test result file"); - - -// Create a first sheet -echo date('H:i:s') , " Add data" , EOL; -$objPHPExcel->setActiveSheetIndex(0); -$objPHPExcel->getActiveSheet()->setCellValue('A1', "Firstname"); -$objPHPExcel->getActiveSheet()->setCellValue('B1', "Lastname"); -$objPHPExcel->getActiveSheet()->setCellValue('C1', "Phone"); -$objPHPExcel->getActiveSheet()->setCellValue('D1', "Fax"); -$objPHPExcel->getActiveSheet()->setCellValue('E1', "Is Client ?"); - - -// Hide "Phone" and "fax" column -echo date('H:i:s') , " Hide 'Phone' and 'fax' columns" , EOL; -$objPHPExcel->getActiveSheet()->getColumnDimension('C')->setVisible(false); -$objPHPExcel->getActiveSheet()->getColumnDimension('D')->setVisible(false); - - -// Set outline levels -echo date('H:i:s') , " Set outline levels" , EOL; -$objPHPExcel->getActiveSheet()->getColumnDimension('E')->setOutlineLevel(1) - ->setVisible(false) - ->setCollapsed(true); - -// Freeze panes -echo date('H:i:s') , " Freeze panes" , EOL; -$objPHPExcel->getActiveSheet()->freezePane('A2'); - - -// Rows to repeat at top -echo date('H:i:s') , " Rows to repeat at top" , EOL; -$objPHPExcel->getActiveSheet()->getPageSetup()->setRowsToRepeatAtTopByStartAndEnd(1, 1); - - -// Add data -for ($i = 2; $i <= 5000; $i++) { - $objPHPExcel->getActiveSheet()->setCellValue('A' . $i, "FName $i") - ->setCellValue('B' . $i, "LName $i") - ->setCellValue('C' . $i, "PhoneNo $i") - ->setCellValue('D' . $i, "FaxNo $i") - ->setCellValue('E' . $i, true); -} - - -// Set active sheet index to the first sheet, so Excel opens this as the first sheet -$objPHPExcel->setActiveSheetIndex(0); - - -// Save Excel 2007 file -echo date('H:i:s') , " Write to Excel2007 format" , EOL; -$callStartTime = microtime(true); - -$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007'); -$objWriter->save(str_replace('.php', '.xlsx', __FILE__)); -$callEndTime = microtime(true); -$callTime = $callEndTime - $callStartTime; - -echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; -echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; -// Echo memory usage -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; - - -// Echo memory peak usage -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; - -// Echo done -echo date('H:i:s') , " Done writing file" , EOL; -echo 'File has been created in ' , getcwd() , EOL; diff --git a/Examples/06largescale-with-cellcaching-sqlite3.php b/Examples/06largescale-with-cellcaching-sqlite3.php deleted file mode 100644 index 2edc2f54..00000000 --- a/Examples/06largescale-with-cellcaching-sqlite3.php +++ /dev/null @@ -1,129 +0,0 @@ -'); - -date_default_timezone_set('Europe/London'); - -/** Include PHPExcel */ -require_once dirname(__FILE__) . '/../src/Bootstrap.php'; - -$cacheMethod = \PHPExcel\CachedObjectStorageFactory::CACHE_TO_SQLITE3; -if (\PHPExcel\Settings::setCacheStorageMethod($cacheMethod)) { - echo date('H:i:s') , " Enable Cell Caching using " , $cacheMethod , " method" , EOL; -} else { - echo date('H:i:s') , " Unable to set Cell Caching using " , $cacheMethod , " method, reverting to memory" , EOL; -} - - -// Create new PHPExcel object -echo date('H:i:s') , " Create new PHPExcel object" , EOL; -$objPHPExcel = new \PHPExcel\Spreadsheet(); - -// Set document properties -echo date('H:i:s') , " Set properties" , EOL; -$objPHPExcel->getProperties()->setCreator("Maarten Balliauw") - ->setLastModifiedBy("Maarten Balliauw") - ->setTitle("Office 2007 XLSX Test Document") - ->setSubject("Office 2007 XLSX Test Document") - ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.") - ->setKeywords("office 2007 openxml php") - ->setCategory("Test result file"); - - -// Create a first sheet -echo date('H:i:s') , " Add data" , EOL; -$objPHPExcel->setActiveSheetIndex(0); -$objPHPExcel->getActiveSheet()->setCellValue('A1', "Firstname"); -$objPHPExcel->getActiveSheet()->setCellValue('B1', "Lastname"); -$objPHPExcel->getActiveSheet()->setCellValue('C1', "Phone"); -$objPHPExcel->getActiveSheet()->setCellValue('D1', "Fax"); -$objPHPExcel->getActiveSheet()->setCellValue('E1', "Is Client ?"); - - -// Hide "Phone" and "fax" column -echo date('H:i:s') , " Hide 'Phone' and 'fax' columns" , EOL; -$objPHPExcel->getActiveSheet()->getColumnDimension('C')->setVisible(false); -$objPHPExcel->getActiveSheet()->getColumnDimension('D')->setVisible(false); - - -// Set outline levels -echo date('H:i:s') , " Set outline levels" , EOL; -$objPHPExcel->getActiveSheet()->getColumnDimension('E')->setOutlineLevel(1) - ->setVisible(false) - ->setCollapsed(true); - -// Freeze panes -echo date('H:i:s') , " Freeze panes" , EOL; -$objPHPExcel->getActiveSheet()->freezePane('A2'); - - -// Rows to repeat at top -echo date('H:i:s') , " Rows to repeat at top" , EOL; -$objPHPExcel->getActiveSheet()->getPageSetup()->setRowsToRepeatAtTopByStartAndEnd(1, 1); - - -// Add data -for ($i = 2; $i <= 5000; $i++) { - $objPHPExcel->getActiveSheet()->setCellValue('A' . $i, "FName $i") - ->setCellValue('B' . $i, "LName $i") - ->setCellValue('C' . $i, "PhoneNo $i") - ->setCellValue('D' . $i, "FaxNo $i") - ->setCellValue('E' . $i, true); -} - - -// Set active sheet index to the first sheet, so Excel opens this as the first sheet -$objPHPExcel->setActiveSheetIndex(0); - - -// Save Excel 2007 file -echo date('H:i:s') , " Write to Excel2007 format" , EOL; -$callStartTime = microtime(true); - -$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007'); -$objWriter->save(str_replace('.php', '.xlsx', __FILE__)); -$callEndTime = microtime(true); -$callTime = $callEndTime - $callStartTime; - -echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; -echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; -// Echo memory usage -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; - - -// Echo memory peak usage -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; - -// Echo done -echo date('H:i:s') , " Done writing file" , EOL; -echo 'File has been created in ' , getcwd() , EOL; diff --git a/Examples/06largescale-with-cellcaching.php b/Examples/06largescale-with-cellcaching.php deleted file mode 100644 index a4939418..00000000 --- a/Examples/06largescale-with-cellcaching.php +++ /dev/null @@ -1,128 +0,0 @@ -'); - -date_default_timezone_set('Europe/London'); - -/** Include PHPExcel */ -require_once dirname(__FILE__) . '/../src/Bootstrap.php'; - -$cacheMethod = \PHPExcel\CachedObjectStorageFactory::CACHE_IN_MEMORY_GZIP; -if (!\PHPExcel\Settings::setCacheStorageMethod($cacheMethod)) { - die($cacheMethod . " caching method is not available" . EOL); -} -echo date('H:i:s') , " Enable Cell Caching using " , $cacheMethod , " method" , EOL; - - -// Create new PHPExcel object -echo date('H:i:s') , " Create new PHPExcel object" , EOL; -$objPHPExcel = new \PHPExcel\Spreadsheet(); - -// Set document properties -echo date('H:i:s') , " Set properties" , EOL; -$objPHPExcel->getProperties()->setCreator("Maarten Balliauw") - ->setLastModifiedBy("Maarten Balliauw") - ->setTitle("Office 2007 XLSX Test Document") - ->setSubject("Office 2007 XLSX Test Document") - ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.") - ->setKeywords("office 2007 openxml php") - ->setCategory("Test result file"); - - -// Create a first sheet -echo date('H:i:s') , " Add data" , EOL; -$objPHPExcel->setActiveSheetIndex(0); -$objPHPExcel->getActiveSheet()->setCellValue('A1', "Firstname"); -$objPHPExcel->getActiveSheet()->setCellValue('B1', "Lastname"); -$objPHPExcel->getActiveSheet()->setCellValue('C1', "Phone"); -$objPHPExcel->getActiveSheet()->setCellValue('D1', "Fax"); -$objPHPExcel->getActiveSheet()->setCellValue('E1', "Is Client ?"); - - -// Hide "Phone" and "fax" column -echo date('H:i:s') , " Hide 'Phone' and 'fax' columns" , EOL; -$objPHPExcel->getActiveSheet()->getColumnDimension('C')->setVisible(false); -$objPHPExcel->getActiveSheet()->getColumnDimension('D')->setVisible(false); - - -// Set outline levels -echo date('H:i:s') , " Set outline levels" , EOL; -$objPHPExcel->getActiveSheet()->getColumnDimension('E')->setOutlineLevel(1) - ->setVisible(false) - ->setCollapsed(true); - -// Freeze panes -echo date('H:i:s') , " Freeze panes" , EOL; -$objPHPExcel->getActiveSheet()->freezePane('A2'); - - -// Rows to repeat at top -echo date('H:i:s') , " Rows to repeat at top" , EOL; -$objPHPExcel->getActiveSheet()->getPageSetup()->setRowsToRepeatAtTopByStartAndEnd(1, 1); - - -// Add data -for ($i = 2; $i <= 5000; $i++) { - $objPHPExcel->getActiveSheet()->setCellValue('A' . $i, "FName $i") - ->setCellValue('B' . $i, "LName $i") - ->setCellValue('C' . $i, "PhoneNo $i") - ->setCellValue('D' . $i, "FaxNo $i") - ->setCellValue('E' . $i, true); -} - - -// Set active sheet index to the first sheet, so Excel opens this as the first sheet -$objPHPExcel->setActiveSheetIndex(0); - - -// Save Excel 2007 file -echo date('H:i:s') , " Write to Excel2007 format" , EOL; -$callStartTime = microtime(true); - -$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007'); -$objWriter->save(str_replace('.php', '.xlsx', __FILE__)); -$callEndTime = microtime(true); -$callTime = $callEndTime - $callStartTime; - -echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; -echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; -// Echo memory usage -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; - - -// Echo memory peak usage -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; - -// Echo done -echo date('H:i:s') , " Done writing file" , EOL; -echo 'File has been created in ' , getcwd() , EOL; diff --git a/Examples/06largescale-xls.php b/Examples/06largescale-xls.php deleted file mode 100644 index e4a6e24b..00000000 --- a/Examples/06largescale-xls.php +++ /dev/null @@ -1,136 +0,0 @@ -'); - -date_default_timezone_set('Europe/London'); - -/** Include PHPExcel */ -require_once dirname(__FILE__) . '/../src/Bootstrap.php'; - - -/* -After doing some test, I've got these results benchmarked -for writing to Excel2007: - - Number of rows Seconds to generate - 200 3 - 500 4 - 1000 6 - 2000 12 - 4000 36 - 8000 64 - 15000 465 -*/ - -// Create new PHPExcel object -echo date('H:i:s') , " Create new PHPExcel object" , EOL; -$objPHPExcel = new \PHPExcel\Spreadsheet(); - -// Set document properties -echo date('H:i:s') , " Set properties" , EOL; -$objPHPExcel->getProperties()->setCreator("Maarten Balliauw") - ->setLastModifiedBy("Maarten Balliauw") - ->setTitle("Office 2007 XLSX Test Document") - ->setSubject("Office 2007 XLSX Test Document") - ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.") - ->setKeywords("office 2007 openxml php") - ->setCategory("Test result file"); - - -// Create a first sheet -echo date('H:i:s') , " Add data" , EOL; -$objPHPExcel->setActiveSheetIndex(0); -$objPHPExcel->getActiveSheet()->setCellValue('A1', "Firstname"); -$objPHPExcel->getActiveSheet()->setCellValue('B1', "Lastname"); -$objPHPExcel->getActiveSheet()->setCellValue('C1', "Phone"); -$objPHPExcel->getActiveSheet()->setCellValue('D1', "Fax"); -$objPHPExcel->getActiveSheet()->setCellValue('E1', "Is Client ?"); - - -// Hide "Phone" and "fax" column -echo date('H:i:s') , " Hide 'Phone' and 'fax' columns" , EOL; -$objPHPExcel->getActiveSheet()->getColumnDimension('C')->setVisible(false); -$objPHPExcel->getActiveSheet()->getColumnDimension('D')->setVisible(false); - - -// Set outline levels -echo date('H:i:s') , " Set outline levels" , EOL; -$objPHPExcel->getActiveSheet()->getColumnDimension('E')->setOutlineLevel(1) - ->setVisible(false) - ->setCollapsed(true); - -// Freeze panes -echo date('H:i:s') , " Freeze panes" , EOL; -$objPHPExcel->getActiveSheet()->freezePane('A2'); - - -// Rows to repeat at top -echo date('H:i:s') , " Rows to repeat at top" , EOL; -$objPHPExcel->getActiveSheet()->getPageSetup()->setRowsToRepeatAtTopByStartAndEnd(1, 1); - - -// Add data -for ($i = 2; $i <= 5000; $i++) { - $objPHPExcel->getActiveSheet()->setCellValue('A' . $i, "FName $i") - ->setCellValue('B' . $i, "LName $i") - ->setCellValue('C' . $i, "PhoneNo $i") - ->setCellValue('D' . $i, "FaxNo $i") - ->setCellValue('E' . $i, true); -} - - -// Set active sheet index to the first sheet, so Excel opens this as the first sheet -$objPHPExcel->setActiveSheetIndex(0); - - -// Save Excel 95 file -echo date('H:i:s') , " Write to Excel5 format" , EOL; -$callStartTime = microtime(true); - -$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel5'); -$objWriter->save(str_replace('.php', '.xls', __FILE__)); -$callEndTime = microtime(true); -$callTime = $callEndTime - $callStartTime; - -echo date('H:i:s') , " File written to " , str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; -echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; -// Echo memory usage -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; - - -// Echo memory peak usage -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; - -// Echo done -echo date('H:i:s') , " Done writing file" , EOL; -echo 'File has been created in ' , getcwd() , EOL; diff --git a/Examples/06largescale.php b/Examples/06largescale.php deleted file mode 100644 index e9b48af8..00000000 --- a/Examples/06largescale.php +++ /dev/null @@ -1,136 +0,0 @@ -'); - -date_default_timezone_set('Europe/London'); - -/** Include PHPExcel */ -require_once dirname(__FILE__) . '/../src/Bootstrap.php'; - - -/* -After doing some test, I've got these results benchmarked -for writing to Excel2007: - - Number of rows Seconds to generate - 200 3 - 500 4 - 1000 6 - 2000 12 - 4000 36 - 8000 64 - 15000 465 -*/ - -// Create new PHPExcel object -echo date('H:i:s') , " Create new PHPExcel object" , EOL; -$objPHPExcel = new \PHPExcel\Spreadsheet(); - -// Set document properties -echo date('H:i:s') , " Set properties" , EOL; -$objPHPExcel->getProperties()->setCreator("Maarten Balliauw") - ->setLastModifiedBy("Maarten Balliauw") - ->setTitle("Office 2007 XLSX Test Document") - ->setSubject("Office 2007 XLSX Test Document") - ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.") - ->setKeywords("office 2007 openxml php") - ->setCategory("Test result file"); - - -// Create a first sheet -echo date('H:i:s') , " Add data" , EOL; -$objPHPExcel->setActiveSheetIndex(0); -$objPHPExcel->getActiveSheet()->setCellValue('A1', "Firstname"); -$objPHPExcel->getActiveSheet()->setCellValue('B1', "Lastname"); -$objPHPExcel->getActiveSheet()->setCellValue('C1', "Phone"); -$objPHPExcel->getActiveSheet()->setCellValue('D1', "Fax"); -$objPHPExcel->getActiveSheet()->setCellValue('E1', "Is Client ?"); - - -// Hide "Phone" and "fax" column -echo date('H:i:s') , " Hide 'Phone' and 'fax' columns" , EOL; -$objPHPExcel->getActiveSheet()->getColumnDimension('C')->setVisible(false); -$objPHPExcel->getActiveSheet()->getColumnDimension('D')->setVisible(false); - - -// Set outline levels -echo date('H:i:s') , " Set outline levels" , EOL; -$objPHPExcel->getActiveSheet()->getColumnDimension('E')->setOutlineLevel(1) - ->setVisible(false) - ->setCollapsed(true); - -// Freeze panes -echo date('H:i:s') , " Freeze panes" , EOL; -$objPHPExcel->getActiveSheet()->freezePane('A2'); - - -// Rows to repeat at top -echo date('H:i:s') , " Rows to repeat at top" , EOL; -$objPHPExcel->getActiveSheet()->getPageSetup()->setRowsToRepeatAtTopByStartAndEnd(1, 1); - - -// Add data -for ($i = 2; $i <= 5000; $i++) { - $objPHPExcel->getActiveSheet()->setCellValue('A' . $i, "FName $i") - ->setCellValue('B' . $i, "LName $i") - ->setCellValue('C' . $i, "PhoneNo $i") - ->setCellValue('D' . $i, "FaxNo $i") - ->setCellValue('E' . $i, true); -} - - -// Set active sheet index to the first sheet, so Excel opens this as the first sheet -$objPHPExcel->setActiveSheetIndex(0); - - -// Save Excel 2007 file -echo date('H:i:s') , " Write to Excel2007 format" , EOL; -$callStartTime = microtime(true); - -$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007'); -$objWriter->save(str_replace('.php', '.xlsx', __FILE__)); -$callEndTime = microtime(true); -$callTime = $callEndTime - $callStartTime; - -echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; -echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; -// Echo memory usage -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; - - -// Echo memory peak usage -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; - -// Echo done -echo date('H:i:s') , " Done writing file" , EOL; -echo 'File has been created in ' , getcwd() , EOL; diff --git a/Examples/07reader.php b/Examples/07reader.php deleted file mode 100644 index 875dc431..00000000 --- a/Examples/07reader.php +++ /dev/null @@ -1,76 +0,0 @@ -'); - -date_default_timezone_set('Europe/London'); - -/** Include PHPExcel */ -require_once dirname(__FILE__) . '/../src/Bootstrap.php'; - - -if (!file_exists("05featuredemo.xlsx")) { - exit("Please run 05featuredemo.php first." . EOL); -} - -echo date('H:i:s') , " Load from Excel2007 file" , EOL; -$callStartTime = microtime(true); - -$objPHPExcel = \PHPExcel\IOFactory::load("05featuredemo.xlsx"); - -$callEndTime = microtime(true); -$callTime = $callEndTime - $callStartTime; -echo 'Call time to read Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; -// Echo memory usage -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; - - -echo date('H:i:s') , " Write to Excel2007 format" , EOL; -$callStartTime = microtime(true); - -$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007'); -$objWriter->save(str_replace('.php', '.xlsx', __FILE__)); - -$callEndTime = microtime(true); -$callTime = $callEndTime - $callStartTime; - -echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; -echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; -// Echo memory usage -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; - - -// Echo memory peak usage -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; - -// Echo done -echo date('H:i:s') , " Done writing file" , EOL; -echo 'File has been created in ' , getcwd() , EOL; diff --git a/Examples/07readerPCLZip.php b/Examples/07readerPCLZip.php deleted file mode 100644 index 76d0cb14..00000000 --- a/Examples/07readerPCLZip.php +++ /dev/null @@ -1,79 +0,0 @@ -'); - -date_default_timezone_set('Europe/London'); - -/** Include PHPExcel */ -require_once dirname(__FILE__) . '/../src/Bootstrap.php'; - - -if (!file_exists("05featuredemo.xlsx")) { - exit("Please run 05featuredemo.php first." . EOL); -} - -// Use PCLZip rather than ZipArchive to read the Excel2007 OfficeOpenXML file -\PHPExcel\Settings::setZipClass(\PHPExcel\Settings::PCLZIP); - -echo date('H:i:s') , " Load from Excel2007 file" , EOL; -$callStartTime = microtime(true); - -$objPHPExcel = \PHPExcel\IOFactory::load("05featuredemo.xlsx"); - -$callEndTime = microtime(true); -$callTime = $callEndTime - $callStartTime; -echo 'Call time to read Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; -// Echo memory usage -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; - - -echo date('H:i:s') , " Write to Excel2007 format" , EOL; -$callStartTime = microtime(true); - -$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007'); -$objWriter->save(str_replace('.php', '.xlsx', __FILE__)); - -$callEndTime = microtime(true); -$callTime = $callEndTime - $callStartTime; - -echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; -echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; -// Echo memory usage -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; - - -// Echo memory peak usage -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; - -// Echo done -echo date('H:i:s') , " Done writing file" , EOL; -echo 'File has been created in ' , getcwd() , EOL; diff --git a/Examples/08conditionalformatting.php b/Examples/08conditionalformatting.php deleted file mode 100644 index 396eb83c..00000000 --- a/Examples/08conditionalformatting.php +++ /dev/null @@ -1,189 +0,0 @@ -'); - -date_default_timezone_set('Europe/London'); - -/** Include PHPExcel */ -require_once dirname(__FILE__) . '/../src/Bootstrap.php'; - - -// Create new PHPExcel object -echo date('H:i:s') , " Create new PHPExcel object" , EOL; -$objPHPExcel = new \PHPExcel\Spreadsheet(); - -// Set document properties -echo date('H:i:s') , " Set document properties" , EOL; -$objPHPExcel->getProperties()->setCreator("Maarten Balliauw") - ->setLastModifiedBy("Maarten Balliauw") - ->setTitle("Office 2007 XLSX Test Document") - ->setSubject("Office 2007 XLSX Test Document") - ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.") - ->setKeywords("office 2007 openxml php") - ->setCategory("Test result file"); - - -// Create a first sheet, representing sales data -echo date('H:i:s') , " Add some data" , EOL; -$objPHPExcel->setActiveSheetIndex(0); -$objPHPExcel->getActiveSheet()->setCellValue('A1', 'Description') - ->setCellValue('B1', 'Amount'); - -$objPHPExcel->getActiveSheet()->setCellValue('A2', 'Paycheck received') - ->setCellValue('B2', 100); - -$objPHPExcel->getActiveSheet()->setCellValue('A3', 'Cup of coffee bought') - ->setCellValue('B3', -1.5); - -$objPHPExcel->getActiveSheet()->setCellValue('A4', 'Cup of coffee bought') - ->setCellValue('B4', -1.5); - -$objPHPExcel->getActiveSheet()->setCellValue('A5', 'Cup of tea bought') - ->setCellValue('B5', -1.2); - -$objPHPExcel->getActiveSheet()->setCellValue('A6', 'Found some money') - ->setCellValue('B6', 8); - -$objPHPExcel->getActiveSheet()->setCellValue('A7', 'Total:') - ->setCellValue('B7', '=SUM(B2:B6)'); - - -// Set column widths -echo date('H:i:s') , " Set column widths" , EOL; -$objPHPExcel->getActiveSheet()->getColumnDimension('A')->setWidth(30); -$objPHPExcel->getActiveSheet()->getColumnDimension('B')->setWidth(12); - - -// Add conditional formatting -echo date('H:i:s') , " Add conditional formatting" , EOL; -$objConditional1 = new \PHPExcel\Style\Conditional(); -$objConditional1->setConditionType(\PHPExcel\Style\Conditional::CONDITION_CELLIS) - ->setOperatorType(\PHPExcel\Style\Conditional::OPERATOR_BETWEEN) - ->addCondition('200') - ->addCondition('400'); -$objConditional1->getStyle()->getFont()->getColor()->setARGB(\PHPExcel\Style\Color::COLOR_YELLOW); -$objConditional1->getStyle()->getFont()->setBold(true); -$objConditional1->getStyle()->getNumberFormat()->setFormatCode(\PHPExcel\Style\NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE); - -$objConditional2 = new \PHPExcel\Style\Conditional(); -$objConditional2->setConditionType(\PHPExcel\Style\Conditional::CONDITION_CELLIS) - ->setOperatorType(\PHPExcel\Style\Conditional::OPERATOR_LESSTHAN) - ->addCondition('0'); -$objConditional2->getStyle()->getFont()->getColor()->setARGB(\PHPExcel\Style\Color::COLOR_RED); -$objConditional2->getStyle()->getFont()->setItalic(true); -$objConditional2->getStyle()->getNumberFormat()->setFormatCode(\PHPExcel\Style\NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE); - -$objConditional3 = new \PHPExcel\Style\Conditional(); -$objConditional3->setConditionType(\PHPExcel\Style\Conditional::CONDITION_CELLIS) - ->setOperatorType(\PHPExcel\Style\Conditional::OPERATOR_GREATERTHANOREQUAL) - ->addCondition('0'); -$objConditional3->getStyle()->getFont()->getColor()->setARGB(\PHPExcel\Style\Color::COLOR_GREEN); -$objConditional3->getStyle()->getFont()->setItalic(true); -$objConditional3->getStyle()->getNumberFormat()->setFormatCode(\PHPExcel\Style\NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE); - -$conditionalStyles = $objPHPExcel->getActiveSheet()->getStyle('B2')->getConditionalStyles(); -array_push($conditionalStyles, $objConditional1); -array_push($conditionalStyles, $objConditional2); -array_push($conditionalStyles, $objConditional3); -$objPHPExcel->getActiveSheet()->getStyle('B2')->setConditionalStyles($conditionalStyles); - - -// duplicate the conditional styles across a range of cells -echo date('H:i:s') , " Duplicate the conditional formatting across a range of cells" , EOL; -$objPHPExcel->getActiveSheet()->duplicateConditionalStyle( - $objPHPExcel->getActiveSheet()->getStyle('B2')->getConditionalStyles(), - 'B3:B7' - ); - - -// Set fonts -echo date('H:i:s') , " Set fonts" , EOL; -$objPHPExcel->getActiveSheet()->getStyle('A1:B1')->getFont()->setBold(true); -//$objPHPExcel->getActiveSheet()->getStyle('B1')->getFont()->setBold(true); -$objPHPExcel->getActiveSheet()->getStyle('A7:B7')->getFont()->setBold(true); -//$objPHPExcel->getActiveSheet()->getStyle('B7')->getFont()->setBold(true); - - -// Set header and footer. When no different headers for odd/even are used, odd header is assumed. -echo date('H:i:s') , " Set header/footer" , EOL; -$objPHPExcel->getActiveSheet()->getHeaderFooter()->setOddHeader('&L&BPersonal cash register&RPrinted on &D'); -$objPHPExcel->getActiveSheet()->getHeaderFooter()->setOddFooter('&L&B' . $objPHPExcel->getProperties()->getTitle() . '&RPage &P of &N'); - - -// Set page orientation and size -echo date('H:i:s') , " Set page orientation and size" , EOL; -$objPHPExcel->getActiveSheet()->getPageSetup()->setOrientation(\PHPExcel\Worksheet\PageSetup::ORIENTATION_PORTRAIT); -$objPHPExcel->getActiveSheet()->getPageSetup()->setPaperSize(\PHPExcel\Worksheet\PageSetup::PAPERSIZE_A4); - - -// Rename worksheet -echo date('H:i:s') , " Rename worksheet" , EOL; -$objPHPExcel->getActiveSheet()->setTitle('Invoice'); - - -// Set active sheet index to the first sheet, so Excel opens this as the first sheet -$objPHPExcel->setActiveSheetIndex(0); - - -// Save Excel 2007 file -echo date('H:i:s') , " Write to Excel2007 format" , EOL; -$callStartTime = microtime(true); - -$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007'); -$objWriter->save(str_replace('.php', '.xlsx', __FILE__)); -$callEndTime = microtime(true); -$callTime = $callEndTime - $callStartTime; - -echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; -echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; -// Save Excel5 file -echo date('H:i:s') , " Write to Excel5 format" , EOL; -$callStartTime = microtime(true); - -$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel5'); -$objWriter->save(str_replace('.php', '.xls', __FILE__)); -$callEndTime = microtime(true); -$callTime = $callEndTime - $callStartTime; - -echo date('H:i:s') , " File written to " , str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; -echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; -// Echo memory usage -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; - - -// Echo memory peak usage -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; - -// Echo done -echo date('H:i:s') , " Done writing file" , EOL; -echo 'File has been created in ' , getcwd() , EOL; diff --git a/Examples/08conditionalformatting2.php b/Examples/08conditionalformatting2.php deleted file mode 100644 index 394d7bae..00000000 --- a/Examples/08conditionalformatting2.php +++ /dev/null @@ -1,136 +0,0 @@ -'); - -date_default_timezone_set('Europe/London'); - -/** Include PHPExcel */ -require_once dirname(__FILE__) . '/../src/Bootstrap.php'; - - -// Create new PHPExcel object -echo date('H:i:s') , " Create new PHPExcel object" , EOL; -$objPHPExcel = new \PHPExcel\Spreadsheet(); - -// Set document properties -echo date('H:i:s') , " Set document properties" , EOL; -$objPHPExcel->getProperties()->setCreator("Maarten Balliauw") - ->setLastModifiedBy("Maarten Balliauw") - ->setTitle("Office 2007 XLSX Test Document") - ->setSubject("Office 2007 XLSX Test Document") - ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.") - ->setKeywords("office 2007 openxml php") - ->setCategory("Test result file"); - - -// Create a first sheet, representing sales data -echo date('H:i:s') , " Add some data" , EOL; -$objPHPExcel->setActiveSheetIndex(0); -$objPHPExcel->getActiveSheet() - ->setCellValue('A1', '-0.5') - ->setCellValue('A2', '-0.25') - ->setCellValue('A3', '0.0') - ->setCellValue('A4', '0.25') - ->setCellValue('A5', '0.5') - ->setCellValue('A6', '0.75') - ->setCellValue('A7', '1.0') - ->setCellValue('A8', '1.25') -; - -$objPHPExcel->getActiveSheet()->getStyle('A1:A8') - ->getNumberFormat() - ->setFormatCode( - \PHPExcel\Style\NumberFormat::FORMAT_PERCENTAGE_00 - ); - - -// Add conditional formatting -echo date('H:i:s') , " Add conditional formatting" , EOL; -$objConditional1 = new \PHPExcel\Style\Conditional(); -$objConditional1->setConditionType(\PHPExcel\Style\Conditional::CONDITION_CELLIS) - ->setOperatorType(\PHPExcel\Style\Conditional::OPERATOR_LESSTHAN) - ->addCondition('0'); -$objConditional1->getStyle()->getFont()->getColor()->setARGB(\PHPExcel\Style\Color::COLOR_RED); - -$objConditional3 = new \PHPExcel\Style\Conditional(); -$objConditional3->setConditionType(\PHPExcel\Style\Conditional::CONDITION_CELLIS) - ->setOperatorType(\PHPExcel\Style\Conditional::OPERATOR_GREATERTHANOREQUAL) - ->addCondition('1'); -$objConditional3->getStyle()->getFont()->getColor()->setARGB(\PHPExcel\Style\Color::COLOR_GREEN); - -$conditionalStyles = $objPHPExcel->getActiveSheet()->getStyle('A1')->getConditionalStyles(); -array_push($conditionalStyles, $objConditional1); -array_push($conditionalStyles, $objConditional3); -$objPHPExcel->getActiveSheet()->getStyle('A1')->setConditionalStyles($conditionalStyles); - - -// duplicate the conditional styles across a range of cells -echo date('H:i:s') , " Duplicate the conditional formatting across a range of cells" , EOL; -$objPHPExcel->getActiveSheet()->duplicateConditionalStyle( - $objPHPExcel->getActiveSheet()->getStyle('A1')->getConditionalStyles(), - 'A2:A8' - ); - - -// Save Excel 2007 file -echo date('H:i:s') , " Write to Excel2007 format" , EOL; -$callStartTime = microtime(true); - -$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007'); -$objWriter->save(str_replace('.php', '.xlsx', __FILE__)); -$callEndTime = microtime(true); -$callTime = $callEndTime - $callStartTime; - -echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; -echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; -// Save Excel5 file -echo date('H:i:s') , " Write to Excel5 format" , EOL; -$callStartTime = microtime(true); - -$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel5'); -$objWriter->save(str_replace('.php', '.xls', __FILE__)); -$callEndTime = microtime(true); -$callTime = $callEndTime - $callStartTime; - -echo date('H:i:s') , " File written to " , str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; -echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; -// Echo memory usage -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; - - -// Echo memory peak usage -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; - -// Echo done -echo date('H:i:s') , " Done writing file" , EOL; -echo 'File has been created in ' , getcwd() , EOL; diff --git a/Examples/09pagebreaks.php b/Examples/09pagebreaks.php deleted file mode 100644 index f7084fcf..00000000 --- a/Examples/09pagebreaks.php +++ /dev/null @@ -1,134 +0,0 @@ -'); - -date_default_timezone_set('Europe/London'); - -/** Include PHPExcel */ -require_once dirname(__FILE__) . '/../src/Bootstrap.php'; - - -// Create new PHPExcel object -echo date('H:i:s') , " Create new PHPExcel object" , EOL; -$objPHPExcel = new \PHPExcel\Spreadsheet(); - -// Set document properties -echo date('H:i:s') , " Set document properties" , EOL; -$objPHPExcel->getProperties()->setCreator("Maarten Balliauw") - ->setLastModifiedBy("Maarten Balliauw") - ->setTitle("Office 2007 XLSX Test Document") - ->setSubject("Office 2007 XLSX Test Document") - ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.") - ->setKeywords("office 2007 openxml php") - ->setCategory("Test result file"); - - -// Create a first sheet -echo date('H:i:s') , " Add data and page breaks" , EOL; -$objPHPExcel->setActiveSheetIndex(0); -$objPHPExcel->getActiveSheet()->setCellValue('A1', "Firstname") - ->setCellValue('B1', "Lastname") - ->setCellValue('C1', "Phone") - ->setCellValue('D1', "Fax") - ->setCellValue('E1', "Is Client ?"); - - -// Add data -for ($i = 2; $i <= 50; $i++) { - $objPHPExcel->getActiveSheet()->setCellValue('A' . $i, "FName $i"); - $objPHPExcel->getActiveSheet()->setCellValue('B' . $i, "LName $i"); - $objPHPExcel->getActiveSheet()->setCellValue('C' . $i, "PhoneNo $i"); - $objPHPExcel->getActiveSheet()->setCellValue('D' . $i, "FaxNo $i"); - $objPHPExcel->getActiveSheet()->setCellValue('E' . $i, true); - - // Add page breaks every 10 rows - if ($i % 10 == 0) { - // Add a page break - $objPHPExcel->getActiveSheet()->setBreak( 'A' . $i, \PHPExcel\Worksheet::BREAK_ROW ); - } -} - -// Set active sheet index to the first sheet, so Excel opens this as the first sheet -$objPHPExcel->setActiveSheetIndex(0); -$objPHPExcel->getActiveSheet()->setTitle('Printing Options'); - -// Set print headers -$objPHPExcel->getActiveSheet() - ->getHeaderFooter()->setOddHeader('&C&24&K0000FF&B&U&A'); -$objPHPExcel->getActiveSheet() - ->getHeaderFooter()->setEvenHeader('&C&24&K0000FF&B&U&A'); - -// Set print footers -$objPHPExcel->getActiveSheet() - ->getHeaderFooter()->setOddFooter('&R&D &T&C&F&LPage &P / &N'); -$objPHPExcel->getActiveSheet() - ->getHeaderFooter()->setEvenFooter('&L&D &T&C&F&RPage &P / &N'); - - - -// Save Excel 2007 file -echo date('H:i:s') , " Write to Excel2007 format" , EOL; -$callStartTime = microtime(true); - -$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007'); -$objWriter->save(str_replace('.php', '.xlsx', __FILE__)); -$callEndTime = microtime(true); -$callTime = $callEndTime - $callStartTime; - -echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; -echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; -// Echo memory usage -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; - - -// Save Excel 95 file -echo date('H:i:s') , " Write to Excel5 format" , EOL; -$callStartTime = microtime(true); - -$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel5'); -$objWriter->save(str_replace('.php', '.xls', __FILE__)); -$callEndTime = microtime(true); -$callTime = $callEndTime - $callStartTime; - -echo date('H:i:s') , " File written to " , str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; -echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; -// Echo memory usage -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; - - -// Echo memory peak usage -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; - -// Echo done -echo date('H:i:s') , " Done writing files" , EOL; -echo 'Files have been created in ' , getcwd() , EOL; diff --git a/Examples/10autofilter-selection-1.php b/Examples/10autofilter-selection-1.php deleted file mode 100644 index 81e51489..00000000 --- a/Examples/10autofilter-selection-1.php +++ /dev/null @@ -1,221 +0,0 @@ -'); - -/** Include PHPExcel */ -require_once dirname(__FILE__) . '/../src/Bootstrap.php'; - - -// Create new PHPExcel object -echo date('H:i:s').' Create new PHPExcel object'.EOL; -$objPHPExcel = new \PHPExcel\Spreadsheet(); - -// Set document properties -echo date('H:i:s').' Set document properties'.EOL; -$objPHPExcel->getProperties()->setCreator('Maarten Balliauw') - ->setLastModifiedBy('Maarten Balliauw') - ->setTitle('PHPExcel Test Document') - ->setSubject('PHPExcel Test Document') - ->setDescription('Test document for PHPExcel, generated using PHP classes.') - ->setKeywords('office PHPExcel php') - ->setCategory('Test result file'); - -// Create the worksheet -echo date('H:i:s').' Add data'.EOL; -$objPHPExcel->setActiveSheetIndex(0); -$objPHPExcel->getActiveSheet()->setCellValue('A1', 'Financial Year') - ->setCellValue('B1', 'Financial Period') - ->setCellValue('C1', 'Country') - ->setCellValue('D1', 'Date') - ->setCellValue('E1', 'Sales Value') - ->setCellValue('F1', 'Expenditure') - ; -$startYear = $endYear = $currentYear = date('Y'); -$startYear--; -$endYear++; - -$years = range($startYear,$endYear); -$periods = range(1,12); -$countries = array( 'United States', 'UK', 'France', 'Germany', - 'Italy', 'Spain', 'Portugal', 'Japan' - ); - -$row = 2; -foreach($years as $year) { - foreach($periods as $period) { - foreach($countries as $country) { - $endDays = date('t',mktime(0,0,0,$period,1,$year)); - for($i = 1; $i <= $endDays; ++$i) { - $eDate = \PHPExcel\Shared\Date::formattedPHPToExcel( - $year, - $period, - $i - ); - $value = rand(500,1000) * (1 + rand(-0.25,+0.25)); - $salesValue = $invoiceValue = NULL; - $incomeOrExpenditure = rand(-1,1); - if ($incomeOrExpenditure == -1) { - $expenditure = rand(-500,-1000) * (1 + rand(-0.25,+0.25)); - $income = NULL; - } elseif ($incomeOrExpenditure == 1) { - $expenditure = rand(-500,-1000) * (1 + rand(-0.25,+0.25)); - $income = rand(500,1000) * (1 + rand(-0.25,+0.25));; - } else { - $expenditure = NULL; - $income = rand(500,1000) * (1 + rand(-0.25,+0.25));; - } - $dataArray = array( $year, - $period, - $country, - $eDate, - $income, - $expenditure, - ); - $objPHPExcel->getActiveSheet()->fromArray($dataArray, NULL, 'A'.$row++); - } - } - } -} -$row--; - - -// Set styling -echo date('H:i:s').' Set styling'.EOL; -$objPHPExcel->getActiveSheet()->getStyle('A1:F1')->getFont()->setBold(true); -$objPHPExcel->getActiveSheet()->getStyle('A1:F1')->getAlignment()->setWrapText(TRUE); -$objPHPExcel->getActiveSheet()->getColumnDimension('C')->setWidth(12.5); -$objPHPExcel->getActiveSheet()->getColumnDimension('D')->setWidth(10.5); -$objPHPExcel->getActiveSheet()->getStyle('D2:D'.$row)->getNumberFormat()->setFormatCode(\PHPExcel\Style\NumberFormat::FORMAT_DATE_YYYYMMDD2); -$objPHPExcel->getActiveSheet()->getStyle('E2:F'.$row)->getNumberFormat()->setFormatCode(\PHPExcel\Style\NumberFormat::FORMAT_CURRENCY_USD_SIMPLE); -$objPHPExcel->getActiveSheet()->getColumnDimension('F')->setWidth(14); -$objPHPExcel->getActiveSheet()->freezePane('A2'); - - - -// Set autofilter range -echo date('H:i:s').' Set autofilter range'.EOL; -// Always include the complete filter range! -// Excel does support setting only the caption -// row, but that's not a best practise... -$objPHPExcel->getActiveSheet()->setAutoFilter($objPHPExcel->getActiveSheet()->calculateWorksheetDimension()); - -// Set active filters -$autoFilter = $objPHPExcel->getActiveSheet()->getAutoFilter(); -echo date('H:i:s').' Set active filters'.EOL; -// Filter the Country column on a filter value of countries beginning with the letter U (or Japan) -// We use * as a wildcard, so specify as U* and using a wildcard requires customFilter -$autoFilter->getColumn('C') - ->setFilterType(\PHPExcel\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_CUSTOMFILTER) - ->createRule() - ->setRule( - \PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL, - 'u*' - ) - ->setRuleType(\PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER); -$autoFilter->getColumn('C') - ->createRule() - ->setRule( - \PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL, - 'japan' - ) - ->setRuleType(\PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER); -// Filter the Date column on a filter value of the first day of every period of the current year -// We us a dateGroup ruletype for this, although it is still a standard filter -foreach($periods as $period) { - $endDate = date('t',mktime(0,0,0,$period,1,$currentYear)); - - $autoFilter->getColumn('D') - ->setFilterType(\PHPExcel\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_FILTER) - ->createRule() - ->setRule( - \PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL, - array( - 'year' => $currentYear, - 'month' => $period, - 'day' => $endDate - ) - ) - ->setRuleType(\PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DATEGROUP); -} -// Display only sales values that are blank -// Standard filter, operator equals, and value of NULL -$autoFilter->getColumn('E') - ->setFilterType(\PHPExcel\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_FILTER) - ->createRule() - ->setRule( - \PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL, - '' - ); - - -// Set active sheet index to the first sheet, so Excel opens this as the first sheet -$objPHPExcel->setActiveSheetIndex(0); - - -// Save Excel 2007 file -echo date('H:i:s') , " Write to Excel2007 format" , EOL; -$callStartTime = microtime(true); - -$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007'); -$objWriter->save(str_replace('.php', '.xlsx', __FILE__)); -$callEndTime = microtime(true); -$callTime = $callEndTime - $callStartTime; - -echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; -echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; -// Echo memory usage -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; - - -// Save Excel 95 file -echo date('H:i:s') , " Write to Excel5 format" , EOL; -$callStartTime = microtime(true); - -$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel5'); -$objWriter->save(str_replace('.php', '.xls', __FILE__)); -$callEndTime = microtime(true); -$callTime = $callEndTime - $callStartTime; - -echo date('H:i:s') , " File written to " , str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; -echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; -// Echo memory usage -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; - - -// Echo memory peak usage -echo date('H:i:s').' Peak memory usage: '.(memory_get_peak_usage(true) / 1024 / 1024).' MB'.EOL; - -// Echo done -echo date('H:i:s').' Done writing files'.EOL; -echo 'Files have been created in ' , getcwd() , EOL; diff --git a/Examples/10autofilter-selection-2.php b/Examples/10autofilter-selection-2.php deleted file mode 100644 index 087ba43e..00000000 --- a/Examples/10autofilter-selection-2.php +++ /dev/null @@ -1,212 +0,0 @@ -'); - -/** Include PHPExcel */ -require_once dirname(__FILE__) . '/../src/Bootstrap.php'; - - -// Create new PHPExcel object -echo date('H:i:s').' Create new PHPExcel object'.EOL; -$objPHPExcel = new \PHPExcel\Spreadsheet(); - -// Set document properties -echo date('H:i:s').' Set document properties'.EOL; -$objPHPExcel->getProperties()->setCreator('Maarten Balliauw') - ->setLastModifiedBy('Maarten Balliauw') - ->setTitle('PHPExcel Test Document') - ->setSubject('PHPExcel Test Document') - ->setDescription('Test document for PHPExcel, generated using PHP classes.') - ->setKeywords('office PHPExcel php') - ->setCategory('Test result file'); - -// Create the worksheet -echo date('H:i:s').' Add data'.EOL; -$objPHPExcel->setActiveSheetIndex(0); -$objPHPExcel->getActiveSheet()->setCellValue('A1', 'Financial Year') - ->setCellValue('B1', 'Financial Period') - ->setCellValue('C1', 'Country') - ->setCellValue('D1', 'Date') - ->setCellValue('E1', 'Sales Value') - ->setCellValue('F1', 'Expenditure'); -$startYear = $endYear = $currentYear = date('Y'); -$startYear--; -$endYear++; - -$years = range($startYear,$endYear); -$periods = range(1,12); -$countries = array( 'United States', 'UK', 'France', 'Germany', - 'Italy', 'Spain', 'Portugal', 'Japan' - ); - -$row = 2; -foreach($years as $year) { - foreach($periods as $period) { - foreach($countries as $country) { - $endDays = date('t',mktime(0,0,0,$period,1,$year)); - for($i = 1; $i <= $endDays; ++$i) { - $eDate = \PHPExcel\Shared\Date::formattedPHPToExcel( - $year, - $period, - $i - ); - $value = rand(500,1000) * (1 + rand(-0.25,+0.25)); - $salesValue = $invoiceValue = NULL; - $incomeOrExpenditure = rand(-1,1); - if ($incomeOrExpenditure == -1) { - $expenditure = rand(-500,-1000) * (1 + rand(-0.25,+0.25)); - $income = NULL; - } elseif ($incomeOrExpenditure == 1) { - $expenditure = rand(-500,-1000) * (1 + rand(-0.25,+0.25)); - $income = rand(500,1000) * (1 + rand(-0.25,+0.25));; - } else { - $expenditure = NULL; - $income = rand(500,1000) * (1 + rand(-0.25,+0.25));; - } - $dataArray = array( $year, - $period, - $country, - $eDate, - $income, - $expenditure, - ); - $objPHPExcel->getActiveSheet()->fromArray($dataArray, NULL, 'A'.$row++); - } - } - } -} -$row--; - - -// Set styling -echo date('H:i:s').' Set styling'.EOL; -$objPHPExcel->getActiveSheet()->getStyle('A1:F1')->getFont()->setBold(true); -$objPHPExcel->getActiveSheet()->getStyle('A1:F1')->getAlignment()->setWrapText(TRUE); -$objPHPExcel->getActiveSheet()->getColumnDimension('C')->setWidth(12.5); -$objPHPExcel->getActiveSheet()->getColumnDimension('D')->setWidth(10.5); -$objPHPExcel->getActiveSheet()->getStyle('D2:D'.$row)->getNumberFormat()->setFormatCode(\PHPExcel\Style\NumberFormat::FORMAT_DATE_YYYYMMDD2); -$objPHPExcel->getActiveSheet()->getStyle('E2:F'.$row)->getNumberFormat()->setFormatCode(\PHPExcel\Style\NumberFormat::FORMAT_CURRENCY_USD_SIMPLE); -$objPHPExcel->getActiveSheet()->getColumnDimension('F')->setWidth(14); -$objPHPExcel->getActiveSheet()->freezePane('A2'); - - - -// Set autofilter range -echo date('H:i:s').' Set autofilter range'.EOL; -// Always include the complete filter range! -// Excel does support setting only the caption -// row, but that's not a best practise... -$objPHPExcel->getActiveSheet()->setAutoFilter($objPHPExcel->getActiveSheet()->calculateWorksheetDimension()); - -// Set active filters -$autoFilter = $objPHPExcel->getActiveSheet()->getAutoFilter(); -echo date('H:i:s').' Set active filters'.EOL; -// Filter the Country column on a filter value of Germany -// As it's just a simple value filter, we can use FILTERTYPE_FILTER -$autoFilter->getColumn('C') - ->setFilterType(\PHPExcel\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_FILTER) - ->createRule() - ->setRule( - \PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL, - 'Germany' - ); -// Filter the Date column on a filter value of the year to date -$autoFilter->getColumn('D') - ->setFilterType(\PHPExcel\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_DYNAMICFILTER) - ->createRule() - ->setRule( - \PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL, - NULL, - \PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DYNAMIC_YEARTODATE - ) - ->setRuleType(\PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DYNAMICFILTER); -// Display only sales values that are between 400 and 600 -$autoFilter->getColumn('E') - ->setFilterType(\PHPExcel\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_CUSTOMFILTER) - ->createRule() - ->setRule( - \PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_GREATERTHANOREQUAL, - 400 - ) - ->setRuleType(\PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER); -$autoFilter->getColumn('E') - ->setJoin(\PHPExcel\Worksheet\AutoFilter\Column::AUTOFILTER_COLUMN_JOIN_AND) - ->createRule() - ->setRule( - \PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_LESSTHANOREQUAL, - 600 - ) - ->setRuleType(\PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER); - - -// Set active sheet index to the first sheet, so Excel opens this as the first sheet -$objPHPExcel->setActiveSheetIndex(0); - - -// Save Excel 2007 file -echo date('H:i:s') , " Write to Excel2007 format" , EOL; -$callStartTime = microtime(true); - -$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007'); -$objWriter->save(str_replace('.php', '.xlsx', __FILE__)); -$callEndTime = microtime(true); -$callTime = $callEndTime - $callStartTime; - -echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; -echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; -// Echo memory usage -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; - - -// Save Excel 95 file -echo date('H:i:s') , " Write to Excel5 format" , EOL; -$callStartTime = microtime(true); - -$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel5'); -$objWriter->save(str_replace('.php', '.xls', __FILE__)); -$callEndTime = microtime(true); -$callTime = $callEndTime - $callStartTime; - -echo date('H:i:s') , " File written to " , str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; -echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; -// Echo memory usage -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; - - -// Echo memory peak usage -echo date('H:i:s').' Peak memory usage: '.(memory_get_peak_usage(true) / 1024 / 1024).' MB'.EOL; - -// Echo done -echo date('H:i:s').' Done writing files'.EOL; -echo 'Files have been created in ' , getcwd() , EOL; diff --git a/Examples/10autofilter-selection-display.php b/Examples/10autofilter-selection-display.php deleted file mode 100644 index 28ceb507..00000000 --- a/Examples/10autofilter-selection-display.php +++ /dev/null @@ -1,198 +0,0 @@ -'); - -/** Include PHPExcel */ -require_once dirname(__FILE__) . '/../src/Bootstrap.php'; - - -// Create new PHPExcel object -echo date('H:i:s').' Create new PHPExcel object'.EOL; -$objPHPExcel = new \PHPExcel\Spreadsheet(); - -// Set document properties -echo date('H:i:s').' Set document properties'.EOL; -$objPHPExcel->getProperties()->setCreator('Maarten Balliauw') - ->setLastModifiedBy('Maarten Balliauw') - ->setTitle('PHPExcel Test Document') - ->setSubject('PHPExcel Test Document') - ->setDescription('Test document for PHPExcel, generated using PHP classes.') - ->setKeywords('office PHPExcel php') - ->setCategory('Test result file'); - -// Create the worksheet -echo date('H:i:s').' Add data'.EOL; -$objPHPExcel->setActiveSheetIndex(0); -$objPHPExcel->getActiveSheet()->setCellValue('A1', 'Financial Year') - ->setCellValue('B1', 'Financial Period') - ->setCellValue('C1', 'Country') - ->setCellValue('D1', 'Date') - ->setCellValue('E1', 'Sales Value') - ->setCellValue('F1', 'Expenditure') - ; -$startYear = $endYear = $currentYear = date('Y'); -$startYear--; -$endYear++; - -$years = range($startYear,$endYear); -$periods = range(1,12); -$countries = array( 'United States', 'UK', 'France', 'Germany', - 'Italy', 'Spain', 'Portugal', 'Japan' - ); - -$row = 2; -foreach($years as $year) { - foreach($periods as $period) { - foreach($countries as $country) { - $endDays = date('t',mktime(0,0,0,$period,1,$year)); - for($i = 1; $i <= $endDays; ++$i) { - $eDate = \PHPExcel\Shared\Date::formattedPHPToExcel( - $year, - $period, - $i - ); - $value = rand(500,1000) * (1 + rand(-0.25,+0.25)); - $salesValue = $invoiceValue = NULL; - $incomeOrExpenditure = rand(-1,1); - if ($incomeOrExpenditure == -1) { - $expenditure = rand(-500,-1000) * (1 + rand(-0.25,+0.25)); - $income = NULL; - } elseif ($incomeOrExpenditure == 1) { - $expenditure = rand(-500,-1000) * (1 + rand(-0.25,+0.25)); - $income = rand(500,1000) * (1 + rand(-0.25,+0.25));; - } else { - $expenditure = NULL; - $income = rand(500,1000) * (1 + rand(-0.25,+0.25));; - } - $dataArray = array( $year, - $period, - $country, - $eDate, - $income, - $expenditure, - ); - $objPHPExcel->getActiveSheet()->fromArray($dataArray, NULL, 'A'.$row++); - } - } - } -} -$row--; - - -// Set styling -echo date('H:i:s').' Set styling'.EOL; -$objPHPExcel->getActiveSheet()->getStyle('A1:F1')->getFont()->setBold(true); -$objPHPExcel->getActiveSheet()->getStyle('A1:F1')->getAlignment()->setWrapText(TRUE); -$objPHPExcel->getActiveSheet()->getColumnDimension('C')->setWidth(12.5); -$objPHPExcel->getActiveSheet()->getColumnDimension('D')->setWidth(10.5); -$objPHPExcel->getActiveSheet()->getStyle('D2:D'.$row)->getNumberFormat()->setFormatCode(\PHPExcel\Style\NumberFormat::FORMAT_DATE_YYYYMMDD2); -$objPHPExcel->getActiveSheet()->getStyle('E2:F'.$row)->getNumberFormat()->setFormatCode(\PHPExcel\Style\NumberFormat::FORMAT_CURRENCY_USD_SIMPLE); -$objPHPExcel->getActiveSheet()->getColumnDimension('F')->setWidth(14); -$objPHPExcel->getActiveSheet()->freezePane('A2'); - - - -// Set autofilter range -echo date('H:i:s').' Set autofilter range'.EOL; -// Always include the complete filter range! -// Excel does support setting only the caption -// row, but that's not a best practise... -$objPHPExcel->getActiveSheet()->setAutoFilter($objPHPExcel->getActiveSheet()->calculateWorksheetDimension()); - -// Set active filters -$autoFilter = $objPHPExcel->getActiveSheet()->getAutoFilter(); -echo date('H:i:s').' Set active filters'.EOL; -// Filter the Country column on a filter value of countries beginning with the letter U (or Japan) -// We use * as a wildcard, so specify as U* and using a wildcard requires customFilter -$autoFilter->getColumn('C') - ->setFilterType(\PHPExcel\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_CUSTOMFILTER) - ->createRule() - ->setRule( - \PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL, - 'u*' - ) - ->setRuleType(\PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER); -$autoFilter->getColumn('C') - ->createRule() - ->setRule( - \PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL, - 'japan' - ) - ->setRuleType(\PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER); -// Filter the Date column on a filter value of the first day of every period of the current year -// We us a dateGroup ruletype for this, although it is still a standard filter -foreach($periods as $period) { - $endDate = date('t',mktime(0,0,0,$period,1,$currentYear)); - - $autoFilter->getColumn('D') - ->setFilterType(\PHPExcel\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_FILTER) - ->createRule() - ->setRule( - \PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL, - array( - 'year' => $currentYear, - 'month' => $period, - 'day' => $endDate - ) - ) - ->setRuleType(\PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DATEGROUP); -} -// Display only sales values that are blank -// Standard filter, operator equals, and value of NULL -$autoFilter->getColumn('E') - ->setFilterType(\PHPExcel\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_FILTER) - ->createRule() - ->setRule( - \PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL, - '' - ); - -// Execute filtering -echo date('H:i:s').' Execute filtering'.EOL; -$autoFilter->showHideRows(); - -// Set active sheet index to the first sheet, so Excel opens this as the first sheet -$objPHPExcel->setActiveSheetIndex(0); - - -// Display Results of filtering -echo date('H:i:s').' Display filtered rows'.EOL; -foreach ($objPHPExcel->getActiveSheet()->getRowIterator() as $row) { - if ($objPHPExcel->getActiveSheet()->getRowDimension($row->getRowIndex())->getVisible()) { - echo ' Row number - ' , $row->getRowIndex() , ' '; - echo $objPHPExcel->getActiveSheet()->getCell('C'.$row->getRowIndex())->getValue(), ' '; - echo $objPHPExcel->getActiveSheet()->getCell('D'.$row->getRowIndex())->getFormattedValue(), ' '; - echo EOL; - } -} diff --git a/Examples/10autofilter.php b/Examples/10autofilter.php deleted file mode 100644 index a4f0c008..00000000 --- a/Examples/10autofilter.php +++ /dev/null @@ -1,171 +0,0 @@ -'); - -date_default_timezone_set('Europe/London'); - -/** Include PHPExcel */ -require_once dirname(__FILE__) . '/../src/Bootstrap.php'; - -// Create new PHPExcel object -echo date('H:i:s').' Create new PHPExcel object'.EOL; -$objPHPExcel = new \PHPExcel\Spreadsheet(); - -// Set document properties -echo date('H:i:s').' Set document properties'.EOL; -$objPHPExcel->getProperties()->setCreator('Maarten Balliauw') - ->setLastModifiedBy('Maarten Balliauw') - ->setTitle('PHPExcel Test Document') - ->setSubject('PHPExcel Test Document') - ->setDescription('Test document for PHPExcel, generated using PHP classes.') - ->setKeywords('office PHPExcel php') - ->setCategory('Test result file'); - -// Create the worksheet -echo date('H:i:s').' Add data'.EOL; -$objPHPExcel->setActiveSheetIndex(0); -$objPHPExcel->getActiveSheet()->setCellValue('A1', 'Year') - ->setCellValue('B1', 'Quarter') - ->setCellValue('C1', 'Country') - ->setCellValue('D1', 'Sales'); - -$dataArray = array(array('2010', 'Q1', 'United States', 790), - array('2010', 'Q2', 'United States', 730), - array('2010', 'Q3', 'United States', 860), - array('2010', 'Q4', 'United States', 850), - array('2011', 'Q1', 'United States', 800), - array('2011', 'Q2', 'United States', 700), - array('2011', 'Q3', 'United States', 900), - array('2011', 'Q4', 'United States', 950), - array('2010', 'Q1', 'Belgium', 380), - array('2010', 'Q2', 'Belgium', 390), - array('2010', 'Q3', 'Belgium', 420), - array('2010', 'Q4', 'Belgium', 460), - array('2011', 'Q1', 'Belgium', 400), - array('2011', 'Q2', 'Belgium', 350), - array('2011', 'Q3', 'Belgium', 450), - array('2011', 'Q4', 'Belgium', 500), - array('2010', 'Q1', 'UK', 690), - array('2010', 'Q2', 'UK', 610), - array('2010', 'Q3', 'UK', 620), - array('2010', 'Q4', 'UK', 600), - array('2011', 'Q1', 'UK', 720), - array('2011', 'Q2', 'UK', 650), - array('2011', 'Q3', 'UK', 580), - array('2011', 'Q4', 'UK', 510), - array('2010', 'Q1', 'France', 510), - array('2010', 'Q2', 'France', 490), - array('2010', 'Q3', 'France', 460), - array('2010', 'Q4', 'France', 590), - array('2011', 'Q1', 'France', 620), - array('2011', 'Q2', 'France', 650), - array('2011', 'Q3', 'France', 415), - array('2011', 'Q4', 'France', 570), - array('2010', 'Q1', 'Germany', 720), - array('2010', 'Q2', 'Germany', 680), - array('2010', 'Q3', 'Germany', 640), - array('2010', 'Q4', 'Germany', 660), - array('2011', 'Q1', 'Germany', 680), - array('2011', 'Q2', 'Germany', 620), - array('2011', 'Q3', 'Germany', 710), - array('2011', 'Q4', 'Germany', 690), - array('2010', 'Q1', 'Spain', 510), - array('2010', 'Q2', 'Spain', 490), - array('2010', 'Q3', 'Spain', 470), - array('2010', 'Q4', 'Spain', 420), - array('2011', 'Q1', 'Spain', 460), - array('2011', 'Q2', 'Spain', 390), - array('2011', 'Q3', 'Spain', 430), - array('2011', 'Q4', 'Spain', 415), - array('2010', 'Q1', 'Italy', 440), - array('2010', 'Q2', 'Italy', 410), - array('2010', 'Q3', 'Italy', 420), - array('2010', 'Q4', 'Italy', 450), - array('2011', 'Q1', 'Italy', 430), - array('2011', 'Q2', 'Italy', 370), - array('2011', 'Q3', 'Italy', 350), - array('2011', 'Q4', 'Italy', 335), - ); -$objPHPExcel->getActiveSheet()->fromArray($dataArray, NULL, 'A2'); - -// Set title row bold -echo date('H:i:s').' Set title row bold'.EOL; -$objPHPExcel->getActiveSheet()->getStyle('A1:D1')->getFont()->setBold(true); - -// Set autofilter -echo date('H:i:s').' Set autofilter'.EOL; -// Always include the complete filter range! -// Excel does support setting only the caption -// row, but that's not a best practise... -$objPHPExcel->getActiveSheet()->setAutoFilter($objPHPExcel->getActiveSheet()->calculateWorksheetDimension()); - -// Set active sheet index to the first sheet, so Excel opens this as the first sheet -$objPHPExcel->setActiveSheetIndex(0); - - -// Save Excel 2007 file -echo date('H:i:s') , " Write to Excel2007 format" , EOL; -$callStartTime = microtime(true); - -$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007'); -$objWriter->save(str_replace('.php', '.xlsx', __FILE__)); -$callEndTime = microtime(true); -$callTime = $callEndTime - $callStartTime; - -echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; -echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; -// Echo memory usage -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; - - -// Save Excel 95 file -echo date('H:i:s') , " Write to Excel5 format" , EOL; -$callStartTime = microtime(true); - -$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel5'); -$objWriter->save(str_replace('.php', '.xls', __FILE__)); -$callEndTime = microtime(true); -$callTime = $callEndTime - $callStartTime; - -echo date('H:i:s') , " File written to " , str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; -echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; -// Echo memory usage -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; - - -// Echo memory peak usage -echo date('H:i:s').' Peak memory usage: '.(memory_get_peak_usage(true) / 1024 / 1024).' MB'.EOL; - -// Echo done -echo date('H:i:s').' Done writing files'.EOL; -echo 'Files have been created in ' , getcwd() , EOL; diff --git a/Examples/11documentsecurity-xls.php b/Examples/11documentsecurity-xls.php deleted file mode 100644 index 59f0cb3f..00000000 --- a/Examples/11documentsecurity-xls.php +++ /dev/null @@ -1,109 +0,0 @@ -'); - -date_default_timezone_set('Europe/London'); - -/** Include PHPExcel */ -require_once dirname(__FILE__) . '/../src/Bootstrap.php'; - - -// Create new PHPExcel object -echo date('H:i:s') , " Create new PHPExcel object" , EOL; -$objPHPExcel = new \PHPExcel\Spreadsheet(); - -// Set document properties -echo date('H:i:s') , " Set document properties" , EOL; -$objPHPExcel->getProperties()->setCreator("Maarten Balliauw") - ->setLastModifiedBy("Maarten Balliauw") - ->setTitle("Office 2007 XLSX Test Document") - ->setSubject("Office 2007 XLSX Test Document") - ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.") - ->setKeywords("office 2007 openxml php") - ->setCategory("Test result file"); - - -// Add some data -echo date('H:i:s') , " Add some data" , EOL; -$objPHPExcel->setActiveSheetIndex(0); -$objPHPExcel->getActiveSheet()->setCellValue('A1', 'Hello'); -$objPHPExcel->getActiveSheet()->setCellValue('B2', 'world!'); -$objPHPExcel->getActiveSheet()->setCellValue('C1', 'Hello'); -$objPHPExcel->getActiveSheet()->setCellValue('D2', 'world!'); - -// Rename worksheet -echo date('H:i:s') , " Rename worksheet" , EOL; -$objPHPExcel->getActiveSheet()->setTitle('Simple'); - - -// Set document security -echo date('H:i:s') , " Set document security" , EOL; -$objPHPExcel->getSecurity()->setLockWindows(true); -$objPHPExcel->getSecurity()->setLockStructure(true); -$objPHPExcel->getSecurity()->setWorkbookPassword("PHPExcel"); - - -// Set sheet security -echo date('H:i:s') , " Set sheet security" , EOL; -$objPHPExcel->getActiveSheet()->getProtection()->setPassword('PHPExcel'); -$objPHPExcel->getActiveSheet()->getProtection()->setSheet(true); // This should be enabled in order to enable any of the following! -$objPHPExcel->getActiveSheet()->getProtection()->setSort(true); -$objPHPExcel->getActiveSheet()->getProtection()->setInsertRows(true); -$objPHPExcel->getActiveSheet()->getProtection()->setFormatCells(true); - - -// Set active sheet index to the first sheet, so Excel opens this as the first sheet -$objPHPExcel->setActiveSheetIndex(0); - - -// Save Excel 95 file -echo date('H:i:s') , " Write to Excel5 format" , EOL; -$callStartTime = microtime(true); - -$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel5'); -$objWriter->save(str_replace('.php', '.xls', __FILE__)); -$callEndTime = microtime(true); -$callTime = $callEndTime - $callStartTime; - -echo date('H:i:s') , " File written to " , str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; -echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; -// Echo memory usage -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; - - -// Echo memory peak usage -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; - -// Echo done -echo date('H:i:s') , " Done writing file" , EOL; -echo 'File has been created in ' , getcwd() , EOL; diff --git a/Examples/11documentsecurity.php b/Examples/11documentsecurity.php deleted file mode 100644 index 83546afd..00000000 --- a/Examples/11documentsecurity.php +++ /dev/null @@ -1,109 +0,0 @@ -'); - -date_default_timezone_set('Europe/London'); - -/** Include PHPExcel */ -require_once dirname(__FILE__) . '/../src/Bootstrap.php'; - - -// Create new PHPExcel object -echo date('H:i:s') , " Create new PHPExcel object" , EOL; -$objPHPExcel = new \PHPExcel\Spreadsheet(); - -// Set document properties -echo date('H:i:s') , " Set document properties" , EOL; -$objPHPExcel->getProperties()->setCreator("Maarten Balliauw") - ->setLastModifiedBy("Maarten Balliauw") - ->setTitle("Office 2007 XLSX Test Document") - ->setSubject("Office 2007 XLSX Test Document") - ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.") - ->setKeywords("office 2007 openxml php") - ->setCategory("Test result file"); - - -// Add some data -echo date('H:i:s') , " Add some data" , EOL; -$objPHPExcel->setActiveSheetIndex(0); -$objPHPExcel->getActiveSheet()->setCellValue('A1', 'Hello'); -$objPHPExcel->getActiveSheet()->setCellValue('B2', 'world!'); -$objPHPExcel->getActiveSheet()->setCellValue('C1', 'Hello'); -$objPHPExcel->getActiveSheet()->setCellValue('D2', 'world!'); - -// Rename worksheet -echo date('H:i:s') , " Rename worksheet" , EOL; -$objPHPExcel->getActiveSheet()->setTitle('Simple'); - - -// Set document security -echo date('H:i:s') , " Set document security" , EOL; -$objPHPExcel->getSecurity()->setLockWindows(true); -$objPHPExcel->getSecurity()->setLockStructure(true); -$objPHPExcel->getSecurity()->setWorkbookPassword("PHPExcel"); - - -// Set sheet security -echo date('H:i:s') , " Set sheet security" , EOL; -$objPHPExcel->getActiveSheet()->getProtection()->setPassword('PHPExcel'); -$objPHPExcel->getActiveSheet()->getProtection()->setSheet(true); // This should be enabled in order to enable any of the following! -$objPHPExcel->getActiveSheet()->getProtection()->setSort(true); -$objPHPExcel->getActiveSheet()->getProtection()->setInsertRows(true); -$objPHPExcel->getActiveSheet()->getProtection()->setFormatCells(true); - - -// Set active sheet index to the first sheet, so Excel opens this as the first sheet -$objPHPExcel->setActiveSheetIndex(0); - - -// Save Excel 2007 file -echo date('H:i:s') , " Write to Excel2007 format" , EOL; -$callStartTime = microtime(true); - -$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007'); -$objWriter->save(str_replace('.php', '.xlsx', __FILE__)); -$callEndTime = microtime(true); -$callTime = $callEndTime - $callStartTime; - -echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; -echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; -// Echo memory usage -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; - - -// Echo memory peak usage -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; - -// Echo done -echo date('H:i:s') , " Done writing file" , EOL; -echo 'File has been created in ' , getcwd() , EOL; diff --git a/Examples/12cellProtection.php b/Examples/12cellProtection.php deleted file mode 100644 index ac9ddaed..00000000 --- a/Examples/12cellProtection.php +++ /dev/null @@ -1,107 +0,0 @@ -'); - -date_default_timezone_set('Europe/London'); - -/** Include PHPExcel */ -require_once dirname(__FILE__) . '/../src/Bootstrap.php'; - - -// Create new PHPExcel object -echo date('H:i:s') , " Create new PHPExcel object" , EOL; -$objPHPExcel = new \PHPExcel\Spreadsheet(); - -// Set document properties -echo date('H:i:s') , " Set document properties" , EOL; -$objPHPExcel->getProperties()->setCreator("Mark Baker") - ->setLastModifiedBy("Mark Baker") - ->setTitle("Office 2007 XLSX Test Document") - ->setSubject("Office 2007 XLSX Test Document") - ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.") - ->setKeywords("office 2007 openxml php") - ->setCategory("Test result file"); - - -// Add some data -echo date('H:i:s') , " Add some data" , EOL; -$objPHPExcel->setActiveSheetIndex(0); -$objPHPExcel->getActiveSheet()->setCellValue('A1', 'Crouching'); -$objPHPExcel->getActiveSheet()->setCellValue('B1', 'Tiger'); -$objPHPExcel->getActiveSheet()->setCellValue('A2', 'Hidden'); -$objPHPExcel->getActiveSheet()->setCellValue('B2', 'Dragon'); - -// Rename worksheet -echo date('H:i:s') , " Rename worksheet" , EOL; -$objPHPExcel->getActiveSheet()->setTitle('Simple'); - - -// Set document security -echo date('H:i:s') , " Set cell protection" , EOL; - - -// Set sheet security -echo date('H:i:s') , " Set sheet security" , EOL; -$objPHPExcel->getActiveSheet()->getProtection()->setSheet(true); -$objPHPExcel->getActiveSheet() - ->getStyle('A2:B2') - ->getProtection()->setLocked( - \PHPExcel\Style\Protection::PROTECTION_UNPROTECTED - ); - - -// Set active sheet index to the first sheet, so Excel opens this as the first sheet -$objPHPExcel->setActiveSheetIndex(0); - - -// Save Excel 2007 file -echo date('H:i:s') , " Write to Excel2007 format" , EOL; -$callStartTime = microtime(true); - -$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007'); -$objWriter->save(str_replace('.php', '.xlsx', __FILE__)); -$callEndTime = microtime(true); -$callTime = $callEndTime - $callStartTime; - -echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; -echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; -// Echo memory usage -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; - - -// Echo memory peak usage -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; - -// Echo done -echo date('H:i:s') , " Done writing file" , EOL; -echo 'File has been created in ' , getcwd() , EOL; diff --git a/Examples/13calculation.php b/Examples/13calculation.php deleted file mode 100644 index e7ac97c3..00000000 --- a/Examples/13calculation.php +++ /dev/null @@ -1,235 +0,0 @@ -'); - -date_default_timezone_set('Europe/London'); -mt_srand(1234567890); - -/** Include PHPExcel */ -require_once dirname(__FILE__) . '/../src/Bootstrap.php'; - - -// List functions -echo date('H:i:s') , " List implemented functions" , EOL; -$objCalc = \PHPExcel\Calculation::getInstance(); -print_r($objCalc->listFunctionNames()); - -// Create new PHPExcel object -echo date('H:i:s') , " Create new PHPExcel object" , EOL; -$objPHPExcel = new \PHPExcel\Spreadsheet(); - -// Add some data, we will use some formulas here -echo date('H:i:s') , " Add some data and formulas" , EOL; -$objPHPExcel->getActiveSheet()->setCellValue('A14', 'Count:') - ->setCellValue('A15', 'Sum:') - ->setCellValue('A16', 'Max:') - ->setCellValue('A17', 'Min:') - ->setCellValue('A18', 'Average:') - ->setCellValue('A19', 'Median:') - ->setCellValue('A20', 'Mode:'); - -$objPHPExcel->getActiveSheet()->setCellValue('A22', 'CountA:') - ->setCellValue('A23', 'MaxA:') - ->setCellValue('A24', 'MinA:'); - -$objPHPExcel->getActiveSheet()->setCellValue('A26', 'StDev:') - ->setCellValue('A27', 'StDevA:') - ->setCellValue('A28', 'StDevP:') - ->setCellValue('A29', 'StDevPA:'); - -$objPHPExcel->getActiveSheet()->setCellValue('A31', 'DevSq:') - ->setCellValue('A32', 'Var:') - ->setCellValue('A33', 'VarA:') - ->setCellValue('A34', 'VarP:') - ->setCellValue('A35', 'VarPA:'); - -$objPHPExcel->getActiveSheet()->setCellValue('A37', 'Date:'); - - -$objPHPExcel->getActiveSheet()->setCellValue('B1', 'Range 1') - ->setCellValue('B2', 2) - ->setCellValue('B3', 8) - ->setCellValue('B4', 10) - ->setCellValue('B5', True) - ->setCellValue('B6', False) - ->setCellValue('B7', 'Text String') - ->setCellValue('B9', '22') - ->setCellValue('B10', 4) - ->setCellValue('B11', 6) - ->setCellValue('B12', 12); - -$objPHPExcel->getActiveSheet()->setCellValue('B14', '=COUNT(B2:B12)') - ->setCellValue('B15', '=SUM(B2:B12)') - ->setCellValue('B16', '=MAX(B2:B12)') - ->setCellValue('B17', '=MIN(B2:B12)') - ->setCellValue('B18', '=AVERAGE(B2:B12)') - ->setCellValue('B19', '=MEDIAN(B2:B12)') - ->setCellValue('B20', '=MODE(B2:B12)'); - -$objPHPExcel->getActiveSheet()->setCellValue('B22', '=COUNTA(B2:B12)') - ->setCellValue('B23', '=MAXA(B2:B12)') - ->setCellValue('B24', '=MINA(B2:B12)'); - -$objPHPExcel->getActiveSheet()->setCellValue('B26', '=STDEV(B2:B12)') - ->setCellValue('B27', '=STDEVA(B2:B12)') - ->setCellValue('B28', '=STDEVP(B2:B12)') - ->setCellValue('B29', '=STDEVPA(B2:B12)'); - -$objPHPExcel->getActiveSheet()->setCellValue('B31', '=DEVSQ(B2:B12)') - ->setCellValue('B32', '=VAR(B2:B12)') - ->setCellValue('B33', '=VARA(B2:B12)') - ->setCellValue('B34', '=VARP(B2:B12)') - ->setCellValue('B35', '=VARPA(B2:B12)'); - -$objPHPExcel->getActiveSheet()->setCellValue('B37', '=DATE(2007, 12, 21)') - ->setCellValue('B38', '=DATEDIF( DATE(2007, 12, 21), DATE(2007, 12, 22), "D" )') - ->setCellValue('B39', '=DATEVALUE("01-Feb-2006 10:06 AM")') - ->setCellValue('B40', '=DAY( DATE(2006, 1, 2) )') - ->setCellValue('B41', '=DAYS360( DATE(2002, 2, 3), DATE(2005, 5, 31) )'); - - -$objPHPExcel->getActiveSheet()->setCellValue('C1', 'Range 2') - ->setCellValue('C2', 1) - ->setCellValue('C3', 2) - ->setCellValue('C4', 2) - ->setCellValue('C5', 3) - ->setCellValue('C6', 3) - ->setCellValue('C7', 3) - ->setCellValue('C8', '0') - ->setCellValue('C9', 4) - ->setCellValue('C10', 4) - ->setCellValue('C11', 4) - ->setCellValue('C12', 4); - -$objPHPExcel->getActiveSheet()->setCellValue('C14', '=COUNT(C2:C12)') - ->setCellValue('C15', '=SUM(C2:C12)') - ->setCellValue('C16', '=MAX(C2:C12)') - ->setCellValue('C17', '=MIN(C2:C12)') - ->setCellValue('C18', '=AVERAGE(C2:C12)') - ->setCellValue('C19', '=MEDIAN(C2:C12)') - ->setCellValue('C20', '=MODE(C2:C12)'); - -$objPHPExcel->getActiveSheet()->setCellValue('C22', '=COUNTA(C2:C12)') - ->setCellValue('C23', '=MAXA(C2:C12)') - ->setCellValue('C24', '=MINA(C2:C12)'); - -$objPHPExcel->getActiveSheet()->setCellValue('C26', '=STDEV(C2:C12)') - ->setCellValue('C27', '=STDEVA(C2:C12)') - ->setCellValue('C28', '=STDEVP(C2:C12)') - ->setCellValue('C29', '=STDEVPA(C2:C12)'); - -$objPHPExcel->getActiveSheet()->setCellValue('C31', '=DEVSQ(C2:C12)') - ->setCellValue('C32', '=VAR(C2:C12)') - ->setCellValue('C33', '=VARA(C2:C12)') - ->setCellValue('C34', '=VARP(C2:C12)') - ->setCellValue('C35', '=VARPA(C2:C12)'); - - -$objPHPExcel->getActiveSheet()->setCellValue('D1', 'Range 3') - ->setCellValue('D2', 2) - ->setCellValue('D3', 3) - ->setCellValue('D4', 4); - -$objPHPExcel->getActiveSheet()->setCellValue('D14', '=((D2 * D3) + D4) & " should be 10"'); - -$objPHPExcel->getActiveSheet()->setCellValue('E12', 'Other functions') - ->setCellValue('E14', '=PI()') - ->setCellValue('E15', '=RAND()') - ->setCellValue('E16', '=RANDBETWEEN(5, 10)'); - -$objPHPExcel->getActiveSheet()->setCellValue('E17', 'Count of both ranges:') - ->setCellValue('F17', '=COUNT(B2:C12)'); - -$objPHPExcel->getActiveSheet()->setCellValue('E18', 'Total of both ranges:') - ->setCellValue('F18', '=SUM(B2:C12)'); - -$objPHPExcel->getActiveSheet()->setCellValue('E19', 'Maximum of both ranges:') - ->setCellValue('F19', '=MAX(B2:C12)'); - -$objPHPExcel->getActiveSheet()->setCellValue('E20', 'Minimum of both ranges:') - ->setCellValue('F20', '=MIN(B2:C12)'); - -$objPHPExcel->getActiveSheet()->setCellValue('E21', 'Average of both ranges:') - ->setCellValue('F21', '=AVERAGE(B2:C12)'); - -$objPHPExcel->getActiveSheet()->setCellValue('E22', 'Median of both ranges:') - ->setCellValue('F22', '=MEDIAN(B2:C12)'); - -$objPHPExcel->getActiveSheet()->setCellValue('E23', 'Mode of both ranges:') - ->setCellValue('F23', '=MODE(B2:C12)'); - - -// Calculated data -echo date('H:i:s') , " Calculated data" , EOL; -for ($col = 'B'; $col != 'G'; ++$col) { - for($row = 14; $row <= 41; ++$row) { - if ((!is_null($formula = $objPHPExcel->getActiveSheet()->getCell($col.$row)->getValue())) && - ($formula[0] == '=')) { - echo 'Value of ' , $col , $row , ' [' , $formula , ']: ' , - $objPHPExcel->getActiveSheet()->getCell($col.$row)->getCalculatedValue() . EOL; - } - } -} - - -// Save Excel 2007 file -echo date('H:i:s') , " Write to Excel2007 format" , EOL; -$callStartTime = microtime(true); - -$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007'); - -// -// If we set Pre Calculated Formulas to true then PHPExcel will calculate all formulae in the -// workbook before saving. This adds time and memory overhead, and can cause some problems with formulae -// using functions or features (such as array formulae) that aren't yet supported by the calculation engine -// If the value is false (the default) for the Excel2007 Writer, then MS Excel (or the application used to -// open the file) will need to recalculate values itself to guarantee that the correct results are available. -// -//$objWriter->setPreCalculateFormulas(true); -$objWriter->save(str_replace('.php', '.xlsx', __FILE__)); -$callEndTime = microtime(true); -$callTime = $callEndTime - $callStartTime; - -echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; -echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; -// Echo memory usage -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; - - -// Echo memory peak usage -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; - -// Echo done -echo date('H:i:s') , " Done writing file" , EOL; -echo 'File has been created in ' , getcwd() , EOL; diff --git a/Examples/13calculationCyclicFormulae.php b/Examples/13calculationCyclicFormulae.php deleted file mode 100644 index 33c24f22..00000000 --- a/Examples/13calculationCyclicFormulae.php +++ /dev/null @@ -1,97 +0,0 @@ -'); - -date_default_timezone_set('Europe/London'); - -/** Include PHPExcel */ -require_once dirname(__FILE__) . '/../src/Bootstrap.php'; - - -// Create new PHPExcel object -echo date('H:i:s') , " Create new PHPExcel object" , EOL; -$objPHPExcel = new \PHPExcel\Spreadsheet(); - -// Add some data, we will use some formulas here -echo date('H:i:s') , " Add some data and formulas" , EOL; -$objPHPExcel->getActiveSheet()->setCellValue('A1', '=B1') - ->setCellValue('A2', '=B2+1') - ->setCellValue('B1', '=A1+1') - ->setCellValue('B2', '=A2'); - -\PHPExcel\Calculation::getInstance($objPHPExcel)->cyclicFormulaCount = 100; - -// Calculated data -echo date('H:i:s') , " Calculated data" , EOL; -for($row = 1; $row <= 2; ++$row) { - for ($col = 'A'; $col != 'C'; ++$col) { - if ((!is_null($formula = $objPHPExcel->getActiveSheet()->getCell($col.$row)->getValue())) && - ($formula[0] == '=')) { - echo 'Value of ' , $col , $row , ' [' , $formula , ']: ' , - $objPHPExcel->getActiveSheet()->getCell($col.$row)->getCalculatedValue() . EOL; - } - } -} - - -// Save Excel 2007 file -echo date('H:i:s') , " Write to Excel2007 format" , EOL; -$callStartTime = microtime(true); - -$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007'); - -// -// If we set Pre Calculated Formulas to true then PHPExcel will calculate all formulae in the -// workbook before saving. This adds time and memory overhead, and can cause some problems with formulae -// using functions or features (such as array formulae) that aren't yet supported by the calculation engine -// If the value is false (the default) for the Excel2007 Writer, then MS Excel (or the application used to -// open the file) will need to recalculate values itself to guarantee that the correct results are available. -// -//$objWriter->setPreCalculateFormulas(true); -$objWriter->save(str_replace('.php', '.xlsx', __FILE__)); -$callEndTime = microtime(true); -$callTime = $callEndTime - $callStartTime; - -echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; -echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; -// Echo memory usage -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; - - -// Echo memory peak usage -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; - -// Echo done -echo date('H:i:s') , " Done writing file" , EOL; -echo 'File has been created in ' , getcwd() , EOL; diff --git a/Examples/14excel5.php b/Examples/14excel5.php deleted file mode 100644 index 99be07c9..00000000 --- a/Examples/14excel5.php +++ /dev/null @@ -1,63 +0,0 @@ -'); - -date_default_timezone_set('Europe/London'); - -include "05featuredemo.inc.php"; - -/** Include PHPExcel */ -require_once dirname(__FILE__) . '/../src/Bootstrap.php'; - - -// Save Excel 95 file -echo date('H:i:s') , " Write to Excel5 format" , EOL; -$callStartTime = microtime(true); - -$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel5'); -$objWriter->save(str_replace('.php', '.xls', __FILE__)); -$callEndTime = microtime(true); -$callTime = $callEndTime - $callStartTime; - -echo date('H:i:s') , " File written to " , str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; -echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; -// Echo memory usage -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; - - -// Echo memory peak usage -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; - -// Echo done -echo date('H:i:s') , " Done writing file" , EOL; -echo 'File has been created in ' , getcwd() , EOL; diff --git a/Examples/15datavalidation-xls.php b/Examples/15datavalidation-xls.php deleted file mode 100644 index f6b673b4..00000000 --- a/Examples/15datavalidation-xls.php +++ /dev/null @@ -1,142 +0,0 @@ -'); - -date_default_timezone_set('Europe/London'); - -/** Include PHPExcel */ -require_once dirname(__FILE__) . '/../src/Bootstrap.php'; - - -// Create new PHPExcel object -echo date('H:i:s') , " Create new PHPExcel object" , EOL; -$objPHPExcel = new \PHPExcel\Spreadsheet(); - - -// Set document properties -echo date('H:i:s') , " Set document properties" , EOL; -$objPHPExcel->getProperties()->setCreator("Maarten Balliauw") - ->setLastModifiedBy("Maarten Balliauw") - ->setTitle("Office 2007 XLSX Test Document") - ->setSubject("Office 2007 XLSX Test Document") - ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.") - ->setKeywords("office 2007 openxml php") - ->setCategory("Test result file"); - - -// Create a first sheet -echo date('H:i:s') , " Add data" , EOL; -$objPHPExcel->setActiveSheetIndex(0); -$objPHPExcel->getActiveSheet()->setCellValue('A1', "Cell B3 and B5 contain data validation...") - ->setCellValue('A3', "Number:") - ->setCellValue('B3', "10") - ->setCellValue('A5', "List:") - ->setCellValue('B5', "Item A") - ->setCellValue('A7', "List #2:") - ->setCellValue('B7', "Item #2") - ->setCellValue('D2', "Item #1") - ->setCellValue('D3', "Item #2") - ->setCellValue('D4', "Item #3") - ->setCellValue('D5', "Item #4") - ->setCellValue('D6', "Item #5") - ; - - -// Set data validation -echo date('H:i:s') , " Set data validation" , EOL; -$objValidation = $objPHPExcel->getActiveSheet()->getCell('B3')->getDataValidation(); -$objValidation->setType( \PHPExcel\Cell\DataValidation::TYPE_WHOLE ); -$objValidation->setErrorStyle( \PHPExcel\Cell\DataValidation::STYLE_STOP ); -$objValidation->setAllowBlank(true); -$objValidation->setShowInputMessage(true); -$objValidation->setShowErrorMessage(true); -$objValidation->setErrorTitle('Input error'); -$objValidation->setError('Only numbers between 10 and 20 are allowed!'); -$objValidation->setPromptTitle('Allowed input'); -$objValidation->setPrompt('Only numbers between 10 and 20 are allowed.'); -$objValidation->setFormula1(10); -$objValidation->setFormula2(20); - -$objValidation = $objPHPExcel->getActiveSheet()->getCell('B5')->getDataValidation(); -$objValidation->setType( \PHPExcel\Cell\DataValidation::TYPE_LIST ); -$objValidation->setErrorStyle( \PHPExcel\Cell\DataValidation::STYLE_INFORMATION ); -$objValidation->setAllowBlank(false); -$objValidation->setShowInputMessage(true); -$objValidation->setShowErrorMessage(true); -$objValidation->setShowDropDown(true); -$objValidation->setErrorTitle('Input error'); -$objValidation->setError('Value is not in list.'); -$objValidation->setPromptTitle('Pick from list'); -$objValidation->setPrompt('Please pick a value from the drop-down list.'); -$objValidation->setFormula1('"Item A,Item B,Item C"'); // Make sure to put the list items between " and " !!! - -$objValidation = $objPHPExcel->getActiveSheet()->getCell('B7')->getDataValidation(); -$objValidation->setType( \PHPExcel\Cell\DataValidation::TYPE_LIST ); -$objValidation->setErrorStyle( \PHPExcel\Cell\DataValidation::STYLE_INFORMATION ); -$objValidation->setAllowBlank(false); -$objValidation->setShowInputMessage(true); -$objValidation->setShowErrorMessage(true); -$objValidation->setShowDropDown(true); -$objValidation->setErrorTitle('Input error'); -$objValidation->setError('Value is not in list.'); -$objValidation->setPromptTitle('Pick from list'); -$objValidation->setPrompt('Please pick a value from the drop-down list.'); -$objValidation->setFormula1('$D$2:$D$6'); // Make sure NOT to put a range of cells or a formula between " and " !!! - - -// Set active sheet index to the first sheet, so Excel opens this as the first sheet -$objPHPExcel->setActiveSheetIndex(0); - - -// Save Excel 95 file -echo date('H:i:s') , " Write to Excel5 format" , EOL; -$callStartTime = microtime(true); - -$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel5'); -$objWriter->save(str_replace('.php', '.xls', __FILE__)); -$callEndTime = microtime(true); -$callTime = $callEndTime - $callStartTime; - -echo date('H:i:s') , " File written to " , str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; -echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; -// Echo memory usage -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; - - -// Echo memory peak usage -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; - -// Echo done -echo date('H:i:s') , " Done writing file" , EOL; -echo 'File has been created in ' , getcwd() , EOL; diff --git a/Examples/15datavalidation.php b/Examples/15datavalidation.php deleted file mode 100644 index 20fae42b..00000000 --- a/Examples/15datavalidation.php +++ /dev/null @@ -1,143 +0,0 @@ -'); - -date_default_timezone_set('Europe/London'); - -/** Include PHPExcel */ -require_once dirname(__FILE__) . '/../src/Bootstrap.php'; - - -// Create new PHPExcel object -echo date('H:i:s') , " Create new PHPExcel object" , EOL; -$objPHPExcel = new \PHPExcel\Spreadsheet(); - - -// Set document properties -echo date('H:i:s') , " Set document properties" , EOL; -$objPHPExcel->getProperties()->setCreator("Maarten Balliauw") - ->setLastModifiedBy("Maarten Balliauw") - ->setTitle("Office 2007 XLSX Test Document") - ->setSubject("Office 2007 XLSX Test Document") - ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.") - ->setKeywords("office 2007 openxml php") - ->setCategory("Test result file"); - - -// Create a first sheet -echo date('H:i:s') , " Add data" , EOL; -$objPHPExcel->setActiveSheetIndex(0); -$objPHPExcel->getActiveSheet()->setCellValue('A1', "Cell B3 and B5 contain data validation...") - ->setCellValue('A3', "Number:") - ->setCellValue('B3', "10") - ->setCellValue('A5', "List:") - ->setCellValue('B5', "Item A") - ->setCellValue('A7', "List #2:") - ->setCellValue('B7', "Item #2") - ->setCellValue('D2', "Item #1") - ->setCellValue('D3', "Item #2") - ->setCellValue('D4', "Item #3") - ->setCellValue('D5', "Item #4") - ->setCellValue('D6', "Item #5") - ; - - -// Set data validation -echo date('H:i:s') , " Set data validation" , EOL; -$objValidation = $objPHPExcel->getActiveSheet()->getCell('B3')->getDataValidation(); -$objValidation->setType( \PHPExcel\Cell\DataValidation::TYPE_WHOLE ); -$objValidation->setErrorStyle( \PHPExcel\Cell\DataValidation::STYLE_STOP ); -$objValidation->setAllowBlank(true); -$objValidation->setShowInputMessage(true); -$objValidation->setShowErrorMessage(true); -$objValidation->setErrorTitle('Input error'); -$objValidation->setError('Only numbers between 10 and 20 are allowed!'); -$objValidation->setPromptTitle('Allowed input'); -$objValidation->setPrompt('Only numbers between 10 and 20 are allowed.'); -$objValidation->setFormula1(10); -$objValidation->setFormula2(20); - -$objValidation = $objPHPExcel->getActiveSheet()->getCell('B5')->getDataValidation(); -$objValidation->setType( \PHPExcel\Cell\DataValidation::TYPE_LIST ); -$objValidation->setErrorStyle( \PHPExcel\Cell\DataValidation::STYLE_INFORMATION ); -$objValidation->setAllowBlank(false); -$objValidation->setShowInputMessage(true); -$objValidation->setShowErrorMessage(true); -$objValidation->setShowDropDown(true); -$objValidation->setErrorTitle('Input error'); -$objValidation->setError('Value is not in list.'); -$objValidation->setPromptTitle('Pick from list'); -$objValidation->setPrompt('Please pick a value from the drop-down list.'); -$objValidation->setFormula1('"Item A,Item B,Item C"'); // Make sure to put the list items between " and " if your list is simply a comma-separated list of values !!! - - -$objValidation = $objPHPExcel->getActiveSheet()->getCell('B7')->getDataValidation(); -$objValidation->setType( \PHPExcel\Cell\DataValidation::TYPE_LIST ); -$objValidation->setErrorStyle( \PHPExcel\Cell\DataValidation::STYLE_INFORMATION ); -$objValidation->setAllowBlank(false); -$objValidation->setShowInputMessage(true); -$objValidation->setShowErrorMessage(true); -$objValidation->setShowDropDown(true); -$objValidation->setErrorTitle('Input error'); -$objValidation->setError('Value is not in list.'); -$objValidation->setPromptTitle('Pick from list'); -$objValidation->setPrompt('Please pick a value from the drop-down list.'); -$objValidation->setFormula1('$D$2:$D$6'); // Make sure NOT to put a range of cells or a formula between " and " !!! - - -// Set active sheet index to the first sheet, so Excel opens this as the first sheet -$objPHPExcel->setActiveSheetIndex(0); - - -// Save Excel 2007 file -echo date('H:i:s') , " Write to Excel2007 format" , EOL; -$callStartTime = microtime(true); - -$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007'); -$objWriter->save(str_replace('.php', '.xlsx', __FILE__)); -$callEndTime = microtime(true); -$callTime = $callEndTime - $callStartTime; - -echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; -echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; -// Echo memory usage -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; - - -// Echo memory peak usage -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; - -// Echo done -echo date('H:i:s') , " Done writing file" , EOL; -echo 'File has been created in ' , getcwd() , EOL; diff --git a/Examples/16csv.php b/Examples/16csv.php deleted file mode 100644 index c8ba2902..00000000 --- a/Examples/16csv.php +++ /dev/null @@ -1,105 +0,0 @@ -'); - -date_default_timezone_set('Europe/London'); - -include "05featuredemo.inc.php"; - -/** Include PHPExcel */ -require_once dirname(__FILE__) . '/../src/Bootstrap.php'; - - -echo date('H:i:s') , " Write to CSV format" , EOL; -$callStartTime = microtime(true); - -$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'CSV')->setDelimiter(',') - ->setEnclosure('"') - ->setSheetIndex(0) - ->save(str_replace('.php', '.csv', __FILE__)); -$callEndTime = microtime(true); -$callTime = $callEndTime - $callStartTime; -echo date('H:i:s') , " File written to " , str_replace('.php', '.csv', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; -echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; -// Echo memory usage -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; - - -echo date('H:i:s') , " Read from CSV format" , EOL; -$callStartTime = microtime(true); -$objReader = \PHPExcel\IOFactory::createReader('CSV')->setDelimiter(',') - ->setEnclosure('"') - ->setSheetIndex(0); -$objPHPExcelFromCSV = $objReader->load(str_replace('.php', '.csv', __FILE__)); - -$callEndTime = microtime(true); -$callTime = $callEndTime - $callStartTime; -echo 'Call time to reload Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; -// Echo memory usage -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; - - -echo date('H:i:s') , " Write to Excel2007 format" , EOL; -$callStartTime = microtime(true); - -$objWriter2007 = \PHPExcel\IOFactory::createWriter($objPHPExcelFromCSV, 'Excel2007'); -$objWriter2007->save(str_replace('.php', '.xlsx', __FILE__)); -$callEndTime = microtime(true); -$callTime = $callEndTime - $callStartTime; -echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; -echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; -// Echo memory usage -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; - - -echo date('H:i:s') , " Write to CSV format" , EOL; -$callStartTime = microtime(true); - -$objWriterCSV = \PHPExcel\IOFactory::createWriter($objPHPExcelFromCSV, 'CSV'); -$objWriterCSV->setExcelCompatibility(true); -$objWriterCSV->save(str_replace('.php', '_excel.csv', __FILE__)); -$callEndTime = microtime(true); -$callTime = $callEndTime - $callStartTime; -echo date('H:i:s') , " File written to " , str_replace('.php', '_excel.csv', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; -echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; -// Echo memory usage -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; - - -// Echo memory peak usage -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; - -// Echo done -echo date('H:i:s') , " Done writing files" , EOL; -echo 'Files have been created in ' , getcwd() , EOL; diff --git a/Examples/17html.php b/Examples/17html.php deleted file mode 100644 index 7f48ce3b..00000000 --- a/Examples/17html.php +++ /dev/null @@ -1,64 +0,0 @@ -'); - -date_default_timezone_set('Europe/London'); - -include "05featuredemo.inc.php"; - -/** Include PHPExcel */ -require_once dirname(__FILE__) . '/../src/Bootstrap.php'; - - -echo date('H:i:s') , " Write to HTML format" , EOL; -$callStartTime = microtime(true); - -$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'HTML'); -$objWriter->setSheetIndex(0); -//$objWriter->setImagesRoot('http://www.example.com'); -$objWriter->save(str_replace('.php', '.htm', __FILE__)); -$callEndTime = microtime(true); -$callTime = $callEndTime - $callStartTime; -echo date('H:i:s') , " File written to " , str_replace('.php', '.htm', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; -echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; -// Echo memory usage -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; - - -// Echo memory peak usage -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; - -// Echo done -echo date('H:i:s') , " Done writing file" , EOL; -echo 'File has been created in ' , getcwd() , EOL; diff --git a/Examples/18extendedcalculation.php b/Examples/18extendedcalculation.php deleted file mode 100644 index 202c43e4..00000000 --- a/Examples/18extendedcalculation.php +++ /dev/null @@ -1,108 +0,0 @@ -'); - -date_default_timezone_set('Europe/London'); - -/** PHPExcel */ -require_once dirname(__FILE__) . '/../src/Bootstrap.php'; - - -// List functions -echo date('H:i:s') . " List implemented functions\n"; -$objCalc = \PHPExcel\Calculation::getInstance(); -print_r($objCalc->listFunctionNames()); - -// Create new PHPExcel object -echo date('H:i:s') . " Create new PHPExcel object\n"; -$objPHPExcel = new \PHPExcel\Spreadsheet(); - -// Add some data, we will use some formulas here -echo date('H:i:s') . " Add some data\n"; -$objPHPExcel->getActiveSheet()->setCellValue('A14', 'Count:'); - -$objPHPExcel->getActiveSheet()->setCellValue('B1', 'Range 1'); -$objPHPExcel->getActiveSheet()->setCellValue('B2', 2); -$objPHPExcel->getActiveSheet()->setCellValue('B3', 8); -$objPHPExcel->getActiveSheet()->setCellValue('B4', 10); -$objPHPExcel->getActiveSheet()->setCellValue('B5', True); -$objPHPExcel->getActiveSheet()->setCellValue('B6', False); -$objPHPExcel->getActiveSheet()->setCellValue('B7', 'Text String'); -$objPHPExcel->getActiveSheet()->setCellValue('B9', '22'); -$objPHPExcel->getActiveSheet()->setCellValue('B10', 4); -$objPHPExcel->getActiveSheet()->setCellValue('B11', 6); -$objPHPExcel->getActiveSheet()->setCellValue('B12', 12); - -$objPHPExcel->getActiveSheet()->setCellValue('B14', '=COUNT(B2:B12)'); - -$objPHPExcel->getActiveSheet()->setCellValue('C1', 'Range 2'); -$objPHPExcel->getActiveSheet()->setCellValue('C2', 1); -$objPHPExcel->getActiveSheet()->setCellValue('C3', 2); -$objPHPExcel->getActiveSheet()->setCellValue('C4', 2); -$objPHPExcel->getActiveSheet()->setCellValue('C5', 3); -$objPHPExcel->getActiveSheet()->setCellValue('C6', 3); -$objPHPExcel->getActiveSheet()->setCellValue('C7', 3); -$objPHPExcel->getActiveSheet()->setCellValue('C8', '0'); -$objPHPExcel->getActiveSheet()->setCellValue('C9', 4); -$objPHPExcel->getActiveSheet()->setCellValue('C10', 4); -$objPHPExcel->getActiveSheet()->setCellValue('C11', 4); -$objPHPExcel->getActiveSheet()->setCellValue('C12', 4); - -$objPHPExcel->getActiveSheet()->setCellValue('C14', '=COUNT(C2:C12)'); - -$objPHPExcel->getActiveSheet()->setCellValue('D1', 'Range 3'); -$objPHPExcel->getActiveSheet()->setCellValue('D2', 2); -$objPHPExcel->getActiveSheet()->setCellValue('D3', 3); -$objPHPExcel->getActiveSheet()->setCellValue('D4', 4); - -$objPHPExcel->getActiveSheet()->setCellValue('D5', '=((D2 * D3) + D4) & " should be 10"'); - -$objPHPExcel->getActiveSheet()->setCellValue('E1', 'Other functions'); -$objPHPExcel->getActiveSheet()->setCellValue('E2', '=PI()'); -$objPHPExcel->getActiveSheet()->setCellValue('E3', '=RAND()'); -$objPHPExcel->getActiveSheet()->setCellValue('E4', '=RANDBETWEEN(5, 10)'); - -$objPHPExcel->getActiveSheet()->setCellValue('E14', 'Count of both ranges:'); -$objPHPExcel->getActiveSheet()->setCellValue('F14', '=COUNT(B2:C12)'); - -// Calculated data -echo date('H:i:s') . " Calculated data\n"; -echo 'Value of B14 [=COUNT(B2:B12)]: ' . $objPHPExcel->getActiveSheet()->getCell('B14')->getCalculatedValue() . "\r\n"; - - -// Echo memory peak usage -echo date('H:i:s') . " Peak memory usage: " . (memory_get_peak_usage(true) / 1024 / 1024) . " MB\r\n"; - -// Echo done -echo date('H:i:s') . " Done" , EOL; diff --git a/Examples/19namedrange.php b/Examples/19namedrange.php deleted file mode 100644 index 79c53d60..00000000 --- a/Examples/19namedrange.php +++ /dev/null @@ -1,129 +0,0 @@ -'); - -date_default_timezone_set('Europe/London'); - -/** Include PHPExcel */ -require_once dirname(__FILE__) . '/../src/Bootstrap.php'; - - -// Create new PHPExcel object -echo date('H:i:s') , " Create new PHPExcel object" , EOL; -$objPHPExcel = new \PHPExcel\Spreadsheet(); - -// Set document properties -echo date('H:i:s') , " Set document properties" , EOL; -$objPHPExcel->getProperties()->setCreator("Maarten Balliauw") - ->setLastModifiedBy("Maarten Balliauw") - ->setTitle("Office 2007 XLSX Test Document") - ->setSubject("Office 2007 XLSX Test Document") - ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.") - ->setKeywords("office 2007 openxml php") - ->setCategory("Test result file"); - - -// Add some data -echo date('H:i:s') , " Add some data" , EOL; -$objPHPExcel->setActiveSheetIndex(0); -$objPHPExcel->getActiveSheet()->setCellValue('A1', 'Firstname:') - ->setCellValue('A2', 'Lastname:') - ->setCellValue('A3', 'Fullname:') - ->setCellValue('B1', 'Maarten') - ->setCellValue('B2', 'Balliauw') - ->setCellValue('B3', '=B1 & " " & B2'); - -// Define named ranges -echo date('H:i:s') , " Define named ranges" , EOL; -$objPHPExcel->addNamedRange( new \PHPExcel\NamedRange('PersonName', $objPHPExcel->getActiveSheet(), 'B1') ); -$objPHPExcel->addNamedRange( new \PHPExcel\NamedRange('PersonLN', $objPHPExcel->getActiveSheet(), 'B2') ); - -// Rename named ranges -echo date('H:i:s') , " Rename named ranges" , EOL; -$objPHPExcel->getNamedRange('PersonName')->setName('PersonFN'); - -// Rename worksheet -echo date('H:i:s') , " Rename worksheet" , EOL; -$objPHPExcel->getActiveSheet()->setTitle('Person'); - - -// Create a new worksheet, after the default sheet -echo date('H:i:s') , " Create new Worksheet object" , EOL; -$objPHPExcel->createSheet(); - -// Add some data to the second sheet, resembling some different data types -echo date('H:i:s') , " Add some data" , EOL; -$objPHPExcel->setActiveSheetIndex(1); -$objPHPExcel->getActiveSheet()->setCellValue('A1', 'Firstname:') - ->setCellValue('A2', 'Lastname:') - ->setCellValue('A3', 'Fullname:') - ->setCellValue('B1', '=PersonFN') - ->setCellValue('B2', '=PersonLN') - ->setCellValue('B3', '=PersonFN & " " & PersonLN'); - -// Resolve range -echo date('H:i:s') , " Resolve range" , EOL; -echo 'Cell B1 {=PersonFN}: ' , $objPHPExcel->getActiveSheet()->getCell('B1')->getCalculatedValue() , EOL; -echo 'Cell B3 {=PersonFN & " " & PersonLN}: ' , $objPHPExcel->getActiveSheet()->getCell('B3')->getCalculatedValue() , EOL; -echo 'Cell Person!B1: ' , $objPHPExcel->getActiveSheet()->getCell('Person!B1')->getCalculatedValue() , EOL; - -// Rename worksheet -echo date('H:i:s') , " Rename worksheet" , EOL; -$objPHPExcel->getActiveSheet()->setTitle('Person (cloned)'); - -// Set active sheet index to the first sheet, so Excel opens this as the first sheet -$objPHPExcel->setActiveSheetIndex(0); - - -// Save Excel 2007 file -echo date('H:i:s') , " Write to Excel2007 format" , EOL; -$callStartTime = microtime(true); - -$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007'); -$objWriter->save(str_replace('.php', '.xlsx', __FILE__)); -$callEndTime = microtime(true); -$callTime = $callEndTime - $callStartTime; - -echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; -echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; -// Echo memory usage -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; - - -// Echo memory peak usage -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; - -// Echo done -echo date('H:i:s') , " Done writing file" , EOL; -echo 'File has been created in ' , getcwd() , EOL; diff --git a/Examples/20readexcel5.php b/Examples/20readexcel5.php deleted file mode 100644 index d276f429..00000000 --- a/Examples/20readexcel5.php +++ /dev/null @@ -1,79 +0,0 @@ -'); - -date_default_timezone_set('Europe/London'); - -/** Include PHPExcel */ -require_once dirname(__FILE__) . '/../src/Bootstrap.php'; - - -if (!file_exists("14excel5.xls")) { - exit("Please run 14excel5.php first.\n"); -} - -echo date('H:i:s') , " Load workbook from Excel5 file" , EOL; -$callStartTime = microtime(true); - -$objPHPExcel = \PHPExcel\IOFactory::load("14excel5.xls"); - -$callEndTime = microtime(true); -$callTime = $callEndTime - $callStartTime; - -echo 'Call time to load Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; -// Echo memory usage -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; - - -// Save Excel 2007 file -echo date('H:i:s') , " Write to Excel2007 format" , EOL; -$callStartTime = microtime(true); - -$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007'); -$objWriter->save(str_replace('.php', '.xlsx', __FILE__)); -$callEndTime = microtime(true); -$callTime = $callEndTime - $callStartTime; - -echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; -echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; -// Echo memory usage -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; - - -// Echo memory peak usage -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; - -// Echo done -echo date('H:i:s') , " Done reading file" , EOL; -echo 'File has been created in ' , getcwd() , EOL; diff --git a/Examples/21pdf.php b/Examples/21pdf.php deleted file mode 100644 index 62bb6e27..00000000 --- a/Examples/21pdf.php +++ /dev/null @@ -1,94 +0,0 @@ -'); - -date_default_timezone_set('Europe/London'); - -include "05featuredemo.inc.php"; - -/** Include PHPExcel */ -require_once dirname(__FILE__) . '/../src/Bootstrap.php'; - - -// Change these values to select the Rendering library that you wish to use -// and its directory location on your server -//$rendererName = \PHPExcel\Settings::PDF_RENDERER_TCPDF; -//$rendererName = \PHPExcel\Settings::PDF_RENDERER_MPDF; -$rendererName = \PHPExcel\Settings::PDF_RENDERER_DOMPDF; -//$rendererLibrary = 'tcPDF5.9'; -//$rendererLibrary = 'mPDF5.4'; -$rendererLibrary = 'domPDF0.6.0beta3'; -$rendererLibraryPath = '/php/libraries/PDF/' . $rendererLibrary; - - -echo date('H:i:s') , " Hide grid lines" , EOL; -$objPHPExcel->getActiveSheet()->setShowGridLines(false); - -echo date('H:i:s') , " Set orientation to landscape" , EOL; -$objPHPExcel->getActiveSheet()->getPageSetup()->setOrientation(\PHPExcel\Worksheet\PageSetup::ORIENTATION_LANDSCAPE); - - -echo date('H:i:s') , " Write to PDF format using {$rendererName}" , EOL; - -if (!\PHPExcel\Settings::setPdfRenderer( - $rendererName, - $rendererLibraryPath - )) { - die( - 'NOTICE: Please set the $rendererName and $rendererLibraryPath values' . - EOL . - 'at the top of this script as appropriate for your directory structure' - ); -} - - -$callStartTime = microtime(true); - -$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'PDF'); -$objWriter->setSheetIndex(0); -$objWriter->save(str_replace('.php', '_'.$rendererName.'.pdf', __FILE__)); -$callEndTime = microtime(true); -$callTime = $callEndTime - $callStartTime; -echo date('H:i:s') , " File written to " , str_replace('.php', '_'.$rendererName.'.pdf', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; -echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; -// Echo memory usage -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; - - -// Echo memory peak usage -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; - -// Echo done -echo date('H:i:s') , " Done writing files" , EOL; -echo 'File has been created in ' , getcwd() , EOL; diff --git a/Examples/22heavilyformatted.php b/Examples/22heavilyformatted.php deleted file mode 100644 index 4ac83823..00000000 --- a/Examples/22heavilyformatted.php +++ /dev/null @@ -1,116 +0,0 @@ -'); - -date_default_timezone_set('Europe/London'); - -/** Include PHPExcel */ -require_once dirname(__FILE__) . '/../src/Bootstrap.php'; - - -// Create new PHPExcel object -echo date('H:i:s') , " Create new PHPExcel object" , EOL; -$objPHPExcel = new \PHPExcel\Spreadsheet(); - -// Set document properties -echo date('H:i:s') , " Set document properties" , EOL; -$objPHPExcel->getProperties()->setCreator("Maarten Balliauw") - ->setLastModifiedBy("Maarten Balliauw") - ->setTitle("Office 2007 XLSX Test Document") - ->setSubject("Office 2007 XLSX Test Document") - ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.") - ->setKeywords("office 2007 openxml php") - ->setCategory("Test result file"); - - -// Add some data -echo date('H:i:s') , " Add some data" , EOL; -$objPHPExcel->setActiveSheetIndex(0); - -$objPHPExcel->getActiveSheet()->getStyle('A1:T100')->applyFromArray( - array('fill' => array( - 'type' => \PHPExcel\Style\Fill::FILL_SOLID, - 'color' => array('argb' => 'FFCCFFCC') - ), - 'borders' => array( - 'bottom' => array('style' => \PHPExcel\Style\Border::BORDER_THIN), - 'right' => array('style' => \PHPExcel\Style\Border::BORDER_MEDIUM) - ) - ) - ); - -$objPHPExcel->getActiveSheet()->getStyle('C5:R95')->applyFromArray( - array('fill' => array( - 'type' => \PHPExcel\Style\Fill::FILL_SOLID, - 'color' => array('argb' => 'FFFFFF00') - ), - ) - ); - -// Save Excel 2007 file -echo date('H:i:s') , " Write to Excel2007 format" , EOL; -$callStartTime = microtime(true); - -$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007'); -$objWriter->save(str_replace('.php', '.xlsx', __FILE__)); -$callEndTime = microtime(true); -$callTime = $callEndTime - $callStartTime; - -echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; -echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; -// Echo memory usage -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; - - -// Save Excel 95 file -echo date('H:i:s') , " Write to Excel5 format" , EOL; -$callStartTime = microtime(true); - -$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel5'); -$objWriter->save(str_replace('.php', '.xls', __FILE__)); -$callEndTime = microtime(true); -$callTime = $callEndTime - $callStartTime; - -echo date('H:i:s') , " File written to " , str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; -echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; -// Echo memory usage -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; - - -// Echo memory peak usage -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; - -// Echo done -echo date('H:i:s') , " Done writing file" , EOL; -echo 'File has been created in ' , getcwd() , EOL; diff --git a/Examples/23sharedstyles.php b/Examples/23sharedstyles.php deleted file mode 100644 index 20fc8830..00000000 --- a/Examples/23sharedstyles.php +++ /dev/null @@ -1,124 +0,0 @@ -'); - -date_default_timezone_set('Europe/London'); - -/** Include PHPExcel */ -require_once dirname(__FILE__) . '/../src/Bootstrap.php'; - - -// Create new PHPExcel object -echo date('H:i:s') , " Create new PHPExcel object" , EOL; -$objPHPExcel = new \PHPExcel\Spreadsheet(); - -// Set document properties -echo date('H:i:s') , " Set document properties" , EOL; -$objPHPExcel->getProperties()->setCreator("Maarten Balliauw") - ->setLastModifiedBy("Maarten Balliauw") - ->setTitle("Office 2007 XLSX Test Document") - ->setSubject("Office 2007 XLSX Test Document") - ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.") - ->setKeywords("office 2007 openxml php") - ->setCategory("Test result file"); - - -// Add some data -echo date('H:i:s') , " Add some data" , EOL; -$objPHPExcel->setActiveSheetIndex(0); - -$sharedStyle1 = new \PHPExcel\Style(); -$sharedStyle2 = new \PHPExcel\Style(); - -$sharedStyle1->applyFromArray( - array('fill' => array( - 'type' => \PHPExcel\Style\Fill::FILL_SOLID, - 'color' => array('argb' => 'FFCCFFCC') - ), - 'borders' => array( - 'bottom' => array('style' => \PHPExcel\Style\Border::BORDER_THIN), - 'right' => array('style' => \PHPExcel\Style\Border::BORDER_MEDIUM) - ) - )); - -$sharedStyle2->applyFromArray( - array('fill' => array( - 'type' => \PHPExcel\Style\Fill::FILL_SOLID, - 'color' => array('argb' => 'FFFFFF00') - ), - 'borders' => array( - 'bottom' => array('style' => \PHPExcel\Style\Border::BORDER_THIN), - 'right' => array('style' => \PHPExcel\Style\Border::BORDER_MEDIUM) - ) - )); - -$objPHPExcel->getActiveSheet()->duplicateStyle($sharedStyle1, "A1:T100"); -$objPHPExcel->getActiveSheet()->duplicateStyle($sharedStyle2, "C5:R95"); - -// Save Excel 2007 file -echo date('H:i:s') , " Write to Excel2007 format" , EOL; -$callStartTime = microtime(true); - -$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007'); -$objWriter->save(str_replace('.php', '.xlsx', __FILE__)); -$callEndTime = microtime(true); -$callTime = $callEndTime - $callStartTime; - -echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; -echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; -// Echo memory usage -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; - - -// Save Excel 95 file -echo date('H:i:s') , " Write to Excel5 format" , EOL; -$callStartTime = microtime(true); - -$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel5'); -$objWriter->save(str_replace('.php', '.xls', __FILE__)); -$callEndTime = microtime(true); -$callTime = $callEndTime - $callStartTime; - -echo date('H:i:s') , " File written to " , str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; -echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; -// Echo memory usage -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; - - -// Echo memory peak usage -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; - -// Echo done -echo date('H:i:s') , " Done writing file" , EOL; -echo 'File has been created in ' , getcwd() , EOL; diff --git a/Examples/24readfilter.php b/Examples/24readfilter.php deleted file mode 100644 index 39c077cb..00000000 --- a/Examples/24readfilter.php +++ /dev/null @@ -1,77 +0,0 @@ -'); - -date_default_timezone_set('Europe/London'); - -/** Include PHPExcel */ -require_once dirname(__FILE__) . '/../src/Bootstrap.php'; - - -// Check prerequisites -if (!file_exists("06largescale.xlsx")) { - exit("Please run 06largescale.php first.\n"); -} - -class MyReadFilter implements \PHPExcel\Reader\IReadFilter -{ - public function readCell($column, $row, $worksheetName = '') { - // Read title row and rows 20 - 30 - if ($row == 1 || ($row >= 20 && $row <= 30)) { - return true; - } - - return false; - } -} - - -echo date('H:i:s') , " Load from Excel2007 file" , EOL; -$objReader = \PHPExcel\IOFactory::createReader('Excel2007'); -$objReader->setReadFilter( new MyReadFilter() ); -$objPHPExcel = $objReader->load("06largescale.xlsx"); - -echo date('H:i:s') , " Remove unnecessary rows" , EOL; -$objPHPExcel->getActiveSheet()->removeRow(2, 18); - -echo date('H:i:s') , " Write to Excel2007 format" , EOL; -$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007'); -$objWriter->save(str_replace('.php', '.xlsx', __FILE__)); -echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; - - -// Echo memory peak usage -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; - -// Echo done -echo date('H:i:s') , " Done writing file" , EOL; -echo 'File has been created in ' , getcwd() , EOL; diff --git a/Examples/25inmemoryimage.php b/Examples/25inmemoryimage.php deleted file mode 100644 index 54c84899..00000000 --- a/Examples/25inmemoryimage.php +++ /dev/null @@ -1,89 +0,0 @@ -'); - -date_default_timezone_set('Europe/London'); - -/** Include PHPExcel */ -require_once dirname(__FILE__) . '/../src/Bootstrap.php'; - - -// Create new PHPExcel object -echo date('H:i:s') , " Create new PHPExcel object" , EOL; -$objPHPExcel = new \PHPExcel\Spreadsheet(); - -// Set document properties -echo date('H:i:s') , " Set document properties" , EOL; -$objPHPExcel->getProperties()->setCreator("Maarten Balliauw") - ->setLastModifiedBy("Maarten Balliauw") - ->setTitle("Office 2007 XLSX Test Document") - ->setSubject("Office 2007 XLSX Test Document") - ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.") - ->setKeywords("office 2007 openxml php") - ->setCategory("Test result file"); - -// Generate an image -echo date('H:i:s') , " Generate an image" , EOL; -$gdImage = @imagecreatetruecolor(120, 20) or die('Cannot Initialize new GD image stream'); -$textColor = imagecolorallocate($gdImage, 255, 255, 255); -imagestring($gdImage, 1, 5, 5, 'Created with PHPExcel', $textColor); - -// Add a drawing to the worksheet -echo date('H:i:s') , " Add a drawing to the worksheet" , EOL; -$objDrawing = new \PHPExcel\Worksheet\MemoryDrawing(); -$objDrawing->setName('Sample image'); -$objDrawing->setDescription('Sample image'); -$objDrawing->setImageResource($gdImage); -$objDrawing->setRenderingFunction(\PHPExcel\Worksheet\MemoryDrawing::RENDERING_JPEG); -$objDrawing->setMimeType(\PHPExcel\Worksheet\MemoryDrawing::MIMETYPE_DEFAULT); -$objDrawing->setHeight(36); -$objDrawing->setWorksheet($objPHPExcel->getActiveSheet()); - -echo date('H:i:s') , " Write to Excel2007 format" , EOL; -$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007'); -$objWriter->save(str_replace('.php', '.xlsx', __FILE__)); -echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; - - -echo date('H:i:s') , " Write to HTML format" , EOL; -$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'HTML'); -$objWriter->save(str_replace('.php', '.html', __FILE__)); -echo date('H:i:s') , " File written to " , str_replace('.php', '.html', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; - - -// Echo memory peak usage -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; - -// Echo done -echo date('H:i:s') , " Done writing file" , EOL; -echo 'Files have been created in ' , getcwd() , EOL; diff --git a/Examples/26utf8.php b/Examples/26utf8.php deleted file mode 100644 index ccda5bff..00000000 --- a/Examples/26utf8.php +++ /dev/null @@ -1,122 +0,0 @@ -'); - -date_default_timezone_set('Europe/London'); - -/** Include PHPExcel */ -require_once dirname(__FILE__) . '/../src/Bootstrap.php'; - - -// Change these values to select the PDF Rendering library that you wish to use -// and its directory location on your server -//$rendererName = \PHPExcel\Settings::PDF_RENDERER_TCPDF; -//$rendererName = \PHPExcel\Settings::PDF_RENDERER_MPDF; -$rendererName = \PHPExcel\Settings::PDF_RENDERER_DOMPDF; -//$rendererLibrary = 'tcPDF5.9'; -//$rendererLibrary = 'mPDF5.4'; -$rendererLibrary = 'domPDF0.6.0beta3'; -$rendererLibraryPath = '/php/libraries/PDF/' . $rendererLibrary; - - -// Read from Excel2007 (.xlsx) template -echo date('H:i:s') , " Load Excel2007 template file" , EOL; -$objReader = \PHPExcel\IOFactory::createReader('Excel2007'); -$objPHPExcel = $objReader->load("templates/26template.xlsx"); - -/** at this point, we could do some manipulations with the template, but we skip this step */ - -// Export to Excel2007 (.xlsx) -echo date('H:i:s') , " Write to Excel5 format" , EOL; -$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007'); -$objWriter->save(str_replace('.php', '.xlsx', __FILE__)); -echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; - -// Export to Excel5 (.xls) -echo date('H:i:s') , " Write to Excel5 format" , EOL; -$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel5'); -$objWriter->save(str_replace('.php', '.xls', __FILE__)); -echo date('H:i:s') , " File written to " , str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; - -// Export to HTML (.html) -echo date('H:i:s') , " Write to HTML format" , EOL; -$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'HTML'); -$objWriter->save(str_replace('.php', '.htm', __FILE__)); -echo date('H:i:s') , " File written to " , str_replace('.php', '.htm', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; - -// Export to PDF (.pdf) -echo date('H:i:s') , " Write to PDF format" , EOL; -try { - if (!\PHPExcel\Settings::setPdfRenderer( - $rendererName, - $rendererLibraryPath - )) { - echo ( - 'NOTICE: Please set the $rendererName and $rendererLibraryPath values' . - EOL . - 'at the top of this script as appropriate for your directory structure' . - EOL - ); - } else { - $objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'PDF'); - $objWriter->save(str_replace('.php', '.pdf', __FILE__)); - echo date('H:i:s') , " File written to " , str_replace('.php', '.pdf', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; - } -} catch (Exception $e) { - echo date('H:i:s') , ' EXCEPTION: ', $e->getMessage() , EOL; -} - -// Remove first two rows with field headers before exporting to CSV -echo date('H:i:s') , " Removing first two heading rows for CSV export" , EOL; -$objWorksheet = $objPHPExcel->getActiveSheet(); -$objWorksheet->removeRow(1, 2); - -// Export to CSV (.csv) -echo date('H:i:s') , " Write to CSV format" , EOL; -$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'CSV'); -$objWriter->save(str_replace('.php', '.csv', __FILE__)); -echo date('H:i:s') , " File written to " , str_replace('.php', '.csv', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; - -// Export to CSV with BOM (.csv) -echo date('H:i:s') , " Write to CSV format (with BOM)" , EOL; -$objWriter->setUseBOM(true); -$objWriter->save(str_replace('.php', '-bom.csv', __FILE__)); -echo date('H:i:s') , " File written to " , str_replace('.php', '-bom.csv', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; - - -// Echo memory peak usage -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; - -// Echo done -echo date('H:i:s') , " Done writing files" , EOL; -echo 'Files have been created in ' , getcwd() , EOL; diff --git a/Examples/27imagesexcel5.php b/Examples/27imagesexcel5.php deleted file mode 100644 index d4ce0cb9..00000000 --- a/Examples/27imagesexcel5.php +++ /dev/null @@ -1,64 +0,0 @@ -'); - -date_default_timezone_set('Europe/London'); - -/** Include PHPExcel */ -require_once dirname(__FILE__) . '/../src/Bootstrap.php'; - - -// Read from Excel5 (.xls) template -echo date('H:i:s') , " Load Excel2007 template file" , EOL; -$objReader = \PHPExcel\IOFactory::createReader('Excel5'); -$objPHPExcel = $objReader->load("templates/27template.xls"); - -// Export to Excel2007 (.xlsx) -echo date('H:i:s') , " Write to Excel5 format" , EOL; -$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007'); -$objWriter->save(str_replace('.php', '.xlsx', __FILE__)); -echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; - -// Export to Excel5 (.xls) -echo date('H:i:s') , " Write to Excel5 format" , EOL; -$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel5'); -$objWriter->save(str_replace('.php', '.xls', __FILE__)); -echo date('H:i:s') , " File written to " , str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; - - -// Echo memory peak usage -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; - -// Echo done -echo date('H:i:s') , " Done writing files" , EOL; -echo 'Files have been created in ' , getcwd() , EOL; diff --git a/Examples/28iterator.php b/Examples/28iterator.php deleted file mode 100644 index c0a26823..00000000 --- a/Examples/28iterator.php +++ /dev/null @@ -1,67 +0,0 @@ -'); - -date_default_timezone_set('Europe/London'); - -/** Include PHPExcel */ -require_once dirname(__FILE__) . '/../src/Bootstrap.php'; - -if (!file_exists("05featuredemo.xlsx")) { - exit("Please run 05featuredemo.php first." . EOL); -} - -echo date('H:i:s') , " Load from Excel2007 file" , EOL; -$objReader = \PHPExcel\IOFactory::createReader('Excel2007'); -$objPHPExcel = $objReader->load("05featuredemo.xlsx"); - -echo date('H:i:s') , " Iterate worksheets" , EOL; -foreach ($objPHPExcel->getWorksheetIterator() as $worksheet) { - echo 'Worksheet - ' , $worksheet->getTitle() , EOL; - - foreach ($worksheet->getRowIterator() as $row) { - echo ' Row number - ' , $row->getRowIndex() , EOL; - - $cellIterator = $row->getCellIterator(); - $cellIterator->setIterateOnlyExistingCells(false); // Loop all cells, even if it is not set - foreach ($cellIterator as $cell) { - if (!is_null($cell)) { - echo ' Cell - ' , $cell->getCoordinate() , ' - ' , $cell->getCalculatedValue() , EOL; - } - } - } -} - - -// Echo memory peak usage -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; diff --git a/Examples/29advancedvaluebinder.php b/Examples/29advancedvaluebinder.php deleted file mode 100644 index 69b66ff5..00000000 --- a/Examples/29advancedvaluebinder.php +++ /dev/null @@ -1,183 +0,0 @@ -'); - -/** PHPExcel */ -require_once dirname(__FILE__) . '/../src/Bootstrap.php'; - - -// Set timezone -echo date('H:i:s') , " Set timezone" , EOL; -date_default_timezone_set('UTC'); - -// Set value binder -echo date('H:i:s') , " Set value binder" , EOL; -\PHPExcel\Cell::setValueBinder( new \PHPExcel\Cell\AdvancedValueBinder() ); - -// Create new PHPExcel object -echo date('H:i:s') , " Create new PHPExcel object" , EOL; -$objPHPExcel = new \PHPExcel\Spreadsheet(); - -// Set document properties -echo date('H:i:s') , " Set document properties" , EOL; -$objPHPExcel->getProperties()->setCreator("Maarten Balliauw") - ->setLastModifiedBy("Maarten Balliauw") - ->setTitle("Office 2007 XLSX Test Document") - ->setSubject("Office 2007 XLSX Test Document") - ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.") - ->setKeywords("office 2007 openxml php") - ->setCategory("Test result file"); - -// Set default font -echo date('H:i:s') , " Set default font" , EOL; -$objPHPExcel->getActiveSheet()->getDefaultStyle()->getFont()->setName('Arial'); -$objPHPExcel->getActiveSheet()->getDefaultStyle()->getFont()->setSize(10); - -// Set column widths -echo date('H:i:s') , " Set column widths" , EOL; -$objPHPExcel->getActiveSheet()->getColumnDimension('A')->setAutoSize(true); -$objPHPExcel->getActiveSheet()->getColumnDimension('B')->setWidth(14); - -// Add some data, resembling some different data types -echo date('H:i:s') , " Add some data" , EOL; -$objPHPExcel->getActiveSheet()->setCellValue('A1', 'String value:') - ->setCellValue('B1', 'Mark Baker'); - -$objPHPExcel->getActiveSheet()->setCellValue('A2', 'Numeric value #1:') - ->setCellValue('B2', 12345); - -$objPHPExcel->getActiveSheet()->setCellValue('A3', 'Numeric value #2:') - ->setCellValue('B3', -12.345); - -$objPHPExcel->getActiveSheet()->setCellValue('A4', 'Numeric value #3:') - ->setCellValue('B4', .12345); - -$objPHPExcel->getActiveSheet()->setCellValue('A5', 'Numeric value #4:') - ->setCellValue('B5', '12345'); - -$objPHPExcel->getActiveSheet()->setCellValue('A6', 'Numeric value #5:') - ->setCellValue('B6', '1.2345'); - -$objPHPExcel->getActiveSheet()->setCellValue('A7', 'Numeric value #6:') - ->setCellValue('B7', '.12345'); - -$objPHPExcel->getActiveSheet()->setCellValue('A8', 'Numeric value #7:') - ->setCellValue('B8', '1.234e-5'); - -$objPHPExcel->getActiveSheet()->setCellValue('A9', 'Numeric value #8:') - ->setCellValue('B9', '-1.234e+5'); - -$objPHPExcel->getActiveSheet()->setCellValue('A10', 'Boolean value:') - ->setCellValue('B10', 'TRUE'); - -$objPHPExcel->getActiveSheet()->setCellValue('A11', 'Percentage value #1:') - ->setCellValue('B11', '10%'); - -$objPHPExcel->getActiveSheet()->setCellValue('A12', 'Percentage value #2:') - ->setCellValue('B12', '12.5%'); - -$objPHPExcel->getActiveSheet()->setCellValue('A13', 'Fraction value #1:') - ->setCellValue('B13', '-1/2'); - -$objPHPExcel->getActiveSheet()->setCellValue('A14', 'Fraction value #2:') - ->setCellValue('B14', '3 1/2'); - -$objPHPExcel->getActiveSheet()->setCellValue('A15', 'Fraction value #3:') - ->setCellValue('B15', '-12 3/4'); - -$objPHPExcel->getActiveSheet()->setCellValue('A16', 'Fraction value #4:') - ->setCellValue('B16', '13/4'); - -$objPHPExcel->getActiveSheet()->setCellValue('A17', 'Currency value #1:') - ->setCellValue('B17', '$12345'); - -$objPHPExcel->getActiveSheet()->setCellValue('A18', 'Currency value #2:') - ->setCellValue('B18', '$12345.67'); - -$objPHPExcel->getActiveSheet()->setCellValue('A19', 'Currency value #3:') - ->setCellValue('B19', '$12,345.67'); - -$objPHPExcel->getActiveSheet()->setCellValue('A20', 'Date value #1:') - ->setCellValue('B20', '21 December 1983'); - -$objPHPExcel->getActiveSheet()->setCellValue('A21', 'Date value #2:') - ->setCellValue('B21', '19-Dec-1960'); - -$objPHPExcel->getActiveSheet()->setCellValue('A22', 'Date value #3:') - ->setCellValue('B22', '07/12/1982'); - -$objPHPExcel->getActiveSheet()->setCellValue('A23', 'Date value #4:') - ->setCellValue('B23', '24-11-1950'); - -$objPHPExcel->getActiveSheet()->setCellValue('A24', 'Date value #5:') - ->setCellValue('B24', '17-Mar'); - -$objPHPExcel->getActiveSheet()->setCellValue('A25', 'Time value #1:') - ->setCellValue('B25', '01:30'); - -$objPHPExcel->getActiveSheet()->setCellValue('A26', 'Time value #2:') - ->setCellValue('B26', '01:30:15'); - -$objPHPExcel->getActiveSheet()->setCellValue('A27', 'Date/Time value:') - ->setCellValue('B27', '19-Dec-1960 01:30'); - -$objPHPExcel->getActiveSheet()->setCellValue('A28', 'Formula:') - ->setCellValue('B28', '=SUM(B2:B9)'); - -// Rename worksheet -echo date('H:i:s') , " Rename worksheet" , EOL; -$objPHPExcel->getActiveSheet()->setTitle('Advanced value binder'); - - -// Set active sheet index to the first sheet, so Excel opens this as the first sheet -$objPHPExcel->setActiveSheetIndex(0); - - -// Save Excel 2007 file -echo date('H:i:s') , " Write to Excel2007 format" , EOL; -$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007'); -$objWriter->save(str_replace('.php', '.xlsx', __FILE__)); -echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; -// Save Excel5 file -echo date('H:i:s') , " Write to Excel5 format" , EOL; -$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel5'); -$objWriter->save(str_replace('.php', '.xls', __FILE__)); -echo date('H:i:s') , " File written to " , str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; - - -// Echo memory peak usage -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; - -// Echo done -echo date('H:i:s') , " Done writing file" , EOL; -echo 'File has been created in ' , getcwd() , EOL; diff --git a/Examples/30template.php b/Examples/30template.php deleted file mode 100644 index 97c880d5..00000000 --- a/Examples/30template.php +++ /dev/null @@ -1,91 +0,0 @@ -'); - -date_default_timezone_set('Europe/London'); - -/** Include PHPExcel */ -require_once dirname(__FILE__) . '/../src/Bootstrap.php'; - - - -echo date('H:i:s') , " Load from Excel5 template" , EOL; -$objReader = \PHPExcel\IOFactory::createReader('Excel5'); -$objPHPExcel = $objReader->load("templates/30template.xls"); - - - - -echo date('H:i:s') , " Add new data to the template" , EOL; -$data = array(array('title' => 'Excel for dummies', - 'price' => 17.99, - 'quantity' => 2 - ), - array('title' => 'PHP for dummies', - 'price' => 15.99, - 'quantity' => 1 - ), - array('title' => 'Inside OOP', - 'price' => 12.95, - 'quantity' => 1 - ) - ); - -$objPHPExcel->getActiveSheet()->setCellValue('D1', \PHPExcel\Shared\Date::PHPToExcel(time())); - -$baseRow = 5; -foreach($data as $r => $dataRow) { - $row = $baseRow + $r; - $objPHPExcel->getActiveSheet()->insertNewRowBefore($row,1); - - $objPHPExcel->getActiveSheet()->setCellValue('A'.$row, $r+1) - ->setCellValue('B'.$row, $dataRow['title']) - ->setCellValue('C'.$row, $dataRow['price']) - ->setCellValue('D'.$row, $dataRow['quantity']) - ->setCellValue('E'.$row, '=C'.$row.'*D'.$row); -} -$objPHPExcel->getActiveSheet()->removeRow($baseRow-1,1); - - -echo date('H:i:s') , " Write to Excel5 format" , EOL; -$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel5'); -$objWriter->save(str_replace('.php', '.xls', __FILE__)); -echo date('H:i:s') , " File written to " , str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; - - -// Echo memory peak usage -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; - -// Echo done -echo date('H:i:s') , " Done writing file" , EOL; -echo 'File has been created in ' , getcwd() , EOL; diff --git a/Examples/31docproperties_write-xls.php b/Examples/31docproperties_write-xls.php deleted file mode 100644 index 6100db72..00000000 --- a/Examples/31docproperties_write-xls.php +++ /dev/null @@ -1,119 +0,0 @@ -'); - -date_default_timezone_set('Europe/London'); - -/** Include PHPExcel */ -require_once dirname(__FILE__) . '/../src/Bootstrap.php'; - - -$inputFileType = 'Excel5'; -$inputFileName = 'templates/31docproperties.xls'; - - -echo date('H:i:s') , " Load Tests from $inputFileType file" , EOL; -$callStartTime = microtime(true); - -$objPHPExcelReader = \PHPExcel\IOFactory::createReader($inputFileType); -$objPHPExcel = $objPHPExcelReader->load($inputFileName); - -$callEndTime = microtime(true); -$callTime = $callEndTime - $callStartTime; -echo 'Call time to read Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; -// Echo memory usage -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; - - -echo date('H:i:s') , " Adjust properties" , EOL; -$objPHPExcel->getProperties()->setTitle("Office 95 XLS Test Document") - ->setSubject("Office 95 XLS Test Document") - ->setDescription("Test XLS document, generated using PHPExcel") - ->setKeywords("office 95 biff php"); - - -// Save Excel 95 file -echo date('H:i:s') , " Write to Excel5 format" , EOL; -$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel5'); -$objWriter->save(str_replace('.php', '.xls', __FILE__)); -echo date('H:i:s') , " File written to " , str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; - - -// Echo memory peak usage -echo date('H:i:s') , " Peak memory usage: " . (memory_get_peak_usage(true) / 1024 / 1024) . " MB" , EOL; - - -echo EOL; -// Reread File -echo date('H:i:s') , " Reread Excel5 file" , EOL; -$objPHPExcelRead = \PHPExcel\IOFactory::load(str_replace('.php', '.xls', __FILE__)); - -// Set properties -echo date('H:i:s') , " Get properties" , EOL; - -echo 'Core Properties:' , EOL; -echo ' Created by - ' , $objPHPExcel->getProperties()->getCreator() , EOL; -echo ' Created on - ' , date('d-M-Y',$objPHPExcel->getProperties()->getCreated()) , ' at ' , - date('H:i:s',$objPHPExcel->getProperties()->getCreated()) , EOL; -echo ' Last Modified by - ' , $objPHPExcel->getProperties()->getLastModifiedBy() , EOL; -echo ' Last Modified on - ' , date('d-M-Y',$objPHPExcel->getProperties()->getModified()) , ' at ' , - date('H:i:s',$objPHPExcel->getProperties()->getModified()) , EOL; -echo ' Title - ' , $objPHPExcel->getProperties()->getTitle() , EOL; -echo ' Subject - ' , $objPHPExcel->getProperties()->getSubject() , EOL; -echo ' Description - ' , $objPHPExcel->getProperties()->getDescription() , EOL; -echo ' Keywords: - ' , $objPHPExcel->getProperties()->getKeywords() , EOL; - - -echo 'Extended (Application) Properties:' , EOL; -echo ' Category - ' , $objPHPExcel->getProperties()->getCategory() , EOL; -echo ' Company - ' , $objPHPExcel->getProperties()->getCompany() , EOL; -echo ' Manager - ' , $objPHPExcel->getProperties()->getManager() , EOL; - - -echo 'Custom Properties:' , EOL; -$customProperties = $objPHPExcel->getProperties()->getCustomProperties(); -foreach($customProperties as $customProperty) { - $propertyValue = $objPHPExcel->getProperties()->getCustomPropertyValue($customProperty); - $propertyType = $objPHPExcel->getProperties()->getCustomPropertyType($customProperty); - echo ' ' , $customProperty , ' - (' , $propertyType , ') - '; - if ($propertyType == \PHPExcel\Document\Properties::PROPERTY_TYPE_DATE) { - echo date('d-M-Y H:i:s',$propertyValue) , EOL; - } elseif ($propertyType == \PHPExcel\Document\Properties::PROPERTY_TYPE_BOOLEAN) { - echo (($propertyValue) ? 'TRUE' : 'FALSE') , EOL; - } else { - echo $propertyValue , EOL; - } -} - -// Echo memory peak usage -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) . " MB" , EOL; diff --git a/Examples/31docproperties_write.php b/Examples/31docproperties_write.php deleted file mode 100644 index b6ee0ff1..00000000 --- a/Examples/31docproperties_write.php +++ /dev/null @@ -1,119 +0,0 @@ -'); - -date_default_timezone_set('Europe/London'); - -/** Include PHPExcel */ -require_once dirname(__FILE__) . '/../src/Bootstrap.php'; - - -$inputFileType = 'Excel2007'; -$inputFileName = 'templates/31docproperties.xlsx'; - - -echo date('H:i:s') , " Load Tests from $inputFileType file" , EOL; -$callStartTime = microtime(true); - -$objPHPExcelReader = \PHPExcel\IOFactory::createReader($inputFileType); -$objPHPExcel = $objPHPExcelReader->load($inputFileName); - -$callEndTime = microtime(true); -$callTime = $callEndTime - $callStartTime; -echo 'Call time to read Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; -// Echo memory usage -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; - - -echo date('H:i:s') , " Adjust properties" , EOL; -$objPHPExcel->getProperties()->setTitle("Office 2007 XLSX Test Document") - ->setSubject("Office 2007 XLSX Test Document") - ->setDescription("Test XLSX document, generated using PHPExcel") - ->setKeywords("office 2007 openxml php"); - - -// Save Excel 2007 file -echo date('H:i:s') , " Write to Excel2007 format" , EOL; -$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007'); -$objWriter->save(str_replace('.php', '.xlsx', __FILE__)); -echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; - - -// Echo memory peak usage -echo date('H:i:s') , " Peak memory usage: " . (memory_get_peak_usage(true) / 1024 / 1024) . " MB" , EOL; - - -echo EOL; -// Reread File -echo date('H:i:s') , " Reread Excel2007 file" , EOL; -$objPHPExcelRead = \PHPExcel\IOFactory::load(str_replace('.php', '.xlsx', __FILE__)); - -// Set properties -echo date('H:i:s') , " Get properties" , EOL; - -echo 'Core Properties:' , EOL; -echo ' Created by - ' , $objPHPExcel->getProperties()->getCreator() , EOL; -echo ' Created on - ' , date('d-M-Y',$objPHPExcel->getProperties()->getCreated()) , ' at ' , - date('H:i:s',$objPHPExcel->getProperties()->getCreated()) , EOL; -echo ' Last Modified by - ' , $objPHPExcel->getProperties()->getLastModifiedBy() , EOL; -echo ' Last Modified on - ' , date('d-M-Y',$objPHPExcel->getProperties()->getModified()) , ' at ' , - date('H:i:s',$objPHPExcel->getProperties()->getModified()) , EOL; -echo ' Title - ' , $objPHPExcel->getProperties()->getTitle() , EOL; -echo ' Subject - ' , $objPHPExcel->getProperties()->getSubject() , EOL; -echo ' Description - ' , $objPHPExcel->getProperties()->getDescription() , EOL; -echo ' Keywords: - ' , $objPHPExcel->getProperties()->getKeywords() , EOL; - - -echo 'Extended (Application) Properties:' , EOL; -echo ' Category - ' , $objPHPExcel->getProperties()->getCategory() , EOL; -echo ' Company - ' , $objPHPExcel->getProperties()->getCompany() , EOL; -echo ' Manager - ' , $objPHPExcel->getProperties()->getManager() , EOL; - - -echo 'Custom Properties:' , EOL; -$customProperties = $objPHPExcel->getProperties()->getCustomProperties(); -foreach($customProperties as $customProperty) { - $propertyValue = $objPHPExcel->getProperties()->getCustomPropertyValue($customProperty); - $propertyType = $objPHPExcel->getProperties()->getCustomPropertyType($customProperty); - echo ' ' , $customProperty , ' - (' , $propertyType , ') - '; - if ($propertyType == \PHPExcel\Document\Properties::PROPERTY_TYPE_DATE) { - echo date('d-M-Y H:i:s',$propertyValue) , EOL; - } elseif ($propertyType == \PHPExcel\Document\Properties::PROPERTY_TYPE_BOOLEAN) { - echo (($propertyValue) ? 'TRUE' : 'FALSE') , EOL; - } else { - echo $propertyValue , EOL; - } -} - -// Echo memory peak usage -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) . " MB" , EOL; diff --git a/Examples/32chartreadwrite.php b/Examples/32chartreadwrite.php deleted file mode 100644 index 97a72a9d..00000000 --- a/Examples/32chartreadwrite.php +++ /dev/null @@ -1,102 +0,0 @@ -'); - -date_default_timezone_set('Europe/London'); - -/** Include PHPExcel */ -require_once dirname(__FILE__) . '/../src/Bootstrap.php'; - -$inputFileType = 'Excel2007'; -$inputFileNames = 'templates/32readwrite*[0-9].xlsx'; - -if ((isset($argc)) && ($argc > 1)) { - $inputFileNames = array(); - for($i = 1; $i < $argc; ++$i) { - $inputFileNames[] = dirname(__FILE__) . '/templates/' . $argv[$i]; - } -} else { - $inputFileNames = glob($inputFileNames); -} -foreach($inputFileNames as $inputFileName) { - $inputFileNameShort = basename($inputFileName); - - if (!file_exists($inputFileName)) { - echo date('H:i:s') , " File " , $inputFileNameShort , ' does not exist' , EOL; - continue; - } - - echo date('H:i:s') , " Load Test from $inputFileType file " , $inputFileNameShort , EOL; - - $objReader = \PHPExcel\IOFactory::createReader($inputFileType); - $objReader->setIncludeCharts(TRUE); - $objPHPExcel = $objReader->load($inputFileName); - - - echo date('H:i:s') , " Iterate worksheets looking at the charts" , EOL; - foreach ($objPHPExcel->getWorksheetIterator() as $worksheet) { - $sheetName = $worksheet->getTitle(); - echo 'Worksheet: ' , $sheetName , EOL; - - $chartNames = $worksheet->getChartNames(); - if(empty($chartNames)) { - echo ' There are no charts in this worksheet' , EOL; - } else { - natsort($chartNames); - foreach($chartNames as $i => $chartName) { - $chart = $worksheet->getChartByName($chartName); - if (!is_null($chart->getTitle())) { - $caption = '"' . implode(' ',$chart->getTitle()->getCaption()) . '"'; - } else { - $caption = 'Untitled'; - } - echo ' ' , $chartName , ' - ' , $caption , EOL; - echo str_repeat(' ',strlen($chartName)+3); - $groupCount = $chart->getPlotArea()->getPlotGroupCount(); - if ($groupCount == 1) { - $chartType = $chart->getPlotArea()->getPlotGroupByIndex(0)->getPlotType(); - echo ' ' , $chartType , EOL; - } else { - $chartTypes = array(); - for($i = 0; $i < $groupCount; ++$i) { - $chartTypes[] = $chart->getPlotArea()->getPlotGroupByIndex($i)->getPlotType(); - } - $chartTypes = array_unique($chartTypes); - if (count($chartTypes) == 1) { - $chartType = 'Multiple Plot ' . array_pop($chartTypes); - echo ' ' , $chartType , EOL; - } elseif (count($chartTypes) == 0) { - echo ' *** Type not yet implemented' , EOL; - } else { - echo ' Combination Chart' , EOL; - } - } - } - } - } - - - $outputFileName = basename($inputFileName); - - echo date('H:i:s') , " Write Tests to Excel2007 file " , EOL; - $objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007'); - $objWriter->setIncludeCharts(TRUE); - $objWriter->save($outputFileName); - echo date('H:i:s') , " File written to " , $outputFileName , EOL; - - $objPHPExcel->disconnectWorksheets(); - unset($objPHPExcel); -} - -// Echo memory peak usage -echo date('H:i:s') , ' Peak memory usage: ' , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; - -// Echo done -echo date('H:i:s') , " Done writing files" , EOL; -echo 'Files have been created in ' , getcwd() , EOL; diff --git a/Examples/33chartcreate-area.php b/Examples/33chartcreate-area.php deleted file mode 100644 index 9d50b20e..00000000 --- a/Examples/33chartcreate-area.php +++ /dev/null @@ -1,142 +0,0 @@ -'); - -date_default_timezone_set('Europe/London'); - -/** - * PHPExcel - * - * Copyright (c) 2006 - 2015 PHPExcel - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * @category PHPExcel - * @package PHPExcel - * @copyright Copyright (c) 2006 - 2015 PHPExcel (https://github.com/PHPOffice/PhpSpreadsheet) - * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version ##VERSION##, ##DATE## - */ - -/** PHPExcel */ -require_once dirname(__FILE__) . '/../src/Bootstrap.php'; - - -$objPHPExcel = new \PHPExcel\Spreadsheet(); -$objWorksheet = $objPHPExcel->getActiveSheet(); -$objWorksheet->fromArray( - array( - array('', 2010, 2011, 2012), - array('Q1', 12, 15, 21), - array('Q2', 56, 73, 86), - array('Q3', 52, 61, 69), - array('Q4', 30, 32, 0), - ) -); - -// Set the Labels for each data series we want to plot -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$dataSeriesLabels = array( - new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$B$1', NULL, 1), // 2010 - new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$C$1', NULL, 1), // 2011 - new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$D$1', NULL, 1), // 2012 -); -// Set the X-Axis Labels -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$xAxisTickValues = array( - new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$5', NULL, 4), // Q1 to Q4 -); -// Set the Data values for each data series we want to plot -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$dataSeriesValues = array( - new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$B$2:$B$5', NULL, 4), - new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', NULL, 4), - new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$D$2:$D$5', NULL, 4), -); - -// Build the dataseries -$series = new \PHPExcel\Chart\DataSeries( - \PHPExcel\Chart\DataSeries::TYPE_AREACHART, // plotType - \PHPExcel\Chart\DataSeries::GROUPING_PERCENT_STACKED, // plotGrouping - range(0, count($dataSeriesValues)-1), // plotOrder - $dataSeriesLabels, // plotLabel - $xAxisTickValues, // plotCategory - $dataSeriesValues // plotValues -); - -// Set the series in the plot area -$plotArea = new \PHPExcel\Chart\PlotArea(NULL, array($series)); -// Set the chart legend -$legend = new \PHPExcel\Chart\Legend(\PHPExcel\Chart\Legend::POSITION_TOPRIGHT, NULL, false); - -$title = new \PHPExcel\Chart\Title('Test %age-Stacked Area Chart'); -$yAxisLabel = new \PHPExcel\Chart\Title('Value ($k)'); - - -// Create the chart -$chart = new \PHPExcel\Chart( - 'chart1', // name - $title, // title - $legend, // legend - $plotArea, // plotArea - true, // plotVisibleOnly - 0, // displayBlanksAs - NULL, // xAxisLabel - $yAxisLabel // yAxisLabel -); - -// Set the position where the chart should appear in the worksheet -$chart->setTopLeftPosition('A7'); -$chart->setBottomRightPosition('H20'); - -// Add the chart to the worksheet -$objWorksheet->addChart($chart); - - -// Save Excel 2007 file -echo date('H:i:s') , " Write to Excel2007 format" , EOL; -$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007'); -$objWriter->setIncludeCharts(TRUE); -$objWriter->save(str_replace('.php', '.xlsx', __FILE__)); -echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; - - -// Echo memory peak usage -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; - -// Echo done -echo date('H:i:s') , " Done writing file" , EOL; -echo 'File has been created in ' , getcwd() , EOL; diff --git a/Examples/33chartcreate-bar-stacked.php b/Examples/33chartcreate-bar-stacked.php deleted file mode 100644 index aa67c5cc..00000000 --- a/Examples/33chartcreate-bar-stacked.php +++ /dev/null @@ -1,145 +0,0 @@ -'); - -date_default_timezone_set('Europe/London'); - -/** - * PHPExcel - * - * Copyright (c) 2006 - 2015 PHPExcel - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * @category PHPExcel - * @package PHPExcel - * @copyright Copyright (c) 2006 - 2015 PHPExcel (https://github.com/PHPOffice/PhpSpreadsheet) - * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version ##VERSION##, ##DATE## - */ - -/** PHPExcel */ -require_once dirname(__FILE__) . '/../src/Bootstrap.php'; - - -$objPHPExcel = new \PHPExcel\Spreadsheet(); -$objWorksheet = $objPHPExcel->getActiveSheet(); -$objWorksheet->fromArray( - array( - array('', 2010, 2011, 2012), - array('Q1', 12, 15, 21), - array('Q2', 56, 73, 86), - array('Q3', 52, 61, 69), - array('Q4', 30, 32, 0), - ) -); - -// Set the Labels for each data series we want to plot -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$dataSeriesLabels = array( - new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$B$1', NULL, 1), // 2010 - new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$C$1', NULL, 1), // 2011 - new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$D$1', NULL, 1), // 2012 -); -// Set the X-Axis Labels -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$xAxisTickValues = array( - new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$5', NULL, 4), // Q1 to Q4 -); -// Set the Data values for each data series we want to plot -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$dataSeriesValues = array( - new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$B$2:$B$5', NULL, 4), - new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', NULL, 4), - new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$D$2:$D$5', NULL, 4), -); - -// Build the dataseries -$series = new \PHPExcel\Chart\DataSeries( - \PHPExcel\Chart\DataSeries::TYPE_BARCHART, // plotType - \PHPExcel\Chart\DataSeries::GROUPING_STACKED, // plotGrouping - range(0, count($dataSeriesValues)-1), // plotOrder - $dataSeriesLabels, // plotLabel - $xAxisTickValues, // plotCategory - $dataSeriesValues // plotValues -); -// Set additional dataseries parameters -// Make it a horizontal bar rather than a vertical column graph -$series->setPlotDirection(\PHPExcel\Chart\DataSeries::DIRECTION_BAR); - -// Set the series in the plot area -$plotArea = new \PHPExcel\Chart\PlotArea(NULL, array($series)); -// Set the chart legend -$legend = new \PHPExcel\Chart\Legend(\PHPExcel\Chart\Legend::POSITION_RIGHT, NULL, false); - -$title = new \PHPExcel\Chart\Title('Test Chart'); -$yAxisLabel = new \PHPExcel\Chart\Title('Value ($k)'); - - -// Create the chart -$chart = new \PHPExcel\Chart( - 'chart1', // name - $title, // title - $legend, // legend - $plotArea, // plotArea - true, // plotVisibleOnly - 0, // displayBlanksAs - NULL, // xAxisLabel - $yAxisLabel // yAxisLabel -); - -// Set the position where the chart should appear in the worksheet -$chart->setTopLeftPosition('A7'); -$chart->setBottomRightPosition('H20'); - -// Add the chart to the worksheet -$objWorksheet->addChart($chart); - - -// Save Excel 2007 file -echo date('H:i:s') , " Write to Excel2007 format" , EOL; -$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007'); -$objWriter->setIncludeCharts(TRUE); -$objWriter->save(str_replace('.php', '.xlsx', __FILE__)); -echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; - - -// Echo memory peak usage -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; - -// Echo done -echo date('H:i:s') , " Done writing file" , EOL; -echo 'File has been created in ' , getcwd() , EOL; diff --git a/Examples/33chartcreate-bar.php b/Examples/33chartcreate-bar.php deleted file mode 100644 index f7a9aac9..00000000 --- a/Examples/33chartcreate-bar.php +++ /dev/null @@ -1,145 +0,0 @@ -'); - -date_default_timezone_set('Europe/London'); - -/** - * PHPExcel - * - * Copyright (c) 2006 - 2015 PHPExcel - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * @category PHPExcel - * @package PHPExcel - * @copyright Copyright (c) 2006 - 2015 PHPExcel (https://github.com/PHPOffice/PhpSpreadsheet) - * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version ##VERSION##, ##DATE## - */ - -/** PHPExcel */ -require_once dirname(__FILE__) . '/../src/Bootstrap.php'; - - -$objPHPExcel = new \PHPExcel\Spreadsheet(); -$objWorksheet = $objPHPExcel->getActiveSheet(); -$objWorksheet->fromArray( - array( - array('', 2010, 2011, 2012), - array('Q1', 12, 15, 21), - array('Q2', 56, 73, 86), - array('Q3', 52, 61, 69), - array('Q4', 30, 32, 0), - ) -); - -// Set the Labels for each data series we want to plot -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$dataSeriesLabels = array( - new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$B$1', NULL, 1), // 2010 - new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$C$1', NULL, 1), // 2011 - new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$D$1', NULL, 1), // 2012 -); -// Set the X-Axis Labels -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$xAxisTickValues = array( - new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$5', NULL, 4), // Q1 to Q4 -); -// Set the Data values for each data series we want to plot -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$dataSeriesValues = array( - new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$B$2:$B$5', NULL, 4), - new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', NULL, 4), - new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$D$2:$D$5', NULL, 4), -); - -// Build the dataseries -$series = new \PHPExcel\Chart\DataSeries( - \PHPExcel\Chart\DataSeries::TYPE_BARCHART, // plotType - \PHPExcel\Chart\DataSeries::GROUPING_CLUSTERED, // plotGrouping - range(0, count($dataSeriesValues)-1), // plotOrder - $dataSeriesLabels, // plotLabel - $xAxisTickValues, // plotCategory - $dataSeriesValues // plotValues -); -// Set additional dataseries parameters -// Make it a horizontal bar rather than a vertical column graph -$series->setPlotDirection(\PHPExcel\Chart\DataSeries::DIRECTION_BAR); - -// Set the series in the plot area -$plotArea = new \PHPExcel\Chart\PlotArea(NULL, array($series)); -// Set the chart legend -$legend = new \PHPExcel\Chart\Legend(\PHPExcel\Chart\Legend::POSITION_RIGHT, NULL, false); - -$title = new \PHPExcel\Chart\Title('Test Bar Chart'); -$yAxisLabel = new \PHPExcel\Chart\Title('Value ($k)'); - - -// Create the chart -$chart = new \PHPExcel\Chart( - 'chart1', // name - $title, // title - $legend, // legend - $plotArea, // plotArea - true, // plotVisibleOnly - 0, // displayBlanksAs - NULL, // xAxisLabel - $yAxisLabel // yAxisLabel -); - -// Set the position where the chart should appear in the worksheet -$chart->setTopLeftPosition('A7'); -$chart->setBottomRightPosition('H20'); - -// Add the chart to the worksheet -$objWorksheet->addChart($chart); - - -// Save Excel 2007 file -echo date('H:i:s') , " Write to Excel2007 format" , EOL; -$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007'); -$objWriter->setIncludeCharts(TRUE); -$objWriter->save(str_replace('.php', '.xlsx', __FILE__)); -echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; - - -// Echo memory peak usage -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; - -// Echo done -echo date('H:i:s') , " Done writing file" , EOL; -echo 'File has been created in ' , getcwd() , EOL; diff --git a/Examples/33chartcreate-column-2.php b/Examples/33chartcreate-column-2.php deleted file mode 100644 index 2d32bbd6..00000000 --- a/Examples/33chartcreate-column-2.php +++ /dev/null @@ -1,154 +0,0 @@ -'); - -date_default_timezone_set('Europe/London'); - -/** - * PHPExcel - * - * Copyright (c) 2006 - 2015 PHPExcel - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * @category PHPExcel - * @package PHPExcel - * @copyright Copyright (c) 2006 - 2015 PHPExcel (https://github.com/PHPOffice/PhpSpreadsheet) - * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version ##VERSION##, ##DATE## - */ - -/** PHPExcel */ -require_once dirname(__FILE__) . '/../src/Bootstrap.php'; - - -$objPHPExcel = new \PHPExcel\Spreadsheet(); -$objWorksheet = $objPHPExcel->getActiveSheet(); -$objWorksheet->fromArray( - array( - array('', '', 'Budget', 'Forecast', 'Actual'), - array('2010', 'Q1', 47, 44, 43 ), - array('', 'Q2', 56, 53, 50 ), - array('', 'Q3', 52, 46, 45 ), - array('', 'Q4', 45, 40, 40 ), - array('2011', 'Q1', 51, 42, 46 ), - array('', 'Q2', 53, 58, 56 ), - array('', 'Q3', 64, 66, 69 ), - array('', 'Q4', 54, 55, 56 ), - array('2012', 'Q1', 49, 52, 58 ), - array('', 'Q2', 68, 73, 86 ), - array('', 'Q3', 72, 78, 0 ), - array('', 'Q4', 50, 60, 0 ), - ) -); - -// Set the Labels for each data series we want to plot -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$dataSeriesLabels = array( - new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$C$1', NULL, 1), // 'Budget' - new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$D$1', NULL, 1), // 'Forecast' - new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$E$1', NULL, 1), // 'Actual' -); -// Set the X-Axis Labels -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$xAxisTickValues = array( - new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$B$13', NULL, 12), // Q1 to Q4 for 2010 to 2012 -); -// Set the Data values for each data series we want to plot -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$dataSeriesValues = array( - new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$13', NULL, 12), - new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$D$2:$D$13', NULL, 12), - new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$E$2:$E$13', NULL, 12), -); - -// Build the dataseries -$series = new \PHPExcel\Chart\DataSeries( - \PHPExcel\Chart\DataSeries::TYPE_BARCHART, // plotType - \PHPExcel\Chart\DataSeries::GROUPING_CLUSTERED, // plotGrouping - range(0, count($dataSeriesValues)-1), // plotOrder - $dataSeriesLabels, // plotLabel - $xAxisTickValues, // plotCategory - $dataSeriesValues // plotValues -); -// Set additional dataseries parameters -// Make it a vertical column rather than a horizontal bar graph -$series->setPlotDirection(\PHPExcel\Chart\DataSeries::DIRECTION_COL); - -// Set the series in the plot area -$plotArea = new \PHPExcel\Chart\PlotArea(NULL, array($series)); -// Set the chart legend -$legend = new \PHPExcel\Chart\Legend(\PHPExcel\Chart\Legend::POSITION_BOTTOM, NULL, false); - -$title = new \PHPExcel\Chart\Title('Test Grouped Column Chart'); -$xAxisLabel = new \PHPExcel\Chart\Title('Financial Period'); -$yAxisLabel = new \PHPExcel\Chart\Title('Value ($k)'); - - -// Create the chart -$chart = new \PHPExcel\Chart( - 'chart1', // name - $title, // title - $legend, // legend - $plotArea, // plotArea - true, // plotVisibleOnly - 0, // displayBlanksAs - $xAxisLabel, // xAxisLabel - $yAxisLabel // yAxisLabel -); - -// Set the position where the chart should appear in the worksheet -$chart->setTopLeftPosition('G2'); -$chart->setBottomRightPosition('P20'); - -// Add the chart to the worksheet -$objWorksheet->addChart($chart); - - -// Save Excel 2007 file -echo date('H:i:s') , " Write to Excel2007 format" , EOL; -$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007'); -$objWriter->setIncludeCharts(TRUE); -$objWriter->save(str_replace('.php', '.xlsx', __FILE__)); -echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; - - -// Echo memory peak usage -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; - -// Echo done -echo date('H:i:s') , " Done writing file" , EOL; -echo 'File has been created in ' , getcwd() , EOL; diff --git a/Examples/33chartcreate-column.php b/Examples/33chartcreate-column.php deleted file mode 100644 index 959feb24..00000000 --- a/Examples/33chartcreate-column.php +++ /dev/null @@ -1,145 +0,0 @@ -'); - -date_default_timezone_set('Europe/London'); - -/** - * PHPExcel - * - * Copyright (c) 2006 - 2015 PHPExcel - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * @category PHPExcel - * @package PHPExcel - * @copyright Copyright (c) 2006 - 2015 PHPExcel (https://github.com/PHPOffice/PhpSpreadsheet) - * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version ##VERSION##, ##DATE## - */ - -/** PHPExcel */ -require_once dirname(__FILE__) . '/../src/Bootstrap.php'; - - -$objPHPExcel = new \PHPExcel\Spreadsheet(); -$objWorksheet = $objPHPExcel->getActiveSheet(); -$objWorksheet->fromArray( - array( - array('', 2010, 2011, 2012), - array('Q1', 12, 15, 21), - array('Q2', 56, 73, 86), - array('Q3', 52, 61, 69), - array('Q4', 30, 32, 0), - ) -); - -// Set the Labels for each data series we want to plot -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$dataSeriesLabels = array( - new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$B$1', NULL, 1), // 2010 - new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$C$1', NULL, 1), // 2011 - new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$D$1', NULL, 1), // 2012 -); -// Set the X-Axis Labels -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$xAxisTickValues = array( - new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$5', NULL, 4), // Q1 to Q4 -); -// Set the Data values for each data series we want to plot -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$dataSeriesValues = array( - new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$B$2:$B$5', NULL, 4), - new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', NULL, 4), - new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$D$2:$D$5', NULL, 4), -); - -// Build the dataseries -$series = new \PHPExcel\Chart\DataSeries( - \PHPExcel\Chart\DataSeries::TYPE_BARCHART, // plotType - \PHPExcel\Chart\DataSeries::GROUPING_STANDARD, // plotGrouping - range(0, count($dataSeriesValues)-1), // plotOrder - $dataSeriesLabels, // plotLabel - $xAxisTickValues, // plotCategory - $dataSeriesValues // plotValues -); -// Set additional dataseries parameters -// Make it a vertical column rather than a horizontal bar graph -$series->setPlotDirection(\PHPExcel\Chart\DataSeries::DIRECTION_COL); - -// Set the series in the plot area -$plotArea = new \PHPExcel\Chart\PlotArea(NULL, array($series)); -// Set the chart legend -$legend = new \PHPExcel\Chart\Legend(\PHPExcel\Chart\Legend::POSITION_RIGHT, NULL, false); - -$title = new \PHPExcel\Chart\Title('Test Column Chart'); -$yAxisLabel = new \PHPExcel\Chart\Title('Value ($k)'); - - -// Create the chart -$chart = new \PHPExcel\Chart( - 'chart1', // name - $title, // title - $legend, // legend - $plotArea, // plotArea - true, // plotVisibleOnly - 0, // displayBlanksAs - NULL, // xAxisLabel - $yAxisLabel // yAxisLabel -); - -// Set the position where the chart should appear in the worksheet -$chart->setTopLeftPosition('A7'); -$chart->setBottomRightPosition('H20'); - -// Add the chart to the worksheet -$objWorksheet->addChart($chart); - - -// Save Excel 2007 file -echo date('H:i:s') , " Write to Excel2007 format" , EOL; -$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007'); -$objWriter->setIncludeCharts(TRUE); -$objWriter->save(str_replace('.php', '.xlsx', __FILE__)); -echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; - - -// Echo memory peak usage -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; - -// Echo done -echo date('H:i:s') , " Done writing file" , EOL; -echo 'File has been created in ' , getcwd() , EOL; diff --git a/Examples/33chartcreate-composite.php b/Examples/33chartcreate-composite.php deleted file mode 100644 index 53e97388..00000000 --- a/Examples/33chartcreate-composite.php +++ /dev/null @@ -1,203 +0,0 @@ -'); - -date_default_timezone_set('Europe/London'); - -/** - * PHPExcel - * - * Copyright (c) 2006 - 2015 PHPExcel - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * @category PHPExcel - * @package PHPExcel - * @copyright Copyright (c) 2006 - 2015 PHPExcel (https://github.com/PHPOffice/PhpSpreadsheet) - * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version ##VERSION##, ##DATE## - */ - -/** PHPExcel */ -require_once dirname(__FILE__) . '/../src/Bootstrap.php'; - - -$objPHPExcel = new \PHPExcel\Spreadsheet(); -$objWorksheet = $objPHPExcel->getActiveSheet(); -$objWorksheet->fromArray( - array( - array('', 'Rainfall (mm)', 'Temperature (°F)', 'Humidity (%)'), - array('Jan', 78, 52, 61), - array('Feb', 64, 54, 62), - array('Mar', 62, 57, 63), - array('Apr', 21, 62, 59), - array('May', 11, 75, 60), - array('Jun', 1, 75, 57), - array('Jul', 1, 79, 56), - array('Aug', 1, 79, 59), - array('Sep', 10, 75, 60), - array('Oct', 40, 68, 63), - array('Nov', 69, 62, 64), - array('Dec', 89, 57, 66), - ) -); - - -// Set the Labels for each data series we want to plot -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$dataSeriesLabels1 = array( - new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$B$1', NULL, 1), // Temperature -); -$dataSeriesLabels2 = array( - new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$C$1', NULL, 1), // Rainfall -); -$dataSeriesLabels3 = array( - new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$D$1', NULL, 1), // Humidity -); - -// Set the X-Axis Labels -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$xAxisTickValues = array( - new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$13', NULL, 12), // Jan to Dec -); - - -// Set the Data values for each data series we want to plot -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$dataSeriesValues1 = array( - new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$B$2:$B$13', NULL, 12), -); - -// Build the dataseries -$series1 = new \PHPExcel\Chart\DataSeries( - \PHPExcel\Chart\DataSeries::TYPE_BARCHART, // plotType - \PHPExcel\Chart\DataSeries::GROUPING_CLUSTERED, // plotGrouping - range(0, count($dataSeriesValues1)-1), // plotOrder - $dataSeriesLabels1, // plotLabel - $xAxisTickValues, // plotCategory - $dataSeriesValues1 // plotValues -); -// Set additional dataseries parameters -// Make it a vertical column rather than a horizontal bar graph -$series1->setPlotDirection(\PHPExcel\Chart\DataSeries::DIRECTION_COL); - - -// Set the Data values for each data series we want to plot -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$dataSeriesValues2 = array( - new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$13', NULL, 12), -); - -// Build the dataseries -$series2 = new \PHPExcel\Chart\DataSeries( - \PHPExcel\Chart\DataSeries::TYPE_LINECHART, // plotType - \PHPExcel\Chart\DataSeries::GROUPING_STANDARD, // plotGrouping - range(0, count($dataSeriesValues2)-1), // plotOrder - $dataSeriesLabels2, // plotLabel - NULL, // plotCategory - $dataSeriesValues2 // plotValues -); - - -// Set the Data values for each data series we want to plot -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$dataSeriesValues3 = array( - new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$D$2:$D$13', NULL, 12), -); - -// Build the dataseries -$series3 = new \PHPExcel\Chart\DataSeries( - \PHPExcel\Chart\DataSeries::TYPE_AREACHART, // plotType - \PHPExcel\Chart\DataSeries::GROUPING_STANDARD, // plotGrouping - range(0, count($dataSeriesValues2)-1), // plotOrder - $dataSeriesLabels3, // plotLabel - NULL, // plotCategory - $dataSeriesValues3 // plotValues -); - - -// Set the series in the plot area -$plotArea = new \PHPExcel\Chart\PlotArea(NULL, array($series1, $series2, $series3)); -// Set the chart legend -$legend = new \PHPExcel\Chart\Legend(\PHPExcel\Chart\Legend::POSITION_RIGHT, NULL, false); - -$title = new \PHPExcel\Chart\Title('Average Weather Chart for Crete'); - - -// Create the chart -$chart = new \PHPExcel\Chart( - 'chart1', // name - $title, // title - $legend, // legend - $plotArea, // plotArea - true, // plotVisibleOnly - 0, // displayBlanksAs - NULL, // xAxisLabel - NULL // yAxisLabel -); - -// Set the position where the chart should appear in the worksheet -$chart->setTopLeftPosition('F2'); -$chart->setBottomRightPosition('O16'); - -// Add the chart to the worksheet -$objWorksheet->addChart($chart); - - -// Save Excel 2007 file -echo date('H:i:s') , " Write to Excel2007 format" , EOL; -$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007'); -$objWriter->setIncludeCharts(TRUE); -$objWriter->save(str_replace('.php', '.xlsx', __FILE__)); -echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; - - -// Echo memory peak usage -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; - -// Echo done -echo date('H:i:s') , " Done writing file" , EOL; -echo 'File has been created in ' , getcwd() , EOL; diff --git a/Examples/33chartcreate-line.php b/Examples/33chartcreate-line.php deleted file mode 100644 index d5df605e..00000000 --- a/Examples/33chartcreate-line.php +++ /dev/null @@ -1,142 +0,0 @@ -'); - -date_default_timezone_set('Europe/London'); - -/** - * PHPExcel - * - * Copyright (c) 2006 - 2015 PHPExcel - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * @category PHPExcel - * @package PHPExcel - * @copyright Copyright (c) 2006 - 2015 PHPExcel (https://github.com/PHPOffice/PhpSpreadsheet) - * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version ##VERSION##, ##DATE## - */ - -/** PHPExcel */ -require_once dirname(__FILE__) . '/../src/Bootstrap.php'; - - -$objPHPExcel = new \PHPExcel\Spreadsheet(); -$objWorksheet = $objPHPExcel->getActiveSheet(); -$objWorksheet->fromArray( - array( - array('', 2010, 2011, 2012), - array('Q1', 12, 15, 21), - array('Q2', 56, 73, 86), - array('Q3', 52, 61, 69), - array('Q4', 30, 32, 0), - ) -); - -// Set the Labels for each data series we want to plot -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$dataSeriesLabels = array( - new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$B$1', NULL, 1), // 2010 - new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$C$1', NULL, 1), // 2011 - new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$D$1', NULL, 1), // 2012 -); -// Set the X-Axis Labels -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$xAxisTickValues = array( - new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$5', NULL, 4), // Q1 to Q4 -); -// Set the Data values for each data series we want to plot -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$dataSeriesValues = array( - new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$B$2:$B$5', NULL, 4), - new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', NULL, 4), - new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$D$2:$D$5', NULL, 4), -); - -// Build the dataseries -$series = new \PHPExcel\Chart\DataSeries( - \PHPExcel\Chart\DataSeries::TYPE_LINECHART, // plotType - \PHPExcel\Chart\DataSeries::GROUPING_STACKED, // plotGrouping - range(0, count($dataSeriesValues)-1), // plotOrder - $dataSeriesLabels, // plotLabel - $xAxisTickValues, // plotCategory - $dataSeriesValues // plotValues -); - -// Set the series in the plot area -$plotArea = new \PHPExcel\Chart\PlotArea(NULL, array($series)); -// Set the chart legend -$legend = new \PHPExcel\Chart\Legend(\PHPExcel\Chart\Legend::POSITION_TOPRIGHT, NULL, false); - -$title = new \PHPExcel\Chart\Title('Test Stacked Line Chart'); -$yAxisLabel = new \PHPExcel\Chart\Title('Value ($k)'); - - -// Create the chart -$chart = new \PHPExcel\Chart( - 'chart1', // name - $title, // title - $legend, // legend - $plotArea, // plotArea - true, // plotVisibleOnly - 0, // displayBlanksAs - NULL, // xAxisLabel - $yAxisLabel // yAxisLabel -); - -// Set the position where the chart should appear in the worksheet -$chart->setTopLeftPosition('A7'); -$chart->setBottomRightPosition('H20'); - -// Add the chart to the worksheet -$objWorksheet->addChart($chart); - - -// Save Excel 2007 file -echo date('H:i:s') , " Write to Excel2007 format" , EOL; -$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007'); -$objWriter->setIncludeCharts(TRUE); -$objWriter->save(str_replace('.php', '.xlsx', __FILE__)); -echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; - - -// Echo memory peak usage -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; - -// Echo done -echo date('H:i:s') , " Done writing file" , EOL; -echo 'File has been created in ' , getcwd() , EOL; diff --git a/Examples/33chartcreate-multiple-charts.php b/Examples/33chartcreate-multiple-charts.php deleted file mode 100644 index 6ddfd377..00000000 --- a/Examples/33chartcreate-multiple-charts.php +++ /dev/null @@ -1,220 +0,0 @@ -'); - -date_default_timezone_set('Europe/London'); - -/** - * PHPExcel - * - * Copyright (c) 2006 - 2015 PHPExcel - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * @category PHPExcel - * @package PHPExcel - * @copyright Copyright (c) 2006 - 2015 PHPExcel (https://github.com/PHPOffice/PhpSpreadsheet) - * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version ##VERSION##, ##DATE## - */ - -/** PHPExcel */ -require_once dirname(__FILE__) . '/../src/Bootstrap.php'; - - -$objPHPExcel = new \PHPExcel\Spreadsheet(); -$objWorksheet = $objPHPExcel->getActiveSheet(); -$objWorksheet->fromArray( - array( - array('', 2010, 2011, 2012), - array('Q1', 12, 15, 21), - array('Q2', 56, 73, 86), - array('Q3', 52, 61, 69), - array('Q4', 30, 32, 0), - ) -); - - -// Set the Labels for each data series we want to plot -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$dataSeriesLabels1 = array( - new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$B$1', NULL, 1), // 2010 - new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$C$1', NULL, 1), // 2011 - new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$D$1', NULL, 1), // 2012 -); -// Set the X-Axis Labels -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$xAxisTickValues1 = array( - new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$5', NULL, 4), // Q1 to Q4 -); -// Set the Data values for each data series we want to plot -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$dataSeriesValues1 = array( - new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$B$2:$B$5', NULL, 4), - new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', NULL, 4), - new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$D$2:$D$5', NULL, 4), -); - -// Build the dataseries -$series1 = new \PHPExcel\Chart\DataSeries( - \PHPExcel\Chart\DataSeries::TYPE_AREACHART, // plotType - \PHPExcel\Chart\DataSeries::GROUPING_PERCENT_STACKED, // plotGrouping - range(0, count($dataSeriesValues1)-1), // plotOrder - $dataSeriesLabels1, // plotLabel - $xAxisTickValues1, // plotCategory - $dataSeriesValues1 // plotValues -); - -// Set the series in the plot area -$plotArea1 = new \PHPExcel\Chart\PlotArea(NULL, array($series1)); -// Set the chart legend -$legend1 = new \PHPExcel\Chart\Legend(\PHPExcel\Chart\Legend::POSITION_TOPRIGHT, NULL, false); - -$title1 = new \PHPExcel\Chart\Title('Test %age-Stacked Area Chart'); -$yAxisLabel1 = new \PHPExcel\Chart\Title('Value ($k)'); - - -// Create the chart -$chart1 = new \PHPExcel\Chart( - 'chart1', // name - $title1, // title - $legend1, // legend - $plotArea1, // plotArea - true, // plotVisibleOnly - 0, // displayBlanksAs - NULL, // xAxisLabel - $yAxisLabel1 // yAxisLabel -); - -// Set the position where the chart should appear in the worksheet -$chart1->setTopLeftPosition('A7'); -$chart1->setBottomRightPosition('H20'); - -// Add the chart to the worksheet -$objWorksheet->addChart($chart1); - - -// Set the Labels for each data series we want to plot -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$dataSeriesLabels2 = array( - new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$B$1', NULL, 1), // 2010 - new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$C$1', NULL, 1), // 2011 - new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$D$1', NULL, 1), // 2012 -); -// Set the X-Axis Labels -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$xAxisTickValues2 = array( - new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$5', NULL, 4), // Q1 to Q4 -); -// Set the Data values for each data series we want to plot -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$dataSeriesValues2 = array( - new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$B$2:$B$5', NULL, 4), - new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', NULL, 4), - new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$D$2:$D$5', NULL, 4), -); - -// Build the dataseries -$series2 = new \PHPExcel\Chart\DataSeries( - \PHPExcel\Chart\DataSeries::TYPE_BARCHART, // plotType - \PHPExcel\Chart\DataSeries::GROUPING_STANDARD, // plotGrouping - range(0, count($dataSeriesValues2)-1), // plotOrder - $dataSeriesLabels2, // plotLabel - $xAxisTickValues2, // plotCategory - $dataSeriesValues2 // plotValues -); -// Set additional dataseries parameters -// Make it a vertical column rather than a horizontal bar graph -$series2->setPlotDirection(\PHPExcel\Chart\DataSeries::DIRECTION_COL); - -// Set the series in the plot area -$plotArea2 = new \PHPExcel\Chart\PlotArea(NULL, array($series2)); -// Set the chart legend -$legend2 = new \PHPExcel\Chart\Legend(\PHPExcel\Chart\Legend::POSITION_RIGHT, NULL, false); - -$title2 = new \PHPExcel\Chart\Title('Test Column Chart'); -$yAxisLabel2 = new \PHPExcel\Chart\Title('Value ($k)'); - - -// Create the chart -$chart2 = new \PHPExcel\Chart( - 'chart2', // name - $title2, // title - $legend2, // legend - $plotArea2, // plotArea - true, // plotVisibleOnly - 0, // displayBlanksAs - NULL, // xAxisLabel - $yAxisLabel2 // yAxisLabel -); - -// Set the position where the chart should appear in the worksheet -$chart2->setTopLeftPosition('I7'); -$chart2->setBottomRightPosition('P20'); - -// Add the chart to the worksheet -$objWorksheet->addChart($chart2); - - -// Save Excel 2007 file -echo date('H:i:s') , " Write to Excel2007 format" , EOL; -$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007'); -$objWriter->setIncludeCharts(TRUE); -$objWriter->save(str_replace('.php', '.xlsx', __FILE__)); -echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; - - -// Echo memory peak usage -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; - -// Echo done -echo date('H:i:s') , " Done writing file" , EOL; -echo 'File has been created in ' , getcwd() , EOL; diff --git a/Examples/33chartcreate-pie.php b/Examples/33chartcreate-pie.php deleted file mode 100644 index 0113d4d0..00000000 --- a/Examples/33chartcreate-pie.php +++ /dev/null @@ -1,215 +0,0 @@ -'); - -date_default_timezone_set('Europe/London'); - -/** - * PHPExcel - * - * Copyright (c) 2006 - 2015 PHPExcel - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * @category PHPExcel - * @package PHPExcel - * @copyright Copyright (c) 2006 - 2015 PHPExcel (https://github.com/PHPOffice/PhpSpreadsheet) - * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version ##VERSION##, ##DATE## - */ - -/** PHPExcel */ -require_once dirname(__FILE__) . '/../src/Bootstrap.php'; - - -$objPHPExcel = new \PHPExcel\Spreadsheet(); -$objWorksheet = $objPHPExcel->getActiveSheet(); -$objWorksheet->fromArray( - array( - array('', 2010, 2011, 2012), - array('Q1', 12, 15, 21), - array('Q2', 56, 73, 86), - array('Q3', 52, 61, 69), - array('Q4', 30, 32, 0), - ) -); - - -// Set the Labels for each data series we want to plot -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$dataSeriesLabels1 = array( - new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$C$1', NULL, 1), // 2011 -); -// Set the X-Axis Labels -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$xAxisTickValues1 = array( - new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$5', NULL, 4), // Q1 to Q4 -); -// Set the Data values for each data series we want to plot -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$dataSeriesValues1 = array( - new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', NULL, 4), -); - -// Build the dataseries -$series1 = new \PHPExcel\Chart\DataSeries( - \PHPExcel\Chart\DataSeries::TYPE_PIECHART, // plotType - NULL, // plotGrouping (Pie charts don't have any grouping) - range(0, count($dataSeriesValues1)-1), // plotOrder - $dataSeriesLabels1, // plotLabel - $xAxisTickValues1, // plotCategory - $dataSeriesValues1 // plotValues -); - -// Set up a layout object for the Pie chart -$layout1 = new \PHPExcel\Chart\Layout(); -$layout1->setShowVal(TRUE); -$layout1->setShowPercent(TRUE); - -// Set the series in the plot area -$plotArea1 = new \PHPExcel\Chart\PlotArea($layout1, array($series1)); -// Set the chart legend -$legend1 = new \PHPExcel\Chart\Legend(\PHPExcel\Chart\Legend::POSITION_RIGHT, NULL, false); - -$title1 = new \PHPExcel\Chart\Title('Test Pie Chart'); - - -// Create the chart -$chart1 = new \PHPExcel\Chart( - 'chart1', // name - $title1, // title - $legend1, // legend - $plotArea1, // plotArea - true, // plotVisibleOnly - 0, // displayBlanksAs - NULL, // xAxisLabel - NULL // yAxisLabel - Pie charts don't have a Y-Axis -); - -// Set the position where the chart should appear in the worksheet -$chart1->setTopLeftPosition('A7'); -$chart1->setBottomRightPosition('H20'); - -// Add the chart to the worksheet -$objWorksheet->addChart($chart1); - - -// Set the Labels for each data series we want to plot -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$dataSeriesLabels2 = array( - new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$C$1', NULL, 1), // 2011 -); -// Set the X-Axis Labels -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$xAxisTickValues2 = array( - new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$5', NULL, 4), // Q1 to Q4 -); -// Set the Data values for each data series we want to plot -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$dataSeriesValues2 = array( - new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', NULL, 4), -); - -// Build the dataseries -$series2 = new \PHPExcel\Chart\DataSeries( - \PHPExcel\Chart\DataSeries::TYPE_DONUTCHART, // plotType - NULL, // plotGrouping (Donut charts don't have any grouping) - range(0, count($dataSeriesValues2)-1), // plotOrder - $dataSeriesLabels2, // plotLabel - $xAxisTickValues2, // plotCategory - $dataSeriesValues2 // plotValues -); - -// Set up a layout object for the Pie chart -$layout2 = new \PHPExcel\Chart\Layout(); -$layout2->setShowVal(TRUE); -$layout2->setShowCatName(TRUE); - -// Set the series in the plot area -$plotArea2 = new \PHPExcel\Chart\PlotArea($layout2, array($series2)); - -$title2 = new \PHPExcel\Chart\Title('Test Donut Chart'); - - -// Create the chart -$chart2 = new \PHPExcel\Chart( - 'chart2', // name - $title2, // title - NULL, // legend - $plotArea2, // plotArea - true, // plotVisibleOnly - 0, // displayBlanksAs - NULL, // xAxisLabel - NULL // yAxisLabel - Like Pie charts, Donut charts don't have a Y-Axis -); - -// Set the position where the chart should appear in the worksheet -$chart2->setTopLeftPosition('I7'); -$chart2->setBottomRightPosition('P20'); - -// Add the chart to the worksheet -$objWorksheet->addChart($chart2); - - -// Save Excel 2007 file -echo date('H:i:s') , " Write to Excel2007 format" , EOL; -$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007'); -$objWriter->setIncludeCharts(TRUE); -$objWriter->save(str_replace('.php', '.xlsx', __FILE__)); -echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; - - -// Echo memory peak usage -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; - -// Echo done -echo date('H:i:s') , " Done writing file" , EOL; -echo 'File has been created in ' , getcwd() , EOL; diff --git a/Examples/33chartcreate-radar.php b/Examples/33chartcreate-radar.php deleted file mode 100644 index 216dc223..00000000 --- a/Examples/33chartcreate-radar.php +++ /dev/null @@ -1,155 +0,0 @@ -'); - -date_default_timezone_set('Europe/London'); - -/** - * PHPExcel - * - * Copyright (c) 2006 - 2015 PHPExcel - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * @category PHPExcel - * @package PHPExcel - * @copyright Copyright (c) 2006 - 2015 PHPExcel (https://github.com/PHPOffice/PhpSpreadsheet) - * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version ##VERSION##, ##DATE## - */ - -/** PHPExcel */ -require_once dirname(__FILE__) . '/../src/Bootstrap.php'; - - -$objPHPExcel = new \PHPExcel\Spreadsheet(); -$objWorksheet = $objPHPExcel->getActiveSheet(); -$objWorksheet->fromArray( - array( - array('', 2010, 2011, 2012), - array('Jan', 47, 45, 71), - array('Feb', 56, 73, 86), - array('Mar', 52, 61, 69), - array('Apr', 40, 52, 60), - array('May', 42, 55, 71), - array('Jun', 58, 63, 76), - array('Jul', 53, 61, 89), - array('Aug', 46, 69, 85), - array('Sep', 62, 75, 81), - array('Oct', 51, 70, 96), - array('Nov', 55, 66, 89), - array('Dec', 68, 62, 0), - ) -); - - -// Set the Labels for each data series we want to plot -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$dataSeriesLabels = array( - new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$C$1', NULL, 1), // 2011 - new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$D$1', NULL, 1), // 2012 -); -// Set the X-Axis Labels -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$xAxisTickValues = array( - new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$13', NULL, 12), // Jan to Dec - new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$13', NULL, 12), // Jan to Dec -); -// Set the Data values for each data series we want to plot -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$dataSeriesValues = array( - new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$13', NULL, 12), - new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$D$2:$D$13', NULL, 12), -); - -// Build the dataseries -$series = new \PHPExcel\Chart\DataSeries( - \PHPExcel\Chart\DataSeries::TYPE_RADARCHART, // plotType - NULL, // plotGrouping (Radar charts don't have any grouping) - range(0, count($dataSeriesValues)-1), // plotOrder - $dataSeriesLabels, // plotLabel - $xAxisTickValues, // plotCategory - $dataSeriesValues, // plotValues - NULL, // plotDirection - NULL, // smooth line - \PHPExcel\Chart\DataSeries::STYLE_MARKER // plotStyle -); - -// Set up a layout object for the Pie chart -$layout = new \PHPExcel\Chart\Layout(); - -// Set the series in the plot area -$plotArea = new \PHPExcel\Chart\PlotArea($layout, array($series)); -// Set the chart legend -$legend = new \PHPExcel\Chart\Legend(\PHPExcel\Chart\Legend::POSITION_RIGHT, NULL, false); - -$title = new \PHPExcel\Chart\Title('Test Radar Chart'); - - -// Create the chart -$chart = new \PHPExcel\Chart( - 'chart1', // name - $title, // title - $legend, // legend - $plotArea, // plotArea - true, // plotVisibleOnly - 0, // displayBlanksAs - NULL, // xAxisLabel - NULL // yAxisLabel - Radar charts don't have a Y-Axis -); - -// Set the position where the chart should appear in the worksheet -$chart->setTopLeftPosition('F2'); -$chart->setBottomRightPosition('M15'); - -// Add the chart to the worksheet -$objWorksheet->addChart($chart); - - -// Save Excel 2007 file -echo date('H:i:s') , " Write to Excel2007 format" , EOL; -$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007'); -$objWriter->setIncludeCharts(TRUE); -$objWriter->save(str_replace('.php', '.xlsx', __FILE__)); -echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; - - -// Echo memory peak usage -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; - -// Echo done -echo date('H:i:s') , " Done writing file" , EOL; -echo 'File has been created in ' , getcwd() , EOL; diff --git a/Examples/33chartcreate-scatter.php b/Examples/33chartcreate-scatter.php deleted file mode 100644 index 299c9ca2..00000000 --- a/Examples/33chartcreate-scatter.php +++ /dev/null @@ -1,139 +0,0 @@ -'); - -date_default_timezone_set('Europe/London'); - -/** - * PHPExcel - * - * Copyright (c) 2006 - 2015 PHPExcel - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * @category PHPExcel - * @package PHPExcel - * @copyright Copyright (c) 2006 - 2015 PHPExcel (https://github.com/PHPOffice/PhpSpreadsheet) - * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version ##VERSION##, ##DATE## - */ - -/** PHPExcel */ -require_once dirname(__FILE__) . '/../src/Bootstrap.php'; - - -$objPHPExcel = new \PHPExcel\Spreadsheet(); -$objWorksheet = $objPHPExcel->getActiveSheet(); -$objWorksheet->fromArray( - array( - array('', 2010, 2011, 2012), - array('Q1', 12, 15, 21), - array('Q2', 56, 73, 86), - array('Q3', 52, 61, 69), - array('Q4', 30, 32, 0), - ) -); - -// Set the Labels for each data series we want to plot -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$dataSeriesLabels = array( - new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$B$1', NULL, 1), // 2010 - new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$C$1', NULL, 1), // 2011 - new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$D$1', NULL, 1), // 2012 -); -// Set the X-Axis Labels -$xAxisTickValues = array( - new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$5', NULL, 4), // Q1 to Q4 -); -// Set the Data values for each data series we want to plot -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$dataSeriesValues = array( - new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$B$2:$B$5', NULL, 4), - new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', NULL, 4), - new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$D$2:$D$5', NULL, 4), -); - -// Build the dataseries -$series = new \PHPExcel\Chart\DataSeries( - \PHPExcel\Chart\DataSeries::TYPE_SCATTERCHART, // plotType - NULL, // plotGrouping (Scatter charts don't have any grouping) - range(0, count($dataSeriesValues)-1), // plotOrder - $dataSeriesLabels, // plotLabel - $xAxisTickValues, // plotCategory - $dataSeriesValues, // plotValues - NULL, // plotDirection - NULL, // smooth line - \PHPExcel\Chart\DataSeries::STYLE_LINEMARKER // plotStyle -); - -// Set the series in the plot area -$plotArea = new \PHPExcel\Chart\PlotArea(NULL, array($series)); -// Set the chart legend -$legend = new \PHPExcel\Chart\Legend(\PHPExcel\Chart\Legend::POSITION_TOPRIGHT, NULL, false); - -$title = new \PHPExcel\Chart\Title('Test Scatter Chart'); -$yAxisLabel = new \PHPExcel\Chart\Title('Value ($k)'); - - -// Create the chart -$chart = new \PHPExcel\Chart( - 'chart1', // name - $title, // title - $legend, // legend - $plotArea, // plotArea - true, // plotVisibleOnly - 0, // displayBlanksAs - NULL, // xAxisLabel - $yAxisLabel // yAxisLabel -); - -// Set the position where the chart should appear in the worksheet -$chart->setTopLeftPosition('A7'); -$chart->setBottomRightPosition('H20'); - -// Add the chart to the worksheet -$objWorksheet->addChart($chart); - - -// Save Excel 2007 file -echo date('H:i:s') , " Write to Excel2007 format" , EOL; -$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007'); -$objWriter->setIncludeCharts(TRUE); -$objWriter->save(str_replace('.php', '.xlsx', __FILE__)); -echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; - - -// Echo memory peak usage -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; - -// Echo done -echo date('H:i:s') , " Done writing file" , EOL; -echo 'File has been created in ' , getcwd() , EOL; diff --git a/Examples/33chartcreate-stock.php b/Examples/33chartcreate-stock.php deleted file mode 100644 index fc2ba5c6..00000000 --- a/Examples/33chartcreate-stock.php +++ /dev/null @@ -1,151 +0,0 @@ -'); - -date_default_timezone_set('Europe/London'); - -/** - * PHPExcel - * - * Copyright (c) 2006 - 2015 PHPExcel - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * @category PHPExcel - * @package PHPExcel - * @copyright Copyright (c) 2006 - 2015 PHPExcel (https://github.com/PHPOffice/PhpSpreadsheet) - * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version ##VERSION##, ##DATE## - */ - -/** PHPExcel */ -require_once dirname(__FILE__) . '/../src/Bootstrap.php'; - - -$objPHPExcel = new \PHPExcel\Spreadsheet(); -$objWorksheet = $objPHPExcel->getActiveSheet(); -$objWorksheet->fromArray( - array( - array('Counts', 'Max', 'Min', 'Min Threshold', 'Max Threshold' ), - array(10, 10, 5, 0, 50 ), - array(30, 20, 10, 0, 50 ), - array(20, 30, 15, 0, 50 ), - array(40, 10, 0, 0, 50 ), - array(100, 40, 5, 0, 50 ), - ), null, 'A1', true -); -$objWorksheet->getStyle('B2:E6')->getNumberFormat()->setFormatCode(PHPExcel\Style\NumberFormat::FORMAT_NUMBER_00); - - -// Set the Labels for each data series we want to plot -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$dataSeriesLabels = array( - new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$B$1', NULL, 1), //Max / Open - new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$C$1', NULL, 1), //Min / Close - new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$D$1', NULL, 1), //Min Threshold / Min - new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$E$1', NULL, 1), //Max Threshold / Max -); -// Set the X-Axis Labels -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$xAxisTickValues = array( - new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$6', NULL, 5), // Counts -); -// Set the Data values for each data series we want to plot -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$dataSeriesValues = array( - new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$B$2:$B$6', NULL, 5), - new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$6', NULL, 5), - new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$D$2:$D$6', NULL, 5), - new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$E$2:$E$6', NULL, 5), -); - -// Build the dataseries -$series = new \PHPExcel\Chart\DataSeries( - \PHPExcel\Chart\DataSeries::TYPE_STOCKCHART, // plotType - null, // plotGrouping - if we set this to not null, then xlsx throws error - range(0, count($dataSeriesValues)-1), // plotOrder - $dataSeriesLabels, // plotLabel - $xAxisTickValues, // plotCategory - $dataSeriesValues // plotValues -); - -// Set the series in the plot area -$plotArea = new \PHPExcel\Chart\PlotArea(NULL, array($series)); -// Set the chart legend -$legend = new \PHPExcel\Chart\Legend(\PHPExcel\Chart\Legend::POSITION_RIGHT, NULL, false); - -$title = new \PHPExcel\Chart\Title('Test Stock Chart'); -$xAxisLabel = new \PHPExcel\Chart\Title('Counts'); -$yAxisLabel = new \PHPExcel\Chart\Title('Values'); - -// Create the chart -$chart = new \PHPExcel\Chart( - 'stock-chart', // name - $title, // title - $legend, // legend - $plotArea, // plotArea - true, // plotVisibleOnly - 0, // displayBlanksAs - $xAxisLabel, // xAxisLabel - $yAxisLabel // yAxisLabel -); - -// Set the position where the chart should appear in the worksheet -$chart->setTopLeftPosition('A7'); -$chart->setBottomRightPosition('H20'); - -// Add the chart to the worksheet -$objWorksheet->addChart($chart); - - -// Save Excel 2007 file -echo date('H:i:s') , " Write to Excel2007 format" , EOL; -$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007'); -$objWriter->setIncludeCharts(TRUE); -$filename = str_replace('.php', '.xlsx', __FILE__); -if(file_exists($filename)) { - unlink($filename); -} -$objWriter->save($filename); -echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; - - -// Echo memory peak usage -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; - -// Echo done -echo date('H:i:s') , " Done writing file" , EOL; -echo 'File has been created in ' , getcwd() , EOL; diff --git a/Examples/34chartupdate.php b/Examples/34chartupdate.php deleted file mode 100644 index 94ed373e..00000000 --- a/Examples/34chartupdate.php +++ /dev/null @@ -1,78 +0,0 @@ -'); - -date_default_timezone_set('Europe/London'); - -/** - * PHPExcel - * - * Copyright (c) 2006 - 2015 PHPExcel - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * @category PHPExcel - * @package PHPExcel - * @copyright Copyright (c) 2006 - 2015 PHPExcel (https://github.com/PHPOffice/PhpSpreadsheet) - * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version ##VERSION##, ##DATE## - */ - -/** PHPExcel */ -require_once dirname(__FILE__) . '/../src/Bootstrap.php'; - -if (!file_exists("33chartcreate-bar.xlsx")) { - exit("Please run 33chartcreate-bar.php first." . EOL); -} - -echo date('H:i:s') , " Load from Excel2007 file" , EOL; -$objReader = \PHPExcel\IOFactory::createReader("Excel2007"); -$objReader->setIncludeCharts(TRUE); -$objPHPExcel = $objReader->load("33chartcreate-bar.xlsx"); - - -echo date('H:i:s') , " Update cell data values that are displayed in the chart" , EOL; -$objWorksheet = $objPHPExcel->getActiveSheet(); -$objWorksheet->fromArray( - array( - array(50-12, 50-15, 50-21), - array(50-56, 50-73, 50-86), - array(50-52, 50-61, 50-69), - array(50-30, 50-32, 50), - ), - NULL, - 'B2' -); - -// Save Excel 2007 file -echo date('H:i:s') , " Write to Excel2007 format" , EOL; -$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007'); -$objWriter->setIncludeCharts(TRUE); -$objWriter->save(str_replace('.php', '.xlsx', __FILE__)); -echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; - - -// Echo memory peak usage -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; - -// Echo done -echo date('H:i:s') , " Done writing file" , EOL; -echo 'File has been created in ' , getcwd() , EOL; diff --git a/Examples/35chartrender.php b/Examples/35chartrender.php deleted file mode 100644 index 26b591c7..00000000 --- a/Examples/35chartrender.php +++ /dev/null @@ -1,105 +0,0 @@ -'); - -date_default_timezone_set('Europe/London'); - -/** PHPExcel */ -require_once dirname(__FILE__) . '/../src/Bootstrap.php'; - - -// Change these values to select the Rendering library that you wish to use -// and its directory location on your server -$rendererName = PHPExcel\Settings::CHART_RENDERER_JPGRAPH; -$rendererLibrary = 'jpgraph3.5.0b1/src/'; -$rendererLibraryPath = '/php/libraries/Charts/' . $rendererLibrary; - - -if (!PHPExcel\Settings::setChartRenderer( - $rendererName, - $rendererLibraryPath - )) { - die( - 'NOTICE: Please set the $rendererName and $rendererLibraryPath values' . - EOL . - 'at the top of this script as appropriate for your directory structure' - ); -} - - -$inputFileType = 'Excel2007'; -$inputFileNames = 'templates/32readwrite*[0-9].xlsx'; - - if ((isset($argc)) && ($argc > 1)) { - $inputFileNames = array(); - for($i = 1; $i < $argc; ++$i) { - $inputFileNames[] = dirname(__FILE__) . '/templates/' . $argv[$i]; - } -} else { - $inputFileNames = glob($inputFileNames); -} -foreach($inputFileNames as $inputFileName) { - $inputFileNameShort = basename($inputFileName); - - if (!file_exists($inputFileName)) { - echo date('H:i:s') , " File " , $inputFileNameShort , ' does not exist' , EOL; - continue; - } - - echo date('H:i:s') , " Load Test from $inputFileType file " , $inputFileNameShort , EOL; - - $objReader = \PHPExcel\IOFactory::createReader($inputFileType); - $objReader->setIncludeCharts(TRUE); - $objPHPExcel = $objReader->load($inputFileName); - - - echo date('H:i:s') , " Iterate worksheets looking at the charts" , EOL; - foreach ($objPHPExcel->getWorksheetIterator() as $worksheet) { - $sheetName = $worksheet->getTitle(); - echo 'Worksheet: ' , $sheetName , EOL; - - $chartNames = $worksheet->getChartNames(); - if(empty($chartNames)) { - echo ' There are no charts in this worksheet' , EOL; - } else { - natsort($chartNames); - foreach($chartNames as $i => $chartName) { - $chart = $worksheet->getChartByName($chartName); - if (!is_null($chart->getTitle())) { - $caption = '"' . implode(' ',$chart->getTitle()->getCaption()) . '"'; - } else { - $caption = 'Untitled'; - } - echo ' ' , $chartName , ' - ' , $caption , EOL; - echo str_repeat(' ',strlen($chartName)+3); - - $jpegFile = '35'.str_replace('.xlsx', '.jpg', substr($inputFileNameShort,2)); - if (file_exists($jpegFile)) { - unlink($jpegFile); - } - try { - $chart->render($jpegFile); - } catch (Exception $e) { - echo 'Error rendering chart: ',$e->getMessage(); - } - } - } - } - - - $objPHPExcel->disconnectWorksheets(); - unset($objPHPExcel); -} - -// Echo memory peak usage -echo date('H:i:s') , ' Peak memory usage: ' , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; - -// Echo done -echo date('H:i:s') , " Done rendering charts as images" , EOL; -echo 'Image files have been created in ' , getcwd() , EOL; diff --git a/Examples/36chartreadwriteHTML.php b/Examples/36chartreadwriteHTML.php deleted file mode 100644 index 4eb8db17..00000000 --- a/Examples/36chartreadwriteHTML.php +++ /dev/null @@ -1,122 +0,0 @@ -'); - -date_default_timezone_set('Europe/London'); - -/** Include PHPExcel */ -require_once dirname(__FILE__) . '/../src/Bootstrap.php'; - - -// Change these values to select the Rendering library that you wish to use -// and its directory location on your server -$rendererName = PHPExcel\Settings::CHART_RENDERER_JPGRAPH; -$rendererLibrary = 'jpgraph3.5.0b1/src/'; -$rendererLibraryPath = '/php/libraries/Charts/' . $rendererLibrary; - - -if (!PHPExcel\Settings::setChartRenderer( - $rendererName, - $rendererLibraryPath - )) { - die( - 'NOTICE: Please set the $rendererName and $rendererLibraryPath values' . - EOL . - 'at the top of this script as appropriate for your directory structure' - ); -} - - -$inputFileType = 'Excel2007'; -$inputFileNames = 'templates/36write*.xlsx'; - -if ((isset($argc)) && ($argc > 1)) { - $inputFileNames = array(); - for($i = 1; $i < $argc; ++$i) { - $inputFileNames[] = dirname(__FILE__) . '/templates/' . $argv[$i]; - } -} else { - $inputFileNames = glob($inputFileNames); -} -foreach($inputFileNames as $inputFileName) { - $inputFileNameShort = basename($inputFileName); - - if (!file_exists($inputFileName)) { - echo date('H:i:s') , " File " , $inputFileNameShort , ' does not exist' , EOL; - continue; - } - - echo date('H:i:s') , " Load Test from $inputFileType file " , $inputFileNameShort , EOL; - - $objReader = \PHPExcel\IOFactory::createReader($inputFileType); - $objReader->setIncludeCharts(TRUE); - $objPHPExcel = $objReader->load($inputFileName); - - - echo date('H:i:s') , " Iterate worksheets looking at the charts" , EOL; - foreach ($objPHPExcel->getWorksheetIterator() as $worksheet) { - $sheetName = $worksheet->getTitle(); - echo 'Worksheet: ' , $sheetName , EOL; - - $chartNames = $worksheet->getChartNames(); - if(empty($chartNames)) { - echo ' There are no charts in this worksheet' , EOL; - } else { - natsort($chartNames); - foreach($chartNames as $i => $chartName) { - $chart = $worksheet->getChartByName($chartName); - if (!is_null($chart->getTitle())) { - $caption = '"' . implode(' ',$chart->getTitle()->getCaption()) . '"'; - } else { - $caption = 'Untitled'; - } - echo ' ' , $chartName , ' - ' , $caption , EOL; - echo str_repeat(' ',strlen($chartName)+3); - $groupCount = $chart->getPlotArea()->getPlotGroupCount(); - if ($groupCount == 1) { - $chartType = $chart->getPlotArea()->getPlotGroupByIndex(0)->getPlotType(); - echo ' ' , $chartType , EOL; - } else { - $chartTypes = array(); - for($i = 0; $i < $groupCount; ++$i) { - $chartTypes[] = $chart->getPlotArea()->getPlotGroupByIndex($i)->getPlotType(); - } - $chartTypes = array_unique($chartTypes); - if (count($chartTypes) == 1) { - $chartType = 'Multiple Plot ' . array_pop($chartTypes); - echo ' ' , $chartType , EOL; - } elseif (count($chartTypes) == 0) { - echo ' *** Type not yet implemented' , EOL; - } else { - echo ' Combination Chart' , EOL; - } - } - } - } - } - - - $outputFileName = str_replace('.xlsx', '.html', basename($inputFileName)); - - echo date('H:i:s') , " Write Tests to HTML file " , EOL; - $objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'HTML'); - $objWriter->setIncludeCharts(TRUE); - $objWriter->save($outputFileName); - echo date('H:i:s') , " File written to " , $outputFileName , EOL; - - $objPHPExcel->disconnectWorksheets(); - unset($objPHPExcel); -} - -// Echo memory peak usage -echo date('H:i:s') , ' Peak memory usage: ' , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; - -// Echo done -echo date('H:i:s') , " Done writing files" , EOL; -echo 'Files have been created in ' , getcwd() , EOL; diff --git a/Examples/36chartreadwritePDF.php b/Examples/36chartreadwritePDF.php deleted file mode 100644 index 8e47859d..00000000 --- a/Examples/36chartreadwritePDF.php +++ /dev/null @@ -1,145 +0,0 @@ -'); - -date_default_timezone_set('Europe/London'); - -/** Include PHPExcel */ -require_once dirname(__FILE__) . '/../src/Bootstrap.php'; - - -// Change these values to select the Rendering library that you wish to use -// for PDF files, and its directory location on your server -//$rendererName = PHPExcel\Settings::PDF_RENDERER_TCPDF; -$rendererName = PHPExcel\Settings::PDF_RENDERER_MPDF; -//$rendererName = PHPExcel\Settings::PDF_RENDERER_DOMPDF; -//$rendererLibrary = 'tcPDF5.9'; -$rendererLibrary = 'mPDF5.4'; -//$rendererLibrary = 'domPDF0.6.0beta3'; -$rendererLibraryPath = '/php/libraries/PDF/' . $rendererLibrary; - - -if (!PHPExcel\Settings::setPdfRenderer( - $rendererName, - $rendererLibraryPath - )) { - die( - 'NOTICE: Please set the $rendererName and $rendererLibraryPath values' . - EOL . - 'at the top of this script as appropriate for your directory structure' - ); -} - - -// Change these values to select the Rendering library that you wish to use -// for Chart images, and its directory location on your server -$rendererName = PHPExcel\Settings::CHART_RENDERER_JPGRAPH; -$rendererLibrary = 'jpgraph3.5.0b1/src/'; -$rendererLibraryPath = '/php/libraries/Charts/' . $rendererLibrary; - - -if (!PHPExcel\Settings::setChartRenderer( - $rendererName, - $rendererLibraryPath - )) { - die( - 'NOTICE: Please set the $rendererName and $rendererLibraryPath values' . - EOL . - 'at the top of this script as appropriate for your directory structure' - ); -} - - -$inputFileType = 'Excel2007'; -$inputFileNames = 'templates/36write*.xlsx'; - -if ((isset($argc)) && ($argc > 1)) { - $inputFileNames = array(); - for($i = 1; $i < $argc; ++$i) { - $inputFileNames[] = dirname(__FILE__) . '/templates/' . $argv[$i]; - } -} else { - $inputFileNames = glob($inputFileNames); -} -foreach($inputFileNames as $inputFileName) { - $inputFileNameShort = basename($inputFileName); - - if (!file_exists($inputFileName)) { - echo date('H:i:s') , " File " , $inputFileNameShort , ' does not exist' , EOL; - continue; - } - - echo date('H:i:s') , " Load Test from $inputFileType file " , $inputFileNameShort , EOL; - - $objReader = \PHPExcel\IOFactory::createReader($inputFileType); - $objReader->setIncludeCharts(TRUE); - $objPHPExcel = $objReader->load($inputFileName); - - - echo date('H:i:s') , " Iterate worksheets looking at the charts" , EOL; - foreach ($objPHPExcel->getWorksheetIterator() as $worksheet) { - $sheetName = $worksheet->getTitle(); - echo 'Worksheet: ' , $sheetName , EOL; - - $chartNames = $worksheet->getChartNames(); - if(empty($chartNames)) { - echo ' There are no charts in this worksheet' , EOL; - } else { - natsort($chartNames); - foreach($chartNames as $i => $chartName) { - $chart = $worksheet->getChartByName($chartName); - if (!is_null($chart->getTitle())) { - $caption = '"' . implode(' ',$chart->getTitle()->getCaption()) . '"'; - } else { - $caption = 'Untitled'; - } - echo ' ' , $chartName , ' - ' , $caption , EOL; - echo str_repeat(' ',strlen($chartName)+3); - $groupCount = $chart->getPlotArea()->getPlotGroupCount(); - if ($groupCount == 1) { - $chartType = $chart->getPlotArea()->getPlotGroupByIndex(0)->getPlotType(); - echo ' ' , $chartType , EOL; - } else { - $chartTypes = array(); - for($i = 0; $i < $groupCount; ++$i) { - $chartTypes[] = $chart->getPlotArea()->getPlotGroupByIndex($i)->getPlotType(); - } - $chartTypes = array_unique($chartTypes); - if (count($chartTypes) == 1) { - $chartType = 'Multiple Plot ' . array_pop($chartTypes); - echo ' ' , $chartType , EOL; - } elseif (count($chartTypes) == 0) { - echo ' *** Type not yet implemented' , EOL; - } else { - echo ' Combination Chart' , EOL; - } - } - } - } - } - - - $outputFileName = str_replace('.xlsx', '.pdf', basename($inputFileName)); - - echo date('H:i:s') , " Write Tests to HTML file " , EOL; - $objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'PDF'); - $objWriter->setIncludeCharts(TRUE); - $objWriter->save($outputFileName); - echo date('H:i:s') , " File written to " , $outputFileName , EOL; - - $objPHPExcel->disconnectWorksheets(); - unset($objPHPExcel); -} - -// Echo memory peak usage -echo date('H:i:s') , ' Peak memory usage: ' , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; - -// Echo done -echo date('H:i:s') , " Done writing files" , EOL; -echo 'Files have been created in ' , getcwd() , EOL; diff --git a/Examples/37page_layout_view.php b/Examples/37page_layout_view.php deleted file mode 100644 index 4e121cd9..00000000 --- a/Examples/37page_layout_view.php +++ /dev/null @@ -1,83 +0,0 @@ -'); - -/** Include PHPExcel */ -require_once dirname(__FILE__) . '/../src/Bootstrap.php'; - - -// Create new PHPExcel object -echo date('H:i:s') , " Create new PHPExcel object" , EOL; -$objPHPExcel = new \PHPExcel\Spreadsheet(); - -// Set document properties -echo date('H:i:s') , " Set document properties" , EOL; -$objPHPExcel->getProperties()->setCreator("PHPOffice") - ->setLastModifiedBy("PHPOffice") - ->setTitle("PHPExcel Test Document") - ->setSubject("PHPExcel Test Document") - ->setDescription("Test document for PHPExcel, generated using PHP classes.") - ->setKeywords("Office PHPExcel php") - ->setCategory("Test result file"); - - -// Add some data -echo date('H:i:s') , " Add some data" , EOL; -$objPHPExcel->setActiveSheetIndex(0) - ->setCellValue('A1', 'Hello') - ->setCellValue('B2', 'world!'); - -// Set active sheet index to the first sheet, so Excel opens this as the first sheet -$objPHPExcel->setActiveSheetIndex(0); - -// Set the page layout view as page layout -$objPHPExcel->getActiveSheet()->getSheetView()->setView(PHPExcel\Worksheet\SheetView::SHEETVIEW_PAGE_LAYOUT); - -// Save Excel 2007 file -echo date('H:i:s') , " Write to Excel2007 format" , EOL; -$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007'); -$objWriter->save(str_replace('.php', '.xlsx', __FILE__)); -echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; -// Save Excel5 file -echo date('H:i:s') , " Write to Excel5 format" , EOL; -$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel5'); -$objWriter->save(str_replace('.php', '.xls', __FILE__)); -echo date('H:i:s') , " File written to " , str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; - -// Echo memory peak usage -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; - -// Echo done -echo date('H:i:s') , " Done writing files" , EOL; -echo 'Files have been created in ' , getcwd() , EOL; diff --git a/Examples/38cloneWorksheet.php b/Examples/38cloneWorksheet.php deleted file mode 100644 index 5e84d80a..00000000 --- a/Examples/38cloneWorksheet.php +++ /dev/null @@ -1,118 +0,0 @@ -'); - -/** Include PHPExcel */ -require_once dirname(__FILE__) . '/../src/Bootstrap.php'; - - -// Create new PHPExcel object -echo date('H:i:s') , " Create new PHPExcel object" , EOL; -$objPHPExcel = new \PHPExcel\Spreadsheet(); - -// Set document properties -echo date('H:i:s') , " Set document properties" , EOL; -$objPHPExcel->getProperties()->setCreator("Maarten Balliauw") - ->setLastModifiedBy("Maarten Balliauw") - ->setTitle("PHPExcel Test Document") - ->setSubject("PHPExcel Test Document") - ->setDescription("Test document for PHPExcel, generated using PHP classes.") - ->setKeywords("office PHPExcel php") - ->setCategory("Test result file"); - - -// Add some data -echo date('H:i:s') , " Add some data" , EOL; -$objPHPExcel->setActiveSheetIndex(0) - ->setCellValue('A1', 'Hello') - ->setCellValue('B2', 'world!') - ->setCellValue('C1', 'Hello') - ->setCellValue('D2', 'world!'); - -// Miscellaneous glyphs, UTF-8 -$objPHPExcel->setActiveSheetIndex(0) - ->setCellValue('A4', 'Miscellaneous glyphs') - ->setCellValue('A5', 'éàèùâêîôûëïüÿäöüç'); - - -$objPHPExcel->getActiveSheet()->setCellValue('A8',"Hello\nWorld"); -$objPHPExcel->getActiveSheet()->getRowDimension(8)->setRowHeight(-1); -$objPHPExcel->getActiveSheet()->getStyle('A8')->getAlignment()->setWrapText(true); - - -// Rename worksheet -echo date('H:i:s') , " Rename worksheet" , EOL; -$objPHPExcel->getActiveSheet()->setTitle('Simple'); - - -// Clone worksheet -echo date('H:i:s') , " Clone worksheet" , EOL; -$clonedSheet = clone $objPHPExcel->getActiveSheet(); -$clonedSheet - ->setCellValue('A1', 'Goodbye') - ->setCellValue('A2', 'cruel') - ->setCellValue('C1', 'Goodbye') - ->setCellValue('C2', 'cruel'); - -// Rename cloned worksheet -echo date('H:i:s') , " Rename cloned worksheet" , EOL; -$clonedSheet->setTitle('Simple Clone'); -$objPHPExcel->addSheet($clonedSheet); - - -// Set active sheet index to the first sheet, so Excel opens this as the first sheet -$objPHPExcel->setActiveSheetIndex(0); - - -// Save Excel 2007 file -echo date('H:i:s') , " Write to Excel2007 format" , EOL; -$callStartTime = microtime(true); - -$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007'); -$objWriter->save(str_replace('.php', '.xlsx', __FILE__)); -$callEndTime = microtime(true); -$callTime = $callEndTime - $callStartTime; - -echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; -echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; -// Echo memory usage -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; - - -// Echo memory peak usage -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; - -// Echo done -echo date('H:i:s') , " Done writing files" , EOL; -echo 'File has been created in ' , getcwd() , EOL; diff --git a/Examples/39dropdown.php b/Examples/39dropdown.php deleted file mode 100644 index f7068be0..00000000 --- a/Examples/39dropdown.php +++ /dev/null @@ -1,175 +0,0 @@ -'); - -/** Include PHPExcel */ -require_once dirname(__FILE__) . '/../src/Bootstrap.php'; - - -// Create new PHPExcel object -echo date('H:i:s') , " Create new PHPExcel object" , EOL; -$objPHPExcel = new \PHPExcel\Spreadsheet(); - -// Set document properties -echo date('H:i:s') , " Set document properties" , EOL; -$objPHPExcel->getProperties() - ->setCreator("PHPOffice") - ->setLastModifiedBy("PHPOffice") - ->setTitle("PHPExcel Test Document") - ->setSubject("PHPExcel Test Document") - ->setDescription("Test document for PHPExcel, generated using PHP classes.") - ->setKeywords("Office PHPExcel php") - ->setCategory("Test result file"); - - -function transpose($value) { - return array($value); -} - -// Add some data -$continentColumn = 'D'; -$column = 'F'; - -// Set data for dropdowns -foreach(glob('./data/continents/*') as $key => $filename) { - $continent = pathinfo($filename, PATHINFO_FILENAME); - echo "Loading $continent", EOL; - $continent = str_replace(' ','_',$continent); - $countries = file($filename, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); - $countryCount = count($countries); - - // Transpose $countries from a row to a column array - $countries = array_map('transpose', $countries); - $objPHPExcel->getActiveSheet() - ->fromArray($countries, null, $column . '1'); - $objPHPExcel->addNamedRange( - new PHPExcel\NamedRange( - $continent, - $objPHPExcel->getActiveSheet(), $column . '1:' . $column . $countryCount - ) - ); - $objPHPExcel->getActiveSheet() - ->getColumnDimension($column) - ->setVisible(false); - - $objPHPExcel->getActiveSheet() - ->setCellValue($continentColumn . ($key+1), $continent); - - ++$column; -} - -// Hide the dropdown data -$objPHPExcel->getActiveSheet() - ->getColumnDimension($continentColumn) - ->setVisible(false); - -$objPHPExcel->addNamedRange( - new PHPExcel\NamedRange( - 'Continents', - $objPHPExcel->getActiveSheet(), $continentColumn . '1:' . $continentColumn . ($key+1) - ) -); - - -// Set selection cells -$objPHPExcel->getActiveSheet() - ->setCellValue('A1', 'Continent:'); -$objPHPExcel->getActiveSheet() - ->setCellValue('B1', 'Select continent'); -$objPHPExcel->getActiveSheet() - ->setCellValue('B3', '=' . $column . 1); -$objPHPExcel->getActiveSheet() - ->setCellValue('B3', 'Select country'); -$objPHPExcel->getActiveSheet() - ->getStyle('A1:A3') - ->getFont()->setBold(true); - -// Set linked validators -$objValidation = $objPHPExcel->getActiveSheet() - ->getCell('B1') - ->getDataValidation(); -$objValidation->setType( PHPExcel\Cell\DataValidation::TYPE_LIST ) - ->setErrorStyle( PHPExcel\Cell\DataValidation::STYLE_INFORMATION ) - ->setAllowBlank(false) - ->setShowInputMessage(true) - ->setShowErrorMessage(true) - ->setShowDropDown(true) - ->setErrorTitle('Input error') - ->setError('Continent is not in the list.') - ->setPromptTitle('Pick from the list') - ->setPrompt('Please pick a continent from the drop-down list.') - ->setFormula1('=Continents'); - -$objPHPExcel->getActiveSheet() - ->setCellValue('A3', 'Country:'); -$objPHPExcel->getActiveSheet() - ->getStyle('A3') - ->getFont()->setBold(true); - -$objValidation = $objPHPExcel->getActiveSheet() - ->getCell('B3') - ->getDataValidation(); -$objValidation->setType( PHPExcel\Cell\DataValidation::TYPE_LIST ) - ->setErrorStyle( PHPExcel\Cell\DataValidation::STYLE_INFORMATION ) - ->setAllowBlank(false) - ->setShowInputMessage(true) - ->setShowErrorMessage(true) - ->setShowDropDown(true) - ->setErrorTitle('Input error') - ->setError('Country is not in the list.') - ->setPromptTitle('Pick from the list') - ->setPrompt('Please pick a country from the drop-down list.') - ->setFormula1('=INDIRECT($B$1)'); - - -$objPHPExcel->getActiveSheet()->getColumnDimension('A')->setWidth(12); -$objPHPExcel->getActiveSheet()->getColumnDimension('B')->setWidth(30); - - -// Set active sheet index to the first sheet, so Excel opens this as the first sheet -$objPHPExcel->setActiveSheetIndex(0); - -// Save Excel 2007 file -// This linked validation list method only seems to work for Excel2007, not for Excel5 -echo date('H:i:s') , " Write to Excel2007 format" , EOL; -$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007'); -$objWriter->save(str_replace('.php', '.xlsx', __FILE__)); -echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; - -// Echo memory peak usage -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; - -// Echo done -echo date('H:i:s') , " Done writing files" , EOL; -echo 'Files have been created in ' , getcwd() , EOL; diff --git a/Examples/40duplicateStyle.php b/Examples/40duplicateStyle.php deleted file mode 100644 index 28439b12..00000000 --- a/Examples/40duplicateStyle.php +++ /dev/null @@ -1,51 +0,0 @@ -'); - -date_default_timezone_set('Europe/London'); - -/** Include PHPExcel */ -require_once dirname(__FILE__) . '/../src/Bootstrap.php'; - -echo date('H:i:s') , " Create new PHPExcel object" , EOL; -$objPHPExcel = new \PHPExcel\Spreadsheet(); -$worksheet = $objPHPExcel->getActiveSheet(); - -echo date('H:i:s') , " Create styles array" , EOL; -$styles = array(); -for ($i = 0; $i < 10; $i++) { - $style = new \PHPExcel\Style(); - $style->getFont()->setSize($i + 4); - $styles[] = $style; -} - -echo date('H:i:s') , " Add data (begin)" , EOL; -$t = microtime(true); -for ($col = 0; $col < 50; $col++) { - for ($row = 0; $row < 100; $row++) { - $str = ($row + $col); - $style = $styles[$row % 10]; - $coord = \PHPExcel\Cell::stringFromColumnIndex($col) . ($row + 1); - $worksheet->setCellValue($coord, $str); - $worksheet->duplicateStyle($style, $coord); - } -} -$d = microtime(true) - $t; -echo date('H:i:s') , " Add data (end), time: " . round($d, 2) . " s", EOL; - - -echo date('H:i:s') , " Write to Excel2007 format" , EOL; -$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007'); -$objWriter->save(str_replace('.php', '.xlsx', __FILE__)); -echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; - - -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; - -echo date('H:i:s') , " Done writing file" , EOL; -echo 'File has been created in ' , getcwd() , EOL; diff --git a/Examples/41password.php b/Examples/41password.php deleted file mode 100644 index 517b27cd..00000000 --- a/Examples/41password.php +++ /dev/null @@ -1,84 +0,0 @@ -'); - -date_default_timezone_set('Europe/London'); - -include "05featuredemo.inc.php"; - -/** Include PHPExcel */ -require_once dirname(__FILE__) . '/../src/Bootstrap.php'; - - -// Set password against the spreadsheet file -$objPHPExcel->getSecurity()->setLockWindows(true); -$objPHPExcel->getSecurity()->setLockStructure(true); -$objPHPExcel->getSecurity()->setWorkbookPassword('secret'); - - -// Save Excel 2007 file -echo date('H:i:s') , " Write to Excel2007 format" , EOL; -$callStartTime = microtime(true); - -$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007'); -$objWriter->save(str_replace('.php', '.xlsx', __FILE__)); -$callEndTime = microtime(true); -$callTime = $callEndTime - $callStartTime; - -echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; -echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; -// Echo memory usage -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; - - -// Save Excel 95 file -echo date('H:i:s') , " Write to Excel5 format" , EOL; -$callStartTime = microtime(true); - -$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel5'); -$objWriter->save(str_replace('.php', '.xls', __FILE__)); -$callEndTime = microtime(true); -$callTime = $callEndTime - $callStartTime; - -echo date('H:i:s') , " File written to " , str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; -echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; -// Echo memory usage -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; - - -// Echo memory peak usage -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; - -// Echo done -echo date('H:i:s') , " Done writing files" , EOL; -echo 'Files have been created in ' , getcwd() , EOL; diff --git a/Examples/42richText.php b/Examples/42richText.php deleted file mode 100644 index 12722176..00000000 --- a/Examples/42richText.php +++ /dev/null @@ -1,171 +0,0 @@ -'); - -/** Include PHPExcel */ -require_once dirname(__FILE__) . '/../src/Bootstrap.php'; - - -// Create new PHPExcel object -echo date('H:i:s') , " Create new PHPExcel object" , EOL; -$objPHPExcel = new \PHPExcel\Spreadsheet(); - -// Set document properties -echo date('H:i:s') , " Set document properties" , EOL; -$objPHPExcel->getProperties()->setCreator("Maarten Balliauw") - ->setLastModifiedBy("Maarten Balliauw") - ->setTitle("PHPExcel Test Document") - ->setSubject("PHPExcel Test Document") - ->setDescription("Test document for PHPExcel, generated using PHP classes.") - ->setKeywords("office PHPExcel php") - ->setCategory("Test result file"); - - -// Add some data -echo date('H:i:s') , " Add some data" , EOL; - -$html1 = ' -

My very first example of rich text
generated from html markup

-

- -This block contains an italicized word; -while this block uses an underline. - -

-

-I want to eat healthy food pizza. - -'; - -$html2 = '

- - 100°C is a hot temperature - -
- - 10°F is cold - -

'; - -$html3 = '23 equals 8'; - -$html4 = 'H2SO4 is the chemical formula for Sulphuric acid'; - -$html5 = 'bold, italic, bold+italic'; - -$wizard = new \PHPExcel\Helper\HTML; -$richText = $wizard->toRichTextObject($html1); - -$objPHPExcel->getActiveSheet() - ->setCellValue('A1', $richText); - -$objPHPExcel->getActiveSheet() - ->getColumnDimension('A') - ->setWidth(48); -$objPHPExcel->getActiveSheet() - ->getRowDimension(1) - ->setRowHeight(-1); -$objPHPExcel->getActiveSheet()->getStyle('A1') - ->getAlignment() - ->setWrapText(true); - -$richText = $wizard->toRichTextObject($html2); - -$objPHPExcel->getActiveSheet() - ->setCellValue('A2', $richText); - -$objPHPExcel->getActiveSheet() - ->getRowDimension(1) - ->setRowHeight(-1); -$objPHPExcel->getActiveSheet() - ->getStyle('A2') - ->getAlignment() - ->setWrapText(true); - -$objPHPExcel->setActiveSheetIndex(0) - ->setCellValue('A3', $wizard->toRichTextObject($html3)); - -$objPHPExcel->setActiveSheetIndex(0) - ->setCellValue('A4', $wizard->toRichTextObject($html4)); - -$objPHPExcel->setActiveSheetIndex(0) - ->setCellValue('A5', $wizard->toRichTextObject($html5)); - - -// Rename worksheet -echo date('H:i:s') , " Rename worksheet" , EOL; -$objPHPExcel->getActiveSheet() - ->setTitle('Rich Text Examples'); - - -// Set active sheet index to the first sheet, so Excel opens this as the first sheet -$objPHPExcel->setActiveSheetIndex(0); - - -// Save Excel 2007 file -echo date('H:i:s') , " Write to Excel2007 format" , EOL; -$callStartTime = microtime(true); - -$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007'); -$objWriter->save(str_replace('.php', '.xlsx', __FILE__)); -$callEndTime = microtime(true); -$callTime = $callEndTime - $callStartTime; - -echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; -echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; -// Echo memory usage -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; - - -// Save Excel 95 file -echo date('H:i:s') , " Write to Excel5 format" , EOL; -$callStartTime = microtime(true); - -$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel5'); -$objWriter->save(str_replace('.php', '.xls', __FILE__)); -$callEndTime = microtime(true); -$callTime = $callEndTime - $callStartTime; - -echo date('H:i:s') , " File written to " , str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; -echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; -// Echo memory usage -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; - - -// Echo memory peak usage -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; - -// Echo done -echo date('H:i:s') , " Done writing files" , EOL; -echo 'Files have been created in ' , getcwd() , EOL; diff --git a/Examples/43mergeWorkbooks.php b/Examples/43mergeWorkbooks.php deleted file mode 100644 index 8bd06bca..00000000 --- a/Examples/43mergeWorkbooks.php +++ /dev/null @@ -1,91 +0,0 @@ -'); - -date_default_timezone_set('Europe/London'); - -/** Include PHPExcel */ -require_once dirname(__FILE__) . '/../src/Bootstrap.php'; - - -echo date('H:i:s') , " Load MergeBook1 from Excel2007 file" , EOL; -$callStartTime = microtime(true); - -$objPHPExcel1 = \PHPExcel\IOFactory::load(dirname(__FILE__) . "/templates/43mergeBook1.xlsx"); - -$callEndTime = microtime(true); -$callTime = $callEndTime - $callStartTime; -echo 'Call time to read Mergebook1 was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; -// Echo memory usage -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; - - -echo date('H:i:s') , " Load MergeBook2 from Excel2007 file" , EOL; -$callStartTime = microtime(true); - -$objPHPExcel2 = \PHPExcel\IOFactory::load(dirname(__FILE__) . "/templates/43mergeBook2.xlsx"); - -$callEndTime = microtime(true); -$callTime = $callEndTime - $callStartTime; -echo 'Call time to read Mergebook2 was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; -// Echo memory usage -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; - - -foreach($objPHPExcel2->getSheetNames() as $sheetName) { - $sheet = $objPHPExcel2->getSheetByName($sheetName); - $sheet->setTitle($sheet->getTitle() . ' copied'); - $objPHPExcel1->addExternalSheet($sheet); -} - - -echo date('H:i:s') , " Write to Excel2007 format" , EOL; -$callStartTime = microtime(true); - -$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel1, 'Excel2007'); -$objWriter->save(str_replace('.php', '.xlsx', __FILE__)); - -$callEndTime = microtime(true); -$callTime = $callEndTime - $callStartTime; - -echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; -echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; -// Echo memory usage -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; - - -// Echo memory peak usage -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; - -// Echo done -echo date('H:i:s') , " Done writing file" , EOL; -echo 'File has been created in ' , getcwd() , EOL; diff --git a/Examples/44worksheetInfo.php b/Examples/44worksheetInfo.php deleted file mode 100644 index 73804aba..00000000 --- a/Examples/44worksheetInfo.php +++ /dev/null @@ -1,57 +0,0 @@ -'); - -date_default_timezone_set('Europe/London'); - -/** Include PHPExcel */ -require_once dirname(__FILE__) . '/../src/Bootstrap.php'; - -if (!file_exists("05featuredemo.xlsx")) { - exit("Please run 05featuredemo.php first." . EOL); -} - -$inputFileName = "05featuredemo.xlsx"; -$inputFileType = \PHPExcel\IOFactory::identify($inputFileName); -$objReader = \PHPExcel\IOFactory::createReader($inputFileType); -$sheetList = $objReader->listWorksheetNames($inputFileName); -$sheetInfo = $objReader->listWorksheetInfo($inputFileName); - -echo 'File Type:', PHP_EOL; -var_dump($inputFileType); - -echo 'Worksheet Names:', PHP_EOL; -var_dump($sheetList); - -echo 'Worksheet Names:', PHP_EOL; -var_dump($sheetInfo); - diff --git a/Examples/Excel2003XMLReader.php b/Examples/Excel2003XMLReader.php deleted file mode 100644 index ae259d16..00000000 --- a/Examples/Excel2003XMLReader.php +++ /dev/null @@ -1,61 +0,0 @@ -load("Excel2003XMLTest.xml"); - - -$callEndTime = microtime(true); -$callTime = $callEndTime - $callStartTime; -echo 'Call time to read Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , PHP_EOL; -// Echo memory usage -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , PHP_EOL; - - -echo date('H:i:s') , " Write to Excel5 format" , PHP_EOL; -$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel5'); -$objWriter->save(str_replace('.php', '.xls', __FILE__)); -echo date('H:i:s') , " File written to " , str_replace('.php', '.xls', __FILE__) , PHP_EOL; - - -// Echo memory peak usage -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , PHP_EOL; - -// Echo done -echo date('H:i:s') , " Done writing file" , PHP_EOL; diff --git a/Examples/Excel2003XMLTest.xml b/Examples/Excel2003XMLTest.xml deleted file mode 100644 index fb2d305c..00000000 --- a/Examples/Excel2003XMLTest.xml +++ /dev/null @@ -1 +0,0 @@ -3#0000004#0000ff5#0080006#00ccff7#8000808#9933669#c0c0c010#c4751211#ccffcc12#ddbc7d13#ff000014#ff00ff15#ff660016#ff990017#ff99cc18#ffff0090001386024075FalseFalse - - - - - - - - - - - - - - - - - - - - - - - - - - - - Test String 1 - 1 - 5 - A - E - 6 - AE - - - Test - String 2 - 2 - 6 - B - F - 8 - BF - - - Test #3 - 3 - 7 - C - G - 10 - CG - - - Test with (") in string - 4 - 8 - D - H - 12 - DH - - - 10 - 26 - 36 - - - 1.23 - 1 - - - - 2.34 - 0 - - - 3.45 - - - - 1960-12-19T00:00:00.000 - TOP - #N/A - - - 1.5 - #DIV/0! - - - BOTTOM - - - LEFT - - - RIGHT - - - - BOX - - Test Column 1 - - - Test Column 2 - - - Test Column 3 - -
- - -
-