Décalage de la ligne TOTAL en raison de l'ajout d'une colonne demandeur

This commit is contained in:
lars 2019-05-15 18:01:34 +02:00
parent cec0d34761
commit 4d7d3da97d

View File

@ -145,13 +145,16 @@ foreach (range('A','E') as $col) {
// Add totals
//
$highestRow = $spreadsheet->getActiveSheet()->getHighestRow();
$coord = 'N' . ($highestRow+2);
$coord = 'O' . ($highestRow+2);
$spreadsheet->getActiveSheet()->setCellValue($coord, 'TOTAL');
foreach(range('O','Z') as $col) {
foreach(range('P','Z') as $col) {
$spreadsheet->getActiveSheet()->setCellValue($col.($highestRow+2), '=SUM('.$col.'2:'.$col.($highestRow).')');
}
// Do AA
$spreadsheet->getActiveSheet()->setCellValue('AA'.($highestRow+2), '=SUM(AA2:AA'.($highestRow).')');
foreach(range('A','B') as $col) {
$spreadsheet->getActiveSheet()->setCellValue('A'.$col.($highestRow+2), '=SUM(A'.$col.'2:A'.$col.($highestRow).')');
}
// Do AA and AB
// $spreadsheet->getActiveSheet()->setCellValue('AA'.($highestRow+2), '=SUM(AA2:AA'.($highestRow).')');
// Format the total
$spreadsheet->getActiveSheet()->getStyle($coord.':AA'.($highestRow+2))->getFill()
->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)
@ -199,13 +202,17 @@ if ($result = $mysqli->query($query)) {
// Add totals
// //
$highestRow = $prevSheet->getHighestRow();
$coord = 'N' . ($highestRow+2);
$coord = 'O' . ($highestRow+2);
$prevSheet->setCellValue($coord, 'TOTAL');
foreach(range('O','Z') as $col) {
foreach(range('P','Z') as $col) {
$prevSheet->setCellValue($col.($highestRow+2), '=SUM('.$col.'2:'.$col.($highestRow).')');
}
// Do AA
$prevSheet->setCellValue('AA'.($highestRow+2), '=SUM(AA2:AA'.($highestRow).')');
foreach(range('A','B') as $col) {
$prevSheet->setCellValue('A'.$col.($highestRow+2), '=SUM(A'.$col.'2:A'.$col.($highestRow).')');
}
// $prevSheet->setCellValue('AA'.($highestRow+2), '=SUM(AA2:AA'.($highestRow).')');
// Format the total
$prevSheet->getStyle($coord.':AA'.($highestRow+2))->getFill()
->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)
@ -250,9 +257,9 @@ foreach (range('A','E') as $col) {
// Add totals
// //
$highestRow = $spreadsheet->getActiveSheet()->getHighestRow();
$coord = 'N' . ($highestRow+2);
$coord = 'O' . ($highestRow+2);
$spreadsheet->getActiveSheet()->setCellValue($coord, 'TOTAL');
foreach(range('O','Z') as $col) {
foreach(range('P','Z') as $col) {
$spreadsheet->getActiveSheet()->setCellValue($col.($highestRow+2), '=SUM('.$col.'2:'.$col.($highestRow).')');
}
// Do AA