You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Need a help to resolve the excel sheet issue with PHPExcel . I'm trying to generate the PHPExcel version 1.8 from database. The problem is that excel sheet get creating and memory also get occupied but the content is not showing so it's showing blank excel sheet when my project in online but so it's showing excel sheet is proper when my project in offline my php version is 5.6
This are my code please check
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 $objPHPExcel->setActiveSheetIndex(0) ->setCellValue('D1', 'DATE WISE ITEM SALE REPORT') ->setCellValue('A2', 'SR No.') ->setCellValue('B2', 'HSN NO') ->setCellValue('C2', 'ITEM NAME') ->setCellValue('D2', 'QUANTITY') ->setCellValue('E2', 'TAXBLE VALUE') ->setCellValue('F2', 'TAX VALUE'); // Miscellaneous glyphs, UTF-8 $objPHPExcel->setActiveSheetIndex(0); $rowCount = 3; date_default_timezone_set('Asia/Calcutta'); $from_date=$_POST['txt_from_date']; $to_date=$_POST['txt_to_date']; $from_date = date("Y-m-d", strtotime($from_date)); $to_date = date("Y-m-d", strtotime($to_date)); $sales_invoice_id=''; $item_name=''; $hsn_code=''; $quantity=0; $sr_no=1; $total_item_qty=0; $total_taxable_value=0; $total_tax_value=0; $sq_invoice_details = mysqli_query($con,"SELECT distinct(item_id) from sales_invoice_details,sales_invoice where sales_invoice.invoice_date between '$from_date' and '$to_date' and sales_invoice.sales_invoice_id = sales_invoice_details.sales_invoice_id and sales_invoice.organization_id='$_SESSION[ORGID]'"); while($row_invoice_details = mysqli_fetch_assoc($sq_invoice_details)) { $sq_item_name_price = mysqli_query($con,"SELECT item_name,hsn_no from item_details where item_id='$row_invoice_details[item_id]'"); if($row_item_name_price = mysqli_fetch_assoc($sq_item_name_price)) { $item_name = $row_item_name_price['item_name']; $hsn_code = $row_item_name_price['hsn_no']; } $sum_qty=0; $taxble_value=0; $tax_value=0; $total_gst=0; $taxble_value_amount =0; $sql = mysqli_query($con,"SELECT * from sales_invoice_details,sales_invoice where sales_invoice.invoice_date between '$from_date' and '$to_date' and sales_invoice.sales_invoice_id = sales_invoice_details.sales_invoice_id and sales_invoice_details.item_id='$row_invoice_details[item_id]' and sales_invoice_details.organization_id='$_SESSION[ORGID]'"); // $sum_qty=0; while ($row = mysqli_fetch_assoc($sql)){ $qty = $row['quantity']; // $item_price = $row['item_price']; $sum_qty=$sum_qty + $qty; $taxble_value = $row['sale_price'] * $row['quantity']; $total_gst = $row['cgst_rs']+$row['sgst_rs']; $tax_value=$tax_value + $total_gst; $taxble_value_amount = $taxble_value_amount + $taxble_value; } $objPHPExcel->getActiveSheet()->SetCellValue('A'.$rowCount, $sr_no); $objPHPExcel->getActiveSheet()->SetCellValue('B'.$rowCount, $hsn_code); $objPHPExcel->getActiveSheet()->SetCellValue('C'.$rowCount, $item_name); $objPHPExcel->getActiveSheet()->SetCellValue('D'.$rowCount, $sum_qty); $objPHPExcel->getActiveSheet()->SetCellValue('E'.$rowCount, $taxble_value_amount); $objPHPExcel->getActiveSheet()->SetCellValue('F'.$rowCount, $tax_value); $rowCount++; $sr_no++; $total_item_qty = $total_item_qty + $sum_qty; $total_taxable_value = $total_taxable_value + $taxble_value_amount; $total_tax_value = $total_tax_value + $tax_value; } $total_rowCount = $rowCount + 1; $objPHPExcel->getActiveSheet()->SetCellValue('A'.$total_rowCount, ''); $objPHPExcel->getActiveSheet()->SetCellValue('B'.$total_rowCount, ''); $objPHPExcel->getActiveSheet()->SetCellValue('C'.$total_rowCount, 'Total:'); $objPHPExcel->getActiveSheet()->SetCellValue('D'.$total_rowCount, bcdiv($total_item_qty,1,2)); $objPHPExcel->getActiveSheet()->SetCellValue('E'.$total_rowCount, bcdiv($total_taxable_value,1,2)); $objPHPExcel->getActiveSheet()->SetCellValue('F'.$total_rowCount, bcdiv($total_tax_value,1,2)); $objPHPExcel->getActiveSheet()->getStyle('A'.$total_rowCount)->getFont()->setBold(true); $objPHPExcel->getActiveSheet()->getStyle('B'.$total_rowCount)->getFont()->setBold(true); $objPHPExcel->getActiveSheet()->getStyle('C'.$total_rowCount)->getFont()->setBold(true); $objPHPExcel->getActiveSheet()->getStyle('D'.$total_rowCount)->getFont()->setBold(true); $objPHPExcel->getActiveSheet()->getStyle('E'.$total_rowCount)->getFont()->setBold(true); $objPHPExcel->getActiveSheet()->getStyle('F'.$total_rowCount)->getFont()->setBold(true); // Rename worksheet $objPHPExcel->getActiveSheet()->setTitle('DATE WISE INVOICE'); $objPHPExcel->getActiveSheet()->getStyle("D1")->getFont()->setBold(true); $objPHPExcel->getActiveSheet()->getStyle("A2")->getFont()->setBold(true); $objPHPExcel->getActiveSheet()->getStyle("B2")->getFont()->setBold(true); $objPHPExcel->getActiveSheet()->getStyle("C2")->getFont()->setBold(true); $objPHPExcel->getActiveSheet()->getStyle("D2")->getFont()->setBold(true); $objPHPExcel->getActiveSheet()->getStyle("E2")->getFont()->setBold(true); $objPHPExcel->getActiveSheet()->getStyle("F2")->getFont()->setBold(true); $objPHPExcel->getActiveSheet()->getStyle("G2")->getFont()->setBold(true); $objPHPExcel->getActiveSheet()->getStyle("H2")->getFont()->setBold(true); $objPHPExcel->getActiveSheet()->getStyle("I2")->getFont()->setBold(true); $objPHPExcel->getActiveSheet()->getStyle("J2")->getFont()->setBold(true); $objPHPExcel->getActiveSheet()->getStyle("K2")->getFont()->setBold(true); $objPHPExcel->getActiveSheet()->getStyle("L2")->getFont()->setBold(true); $objPHPExcel->getActiveSheet()->getStyle("M2")->getFont()->setBold(true); // Redirect output to a client’s web browser (Excel2007) header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); header('Content-Disposition: attachment;filename="DATE WISE ITEM SALE REPORT.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 = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007'); $objWriter->save('php://output'); exit; Please solve the problem
The text was updated successfully, but these errors were encountered:
Need a help to resolve the excel sheet issue with PHPExcel . I'm trying to generate the PHPExcel version 1.8 from database. The problem is that excel sheet get creating and memory also get occupied but the content is not showing so it's showing blank excel sheet when my project in online but so it's showing excel sheet is proper when my project in offline my php version is 5.6
This are my code please check
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 $objPHPExcel->setActiveSheetIndex(0) ->setCellValue('D1', 'DATE WISE ITEM SALE REPORT') ->setCellValue('A2', 'SR No.') ->setCellValue('B2', 'HSN NO') ->setCellValue('C2', 'ITEM NAME') ->setCellValue('D2', 'QUANTITY') ->setCellValue('E2', 'TAXBLE VALUE') ->setCellValue('F2', 'TAX VALUE'); // Miscellaneous glyphs, UTF-8 $objPHPExcel->setActiveSheetIndex(0); $rowCount = 3; date_default_timezone_set('Asia/Calcutta'); $from_date=$_POST['txt_from_date']; $to_date=$_POST['txt_to_date']; $from_date = date("Y-m-d", strtotime($from_date)); $to_date = date("Y-m-d", strtotime($to_date)); $sales_invoice_id=''; $item_name=''; $hsn_code=''; $quantity=0; $sr_no=1; $total_item_qty=0; $total_taxable_value=0; $total_tax_value=0; $sq_invoice_details = mysqli_query($con,"SELECT distinct(item_id) from sales_invoice_details,sales_invoice where sales_invoice.invoice_date between '$from_date' and '$to_date' and sales_invoice.sales_invoice_id = sales_invoice_details.sales_invoice_id and sales_invoice.organization_id='$_SESSION[ORGID]'"); while($row_invoice_details = mysqli_fetch_assoc($sq_invoice_details)) { $sq_item_name_price = mysqli_query($con,"SELECT item_name,hsn_no from item_details where item_id='$row_invoice_details[item_id]'"); if($row_item_name_price = mysqli_fetch_assoc($sq_item_name_price)) { $item_name = $row_item_name_price['item_name']; $hsn_code = $row_item_name_price['hsn_no']; } $sum_qty=0; $taxble_value=0; $tax_value=0; $total_gst=0; $taxble_value_amount =0; $sql = mysqli_query($con,"SELECT * from sales_invoice_details,sales_invoice where sales_invoice.invoice_date between '$from_date' and '$to_date' and sales_invoice.sales_invoice_id = sales_invoice_details.sales_invoice_id and sales_invoice_details.item_id='$row_invoice_details[item_id]' and sales_invoice_details.organization_id='$_SESSION[ORGID]'"); // $sum_qty=0; while ($row = mysqli_fetch_assoc($sql)){ $qty = $row['quantity']; // $item_price = $row['item_price']; $sum_qty=$sum_qty + $qty; $taxble_value = $row['sale_price'] * $row['quantity']; $total_gst = $row['cgst_rs']+$row['sgst_rs']; $tax_value=$tax_value + $total_gst; $taxble_value_amount = $taxble_value_amount + $taxble_value; } $objPHPExcel->getActiveSheet()->SetCellValue('A'.$rowCount, $sr_no); $objPHPExcel->getActiveSheet()->SetCellValue('B'.$rowCount, $hsn_code); $objPHPExcel->getActiveSheet()->SetCellValue('C'.$rowCount, $item_name); $objPHPExcel->getActiveSheet()->SetCellValue('D'.$rowCount, $sum_qty); $objPHPExcel->getActiveSheet()->SetCellValue('E'.$rowCount, $taxble_value_amount); $objPHPExcel->getActiveSheet()->SetCellValue('F'.$rowCount, $tax_value); $rowCount++; $sr_no++; $total_item_qty = $total_item_qty + $sum_qty; $total_taxable_value = $total_taxable_value + $taxble_value_amount; $total_tax_value = $total_tax_value + $tax_value; } $total_rowCount = $rowCount + 1; $objPHPExcel->getActiveSheet()->SetCellValue('A'.$total_rowCount, ''); $objPHPExcel->getActiveSheet()->SetCellValue('B'.$total_rowCount, ''); $objPHPExcel->getActiveSheet()->SetCellValue('C'.$total_rowCount, 'Total:'); $objPHPExcel->getActiveSheet()->SetCellValue('D'.$total_rowCount, bcdiv($total_item_qty,1,2)); $objPHPExcel->getActiveSheet()->SetCellValue('E'.$total_rowCount, bcdiv($total_taxable_value,1,2)); $objPHPExcel->getActiveSheet()->SetCellValue('F'.$total_rowCount, bcdiv($total_tax_value,1,2)); $objPHPExcel->getActiveSheet()->getStyle('A'.$total_rowCount)->getFont()->setBold(true); $objPHPExcel->getActiveSheet()->getStyle('B'.$total_rowCount)->getFont()->setBold(true); $objPHPExcel->getActiveSheet()->getStyle('C'.$total_rowCount)->getFont()->setBold(true); $objPHPExcel->getActiveSheet()->getStyle('D'.$total_rowCount)->getFont()->setBold(true); $objPHPExcel->getActiveSheet()->getStyle('E'.$total_rowCount)->getFont()->setBold(true); $objPHPExcel->getActiveSheet()->getStyle('F'.$total_rowCount)->getFont()->setBold(true); // Rename worksheet $objPHPExcel->getActiveSheet()->setTitle('DATE WISE INVOICE'); $objPHPExcel->getActiveSheet()->getStyle("D1")->getFont()->setBold(true); $objPHPExcel->getActiveSheet()->getStyle("A2")->getFont()->setBold(true); $objPHPExcel->getActiveSheet()->getStyle("B2")->getFont()->setBold(true); $objPHPExcel->getActiveSheet()->getStyle("C2")->getFont()->setBold(true); $objPHPExcel->getActiveSheet()->getStyle("D2")->getFont()->setBold(true); $objPHPExcel->getActiveSheet()->getStyle("E2")->getFont()->setBold(true); $objPHPExcel->getActiveSheet()->getStyle("F2")->getFont()->setBold(true); $objPHPExcel->getActiveSheet()->getStyle("G2")->getFont()->setBold(true); $objPHPExcel->getActiveSheet()->getStyle("H2")->getFont()->setBold(true); $objPHPExcel->getActiveSheet()->getStyle("I2")->getFont()->setBold(true); $objPHPExcel->getActiveSheet()->getStyle("J2")->getFont()->setBold(true); $objPHPExcel->getActiveSheet()->getStyle("K2")->getFont()->setBold(true); $objPHPExcel->getActiveSheet()->getStyle("L2")->getFont()->setBold(true); $objPHPExcel->getActiveSheet()->getStyle("M2")->getFont()->setBold(true); // Redirect output to a client’s web browser (Excel2007) header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); header('Content-Disposition: attachment;filename="DATE WISE ITEM SALE REPORT.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 = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007'); $objWriter->save('php://output'); exit; Please solve the problem
The text was updated successfully, but these errors were encountered: