Jump to content

export excel error


areamesh

Recommended Posts

am using this code

<?php
   require_once 'PHPExcel.php';
   require_once 'PHPExcel/IOFactory.php';
   
   $objPHPExcel = new PHPExcel();
   
   $objPHPExcel->getProperties()->setCreator("Matthew Casperson")
                      ->setLastModifiedBy("Matthew Casperson")
                      ->setTitle("Office 2007 XLSX Test Document")
                      ->setSubject("Office 2007 XLSX Test Document")
                      ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.");
                     
   $objPHPExcel->setActiveSheetIndex(0)
            ->setCellValue('A1', 'Hello')
            ->setCellValue('B2', 'world!')
            ->setCellValue('C1', 'Hello')
            ->setCellValue('D2', 'world!');                     
   
   header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
   header('Content-Disposition: attachment;filename="test.xlsx"');
   header('Cache-Control: max-age=0');
   
   $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
   $objWriter->save('php://output');
?>

 

but excelsheet contain following  error.............

 

<b>Fatal error</b>:  Class 'ZipArchive' not found in <b>C:\Program Files\xampp\htdocs\immigration\PHPExcelSourceCode\PHPExcel\Writer\Excel2007.php</b> on line <b>224</b><br />

 

but excelsheet contain this error.............

please help how to fix it?

Link to comment
https://forums.phpfreaks.com/topic/203046-export-excel-error/
Share on other sites

It would appear that PHPExcel is dependent on the ZipArchive class and that you do not have it on your system. Check the documentation for PHPExcel to find required versions/dependants and also check the installation instructions to make sure you haven't missed anything.

Link to comment
https://forums.phpfreaks.com/topic/203046-export-excel-error/#findComment-1064040
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.