Initial commit
This commit is contained in:
@@ -0,0 +1,72 @@
|
||||
<?php session_start();
|
||||
|
||||
|
||||
require_once '../PHPExcel.php';
|
||||
|
||||
|
||||
//pobiera informacje z pliku o zawartości raportu
|
||||
unset($conArray);
|
||||
$file = fopen("../charts/".base64_decode($_GET['fm']), "r");
|
||||
$i = 0;
|
||||
while (!feof($file)) {
|
||||
$line_of_text .= fgets($file);
|
||||
}
|
||||
$conArray = explode(chr(13), $line_of_text);
|
||||
fclose($file);
|
||||
|
||||
unset($wellArray);
|
||||
for ($i=0; $i<count($conArray); $i++)
|
||||
$wellArray[] = explode('|', $conArray[$i]);
|
||||
|
||||
|
||||
|
||||
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
|
||||
header('Content-Disposition: attachment;filename="'.date("Y-m-d").'_dl_kol_bar.xlsx"');
|
||||
header('Cache-Control: max-age=0');
|
||||
|
||||
$styleArray = array(
|
||||
'font' => array(
|
||||
'bold' => true,
|
||||
'size' => 16,
|
||||
'color' => array('rgb' => 'B22222')
|
||||
));
|
||||
$styleArray1 = array(
|
||||
'font' => array(
|
||||
'bold' => true,
|
||||
));
|
||||
|
||||
$objPHPExcel = new PHPExcel();
|
||||
$objPHPExcel->setActiveSheetIndex(0)->mergeCells('A1:D1');
|
||||
$objPHPExcel->getActiveSheet()->getRowDimension('1')->setRowHeight(25);
|
||||
$objPHPExcel->getActiveSheet()->getStyle('A1:D1')->applyFromArray($styleArray);
|
||||
$objPHPExcel->getActiveSheet()->SetCellValue('A1', 'Długość kolektorów tłocznych wg średnic na barierach na dzień '.$wellArray[0][0]);
|
||||
|
||||
|
||||
$objPHPExcel->getActiveSheet()->SetCellValue('A3', 'Lp.');
|
||||
$objPHPExcel->getActiveSheet()->SetCellValue('B3', 'Bariera');
|
||||
$objPHPExcel->getActiveSheet()->SetCellValue('C3', 'Średnica kol. tłocznego [mm]');
|
||||
$objPHPExcel->getActiveSheet()->SetCellValue('D3', 'Suma długość kol. tłocznych [m]');
|
||||
|
||||
|
||||
$kolumna = 4;
|
||||
|
||||
for ($i=0; $i<count($wellArray); $i++)
|
||||
{
|
||||
if (!empty($wellArray[$i][1]))
|
||||
{
|
||||
|
||||
$objPHPExcel->getActiveSheet()->SetCellValue('A'.($kolumna+$i), $wellArray[$i][1]);
|
||||
$objPHPExcel->getActiveSheet()->SetCellValue('B'.($kolumna+$i), $wellArray[$i][2]);
|
||||
$objPHPExcel->getActiveSheet()->SetCellValue('C'.($kolumna+$i), $wellArray[$i][3]);
|
||||
$objPHPExcel->getActiveSheet()->SetCellValue('D'.($kolumna+$i), $wellArray[$i][4]);
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$objPHPExcel->getActiveSheet()->setTitle('Długość kolektorów tłocznych');
|
||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
||||
$objWriter->save('php://output');
|
||||
exit;
|
||||
?>
|
||||
Reference in New Issue
Block a user