Jump to content

export excel using PHPExcel code


areamesh

Recommended Posts

i using PHPExcel Code for export excel

 

<?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.............

plz help how to fix it?

Link to comment
https://forums.phpfreaks.com/topic/202928-export-excel-using-phpexcel-code/
Share on other sites

<?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'); 
?>

am using this code

PHPExcel code i downloaded

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.