29 error_reporting(E_ALL);
30 ini_set(
'display_errors', TRUE);
31 ini_set(
'display_startup_errors', TRUE);
32 date_default_timezone_set(
'Europe/London');
34 define(
'EOL',(PHP_SAPI ==
'cli') ?
PHP_EOL :
'<br />');
37 require_once dirname(__FILE__) .
'/../Classes/PHPExcel.php';
41 echo
date(
'H:i:s') ,
" Create new PHPExcel object" ,
EOL;
45 echo
date(
'H:i:s') ,
" Set document properties" ,
EOL;
47 ->setCreator(
"PHPOffice")
48 ->setLastModifiedBy(
"PHPOffice")
49 ->setTitle(
"PHPExcel Test Document")
50 ->setSubject(
"PHPExcel Test Document")
51 ->setDescription(
"Test document for PHPExcel, generated using PHP classes.")
52 ->setKeywords(
"Office PHPExcel php")
53 ->setCategory(
"Test result file");
66 $continent = pathinfo(
$filename, PATHINFO_FILENAME);
67 echo
"Loading $continent",
EOL;
68 $continent = str_replace(
' ',
'_',$continent);
107 ->setCellValue(
'A1',
'Continent:');
109 ->setCellValue(
'B1',
'Select continent');
111 ->setCellValue(
'B3',
'=' .
$column . 1);
113 ->setCellValue(
'B3',
'Select country');
116 ->getFont()->setBold(
true);
121 ->getDataValidation();
124 ->setAllowBlank(
false)
125 ->setShowInputMessage(
true)
126 ->setShowErrorMessage(
true)
127 ->setShowDropDown(
true)
128 ->setErrorTitle(
'Input error')
129 ->setError(
'Continent is not in the list.')
130 ->setPromptTitle(
'Pick from the list')
131 ->setPrompt(
'Please pick a continent from the drop-down list.')
132 ->setFormula1(
'=Continents');
135 ->setCellValue(
'A3',
'Country:');
138 ->getFont()->setBold(
true);
142 ->getDataValidation();
145 ->setAllowBlank(
false)
146 ->setShowInputMessage(
true)
147 ->setShowErrorMessage(
true)
148 ->setShowDropDown(
true)
149 ->setErrorTitle(
'Input error')
150 ->setError(
'Country is not in the list.')
151 ->setPromptTitle(
'Pick from the list')
152 ->setPrompt(
'Please pick a country from the drop-down list.')
153 ->setFormula1(
'=INDIRECT($B$1)');
156 $objPHPExcel->getActiveSheet()->getColumnDimension(
'A')->setWidth(12);
157 $objPHPExcel->getActiveSheet()->getColumnDimension(
'B')->setWidth(30);
165 echo
date(
'H:i:s') ,
" Write to Excel2007 format" ,
EOL;
167 $objWriter->save(str_replace(
'.php',
'.xlsx', __FILE__));
168 echo
date(
'H:i:s') ,
" File written to " , str_replace(
'.php',
'.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) ,
EOL;
171 echo
date(
'H:i:s') ,
" Peak memory usage: " , (memory_get_peak_usage(
true) / 1024 / 1024) ,
" MB" , EOL;
174 echo
date(
'H:i:s') ,
" Done writing files" ,
EOL;
175 echo
'Files have been created in ' , getcwd() ,
EOL;
static createWriter(PHPExcel $phpExcel, $writerType='')
Create PHPExcel_Writer_IWriter.
if($is_dev) echo "Review changes write something in WHATSNEW and and then commit with log PHP_EOL
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
Reload workbook from saved file
Create styles array
The data for the language used.