$objPHPExcel->setActiveSheetIndex(0)->setCellValue('A1', 'Hello')->setCellValue('B2', 'world!')->setCellValue('C1', 'Hello')->setCellValue('D2', 'world!'); $objPHPExcel->getActiveSheet()->setTitle('Simple'); $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007'); $objWriter->save(str_replace('.php', '.xlsx', __FILE__)); // header('Content-Type: application/force-download'); // header('Content-Description: File Transfer'); // // header('Content-Type: application/octet-stream'); // header('Content-Disposition: attachment; filename=file.csv'); // header('Content-Transfer-Encoding: binary'); // header('Expires: 0'); // header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); // header('Pragma: public'); // echo "\xEF\xBB\xBF"; // UTF-8 BOM // echo "test"; // FetchDetailsToExport(); WriteToExcel(FetchDetailsToExport()); function FetchDetailsToExport() { // header('Content-Type: application/force-download'); // header('Content-Description: File Transfer'); // // header('Content-Type: application/octet-stream'); // header('Content-Disposition: attachment; filename=file.csv'); // header('Content-Transfer-Encoding: binary'); // header('Expires: 0'); // header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); // header('Pragma: public'); // echo "\xEF\xBB\xBF"; // UTF-8 BOM $host = "localhost"; $dbname = "sadhanatextilesdb"; $username = "******"; $password = "******";
break; case "FetchBillDetails": $QueryBillID = $_POST['QueryBillID']; FetchBillDetails($QueryBillID); break; case "UpdateBillItems": $ItemDetails = $_POST['ItemsArray']; $BillDetails = $_POST['BillDetails']; DeleteAndInsertItems($ItemDetails, $BillDetails); break; case "ExportDetails": // echo "ExportDetails"; $UserDetailsSelection = $_POST['DetailsSelected']; $UserTimelineSelection = $_POST['TimelineSelected']; //$UserTimelineSelection["FromDate"]."::"; //.$i++ $FetchedExportDetails = FetchDetailsToExport($UserTimelineSelection, $UserDetailsSelection); //WriteToExcel($FetchedExportDetails); break; case "ItemsAvailabilityReport": $ReportTable = "itemsavailable"; $ColsRequired = $_POST['ColumnsRequired']; // GetAvailableItemsForReprt($ReportTable,$ColsRequired); $SelectionReturn = SelectColsOfaTable($ReportTable, $ColsRequired); print_r(json_encode($SelectionReturn)); break; case "SalesReport": $RequiredTimeSpan = $_POST['TimePerioad']; GetSalesReport($RequiredTimeSpan); break; case "SalesBetweenDates": $dataFromDate = $_POST['FromDate'];