Jump to content

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

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.