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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.