29error_reporting(E_ALL);
30ini_set(
'display_errors', TRUE);
31ini_set(
'display_startup_errors', TRUE);
32date_default_timezone_set(
'Europe/London');
34define(
'EOL',(PHP_SAPI ==
'cli') ?
PHP_EOL :
'<br />');
37require_once dirname(__FILE__) .
'/../Classes/PHPExcel.php';
41echo
date(
'H:i:s').
' Create new PHPExcel object'.
EOL;
45echo
date(
'H:i:s').
' Set document properties'.
EOL;
46$objPHPExcel->getProperties()->setCreator(
'Maarten Balliauw')
47 ->setLastModifiedBy(
'Maarten Balliauw')
48 ->setTitle(
'PHPExcel Test Document')
49 ->setSubject(
'PHPExcel Test Document')
50 ->setDescription(
'Test document for PHPExcel, generated using PHP classes.')
51 ->setKeywords(
'office PHPExcel php')
52 ->setCategory(
'Test result file');
55echo
date(
'H:i:s').
' Add data'.
EOL;
57$objPHPExcel->getActiveSheet()->setCellValue(
'A1',
'Financial Year')
58 ->setCellValue(
'B1',
'Financial Period')
59 ->setCellValue(
'C1',
'Country')
60 ->setCellValue(
'D1',
'Date')
61 ->setCellValue(
'E1',
'Sales Value')
62 ->setCellValue(
'F1',
'Expenditure')
70$countries = array(
'United States',
'UK',
'France',
'Germany',
71 'Italy',
'Spain',
'Portugal',
'Japan'
78 $endDays =
date(
't',mktime(0,0,0,$period,1,$year));
79 for(
$i = 1;
$i <= $endDays; ++
$i) {
85 $value = rand(500,1000) * (1 + rand(-0.25,+0.25));
86 $salesValue = $invoiceValue = NULL;
87 $incomeOrExpenditure = rand(-1,1);
88 if ($incomeOrExpenditure == -1) {
89 $expenditure = rand(-500,-1000) * (1 + rand(-0.25,+0.25));
91 } elseif ($incomeOrExpenditure == 1) {
92 $expenditure = rand(-500,-1000) * (1 + rand(-0.25,+0.25));
93 $income = rand(500,1000) * (1 + rand(-0.25,+0.25));;
96 $income = rand(500,1000) * (1 + rand(-0.25,+0.25));;
114echo
date(
'H:i:s').
' Set styling'.
EOL;
115$objPHPExcel->getActiveSheet()->getStyle(
'A1:F1')->getFont()->setBold(
true);
116$objPHPExcel->getActiveSheet()->getStyle(
'A1:F1')->getAlignment()->setWrapText(TRUE);
117$objPHPExcel->getActiveSheet()->getColumnDimension(
'C')->setWidth(12.5);
118$objPHPExcel->getActiveSheet()->getColumnDimension(
'D')->setWidth(10.5);
121$objPHPExcel->getActiveSheet()->getColumnDimension(
'F')->setWidth(14);
127echo
date(
'H:i:s').
' Set autofilter range'.
EOL;
135echo
date(
'H:i:s').
' Set active filters'.
EOL;
156 $endDate =
date(
't',mktime(0,0,0,$period,1,$currentYear));
164 'year' => $currentYear,
182echo
date(
'H:i:s').
' Execute filtering'.
EOL;
190echo
date(
'H:i:s').
' Display filtered rows'.
EOL;
192 if (
$objPHPExcel->getActiveSheet()->getRowDimension(
$row->getRowIndex())->getVisible()) {
193 echo
' Row number - ' ,
$row->getRowIndex() ,
' ';
194 echo
$objPHPExcel->getActiveSheet()->getCell(
'C'.
$row->getRowIndex())->getValue(),
' ';
195 echo
$objPHPExcel->getActiveSheet()->getCell(
'D'.
$row->getRowIndex())->getFormattedValue(),
' ';
$objPHPExcel
Include PHPExcel.
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
An exception for terminatinating execution or to throw for unit testing.
static FormattedPHPToExcel($year, $month, $day, $hours=0, $minutes=0, $seconds=0)
FormattedPHPToExcel.
const AUTOFILTER_COLUMN_RULE_EQUAL
const AUTOFILTER_RULETYPE_CUSTOMFILTER
const AUTOFILTER_RULETYPE_DATEGROUP
const AUTOFILTER_FILTERTYPE_CUSTOMFILTER
const AUTOFILTER_FILTERTYPE_FILTER