Error while save excel.

Topics: Developer Forum
Feb 24, 2011 at 12:56 AM

Hi,
Thanks for the great code. I just started with tests folder code.
I have a problem while save excel.
I don't know where I did mistake.

Everything goes fine, when this line comes 
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
browser displays "This Page appears broken"

I'm using php5.2 and excel2007.

Thanks in advance,
Thenndral

Coordinator
Feb 24, 2011 at 9:15 PM

PHPExcel doesn't have any messages like "This Page appears broken", so I can't suggest much to help without knowing what your code might be doing.

Feb 24, 2011 at 11:58 PM
Hi Mark,

Thanks for your reply.

I'm new to PHPExcel. So I try to use tests code.

I didn't code newly. Please see below the code am using. I highlight the text where I got error.

Please guide me. It's Really a urgent task for me.

01simple.php

<?php
error_reporting(E_ALL);

date_default_timezone_set('Europe/London');

/** PHPExcel */
//require_once '../Classes/PHPExcel.php';
//Server root
include_once($_SERVER['DOCUMENT_ROOT']."/../include/common_class.php");
include_once(DOCUMENT_ROOT."/../include/db_class_mysqli.php");
include_once(DOCUMENT_ROOT."/../Classes/PHPExcel.php");

// Create new PHPExcel object
echo date('H:i:s') . " Create new PHPExcel object\n";
$objPHPExcel = new PHPExcel();

// Set properties
echo date('H:i:s') . " Set properties\n";
$objPHPExcel->getProperties()->setCreator("Maarten Balliauw")
->setLastModifiedBy("Maarten Balliauw")
->setTitle("Office 2007 XLSX Test Document")
->setSubject("Office 2007 XLSX Test Document")
->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.")
->setKeywords("office 2007 openxml php")
->setCategory("Test result file");
// Add some data
echo date('H:i:s') . " Add some data\n";
$objPHPExcel->setActiveSheetIndex(0)
->setCellValue('A1', 'Hello')
->setCellValue('B2', 'world!')
->setCellValue('C1', 'Hello')
->setCellValue('D2', 'world!');

// Miscellaneous glyphs, UTF-8
$objPHPExcel->setActiveSheetIndex(0)
->setCellValue('A4', 'Miscellaneous glyphs')
->setCellValue('A5', 'éàèùâêîôûëïüÿäöüç');

// Rename sheet
echo date('H:i:s') . " Rename sheet\n";
$objPHPExcel->getActiveSheet()->setTitle('Simple');


// Set active sheet index to the first sheet, so Excel opens this as the first sheet
$objPHPExcel->setActiveSheetIndex(0);


// Save Excel 2007 file
echo date('H:i:s') . " Write to Excel2007 format\n";


$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter ->save(str_replace('.php','.xlsx',__FILE__)); // Here I got error. excel file not save.

// Echo memory peak usage
echo date('H:i:s') . " Peak memory usage: " . (memory_get_peak_usage(true) / 1024 / 1024) . " MB\r\n";


// Echo done
echo date('H:i:s') . " Done writing file.\r\n";
exit;
?>
<?php
error_reporting(E_ALL);

date_default_timezone_set('Europe/London');

/** PHPExcel */
//require_once '../Classes/PHPExcel.php';
//Server root
include_once($_SERVER['DOCUMENT_ROOT']."/../include/common_class.php");
include_once(DOCUMENT_ROOT."/../include/db_class_mysqli.php");
include_once(DOCUMENT_ROOT."/../Classes/PHPExcel.php");

// Create new PHPExcel object
echo date('H:i:s') . " Create new PHPExcel object\n";
$objPHPExcel = new PHPExcel();

// Set properties
echo date('H:i:s') . " Set properties\n";
$objPHPExcel->getProperties()->setCreator("Maarten Balliauw")
->setLastModifiedBy("Maarten Balliauw")
->setTitle("Office 2007 XLSX Test Document")
->setSubject("Office 2007 XLSX Test Document")
->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.")
->setKeywords("office 2007 openxml php")
->setCategory("Test result file");
// Add some data
echo date('H:i:s') . " Add some data\n";
$objPHPExcel->setActiveSheetIndex(0)
->setCellValue('A1', 'Hello')
->setCellValue('B2', 'world!')
->setCellValue('C1', 'Hello')
->setCellValue('D2', 'world!');

// Miscellaneous glyphs, UTF-8
$objPHPExcel->setActiveSheetIndex(0)
->setCellValue('A4', 'Miscellaneous glyphs')
->setCellValue('A5', 'éàèùâêîôûëïüÿäöüç');

// Rename sheet
echo date('H:i:s') . " Rename sheet\n";
$objPHPExcel->getActiveSheet()->setTitle('Simple');


// Set active sheet index to the first sheet, so Excel opens this as the first sheet
$objPHPExcel->setActiveSheetIndex(0);


// Save Excel 2007 file
echo date('H:i:s') . " Write to Excel2007 format\n";


$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter ->save(str_replace('.php','.xlsx',__FILE__)); // Here I got error. excel file not save.

// Echo memory peak usage
echo date('H:i:s') . " Peak memory usage: " . (memory_get_peak_usage(true) / 1024 / 1024) . " MB\r\n";


// Echo done
echo date('H:i:s') . " Done writing file.\r\n";
exit;
?>

On Fri, Feb 25, 2011 at 7:15 AM, MarkBaker <notifications@codeplex.com> wrote:

From: MarkBaker

PHPExcel doesn't have any messages like "This Page appears broken", so I can't suggest much to help without knowing what your code might be doing.

Read the full discussion online.

To add a post to this discussion, reply to this email (PHPExcel@discussions.codeplex.com)

To start a new discussion for this project, email PHPExcel@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on CodePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at CodePlex.com


Feb 28, 2011 at 12:36 AM
hello,

// $objWriter ->save(str_replace('.php','.xlsx',__FILE__));

I thought here "__FILE__" got error, so Is any configuration, I need to do in "Excel2007.php" near the top of the header.

/** PHPExcel root directory */
if (!defined('PHPEXCEL_ROOT')) {
/**
* @ignore
*/
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
}

If so please let me the code.

Thanks in advance,
thenndral.

On Fri, Feb 25, 2011 at 9:58 AM, Thendral <thenndral@gmail.com> wrote:
Hi Mark,

Thanks for your reply.

I'm new to PHPExcel. So I try to use tests code.

I didn't code newly. Please see below the code am using. I highlight the text where I got error.

Please guide me. It's Really a urgent task for me.

01simple.php

<?php
error_reporting(E_ALL);

date_default_timezone_set('Europe/London');

/** PHPExcel */
//require_once '../Classes/PHPExcel.php';
//Server root
include_once($_SERVER['DOCUMENT_ROOT']."/../include/common_class.php");
include_once(DOCUMENT_ROOT."/../include/db_class_mysqli.php");
include_once(DOCUMENT_ROOT."/../Classes/PHPExcel.php");

// Create new PHPExcel object
echo date('H:i:s') . " Create new PHPExcel object\n";
$objPHPExcel = new PHPExcel();

// Set properties
echo date('H:i:s') . " Set properties\n";
$objPHPExcel->getProperties()->setCreator("Maarten Balliauw")
->setLastModifiedBy("Maarten Balliauw")
->setTitle("Office 2007 XLSX Test Document")
->setSubject("Office 2007 XLSX Test Document")
->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.")
->setKeywords("office 2007 openxml php")
->setCategory("Test result file");
// Add some data
echo date('H:i:s') . " Add some data\n";
$objPHPExcel->setActiveSheetIndex(0)
->setCellValue('A1', 'Hello')
->setCellValue('B2', 'world!')
->setCellValue('C1', 'Hello')
->setCellValue('D2', 'world!');

// Miscellaneous glyphs, UTF-8
$objPHPExcel->setActiveSheetIndex(0)
->setCellValue('A4', 'Miscellaneous glyphs')
->setCellValue('A5', 'éàèùâêîôûëïüÿäöüç');

// Rename sheet
echo date('H:i:s') . " Rename sheet\n";
$objPHPExcel->getActiveSheet()->setTitle('Simple');


// Set active sheet index to the first sheet, so Excel opens this as the first sheet
$objPHPExcel->setActiveSheetIndex(0);


// Save Excel 2007 file
echo date('H:i:s') . " Write to Excel2007 format\n";


$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter ->save(str_replace('.php','.xlsx',__FILE__)); // Here I got error. excel file not save.

// Echo memory peak usage
echo date('H:i:s') . " Peak memory usage: " . (memory_get_peak_usage(true) / 1024 / 1024) . " MB\r\n";


// Echo done
echo date('H:i:s') . " Done writing file.\r\n";
exit;
?>
<?php
error_reporting(E_ALL);

date_default_timezone_set('Europe/London');

/** PHPExcel */
//require_once '../Classes/PHPExcel.php';
//Server root
include_once($_SERVER['DOCUMENT_ROOT']."/../include/common_class.php");
include_once(DOCUMENT_ROOT."/../include/db_class_mysqli.php");
include_once(DOCUMENT_ROOT."/../Classes/PHPExcel.php");

// Create new PHPExcel object
echo date('H:i:s') . " Create new PHPExcel object\n";
$objPHPExcel = new PHPExcel();

// Set properties
echo date('H:i:s') . " Set properties\n";
$objPHPExcel->getProperties()->setCreator("Maarten Balliauw")
->setLastModifiedBy("Maarten Balliauw")
->setTitle("Office 2007 XLSX Test Document")
->setSubject("Office 2007 XLSX Test Document")
->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.")
->setKeywords("office 2007 openxml php")
->setCategory("Test result file");
// Add some data
echo date('H:i:s') . " Add some data\n";
$objPHPExcel->setActiveSheetIndex(0)
->setCellValue('A1', 'Hello')
->setCellValue('B2', 'world!')
->setCellValue('C1', 'Hello')
->setCellValue('D2', 'world!');

// Miscellaneous glyphs, UTF-8
$objPHPExcel->setActiveSheetIndex(0)
->setCellValue('A4', 'Miscellaneous glyphs')
->setCellValue('A5', 'éàèùâêîôûëïüÿäöüç');

// Rename sheet
echo date('H:i:s') . " Rename sheet\n";
$objPHPExcel->getActiveSheet()->setTitle('Simple');


// Set active sheet index to the first sheet, so Excel opens this as the first sheet
$objPHPExcel->setActiveSheetIndex(0);


// Save Excel 2007 file
echo date('H:i:s') . " Write to Excel2007 format\n";


$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter ->save(str_replace('.php','.xlsx',__FILE__)); // Here I got error. excel file not save.

// Echo memory peak usage
echo date('H:i:s') . " Peak memory usage: " . (memory_get_peak_usage(true) / 1024 / 1024) . " MB\r\n";


// Echo done
echo date('H:i:s') . " Done writing file.\r\n";
exit;
?>

On Fri, Feb 25, 2011 at 7:15 AM, MarkBaker <notifications@codeplex.com> wrote:

From: MarkBaker

PHPExcel doesn't have any messages like "This Page appears broken", so I can't suggest much to help without knowing what your code might be doing.

Read the full discussion online.

To add a post to this discussion, reply to this email (PHPExcel@discussions.codeplex.com)

To start a new discussion for this project, email PHPExcel@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on CodePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at CodePlex.com



Feb 28, 2011 at 3:25 AM
Hi,

I think , close to find out the error where it is happening.
when use the following code, ini_set('display_errors', 1);
browser displays the following error. the error is could not close zip file.

how to resolve this error? where I did mistake? please let me know.

Fatal error: Uncaught exception 'Exception' with message 'Could not close zip file /home/swa/ads.photo.co.kr/htdocs/test/excel/Tests/01simple.xlsx.' in /home/swa/ads.photo.co.kr/Classes/PHPExcel/Writer/Excel2007.php:344 Stack trace: #0 /home/swa/ads.photo.co.kr/htdocs/test/excel/Tests/01simple.php(85): PHPExcel_Writer_Excel2007->save('/home/swa/ads....') #1 {main} thrown in /home/swa/ads.photo.co.kr/Classes/PHPExcel/Writer/Excel2007.php on line 344

Thanks in advance,
thenndral

On Mon, Feb 28, 2011 at 10:35 AM, Thendral <thenndral@gmail.com> wrote:
hello,

// $objWriter ->save(str_replace('.php','.xlsx',__FILE__));

I thought here "__FILE__" got error, so Is any configuration, I need to do in "Excel2007.php" near the top of the header.

/** PHPExcel root directory */
if (!defined('PHPEXCEL_ROOT')) {
/**
* @ignore
*/
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
}

If so please let me the code.

Thanks in advance,
thenndral.

On Fri, Feb 25, 2011 at 9:58 AM, Thendral <thenndral@gmail.com> wrote:
Hi Mark,

Thanks for your reply.

I'm new to PHPExcel. So I try to use tests code.

I didn't code newly. Please see below the code am using. I highlight the text where I got error.

Please guide me. It's Really a urgent task for me.

01simple.php

<?php
error_reporting(E_ALL);

date_default_timezone_set('Europe/London');

/** PHPExcel */
//require_once '../Classes/PHPExcel.php';
//Server root
include_once($_SERVER['DOCUMENT_ROOT']."/../include/common_class.php");
include_once(DOCUMENT_ROOT."/../include/db_class_mysqli.php");
include_once(DOCUMENT_ROOT."/../Classes/PHPExcel.php");

// Create new PHPExcel object
echo date('H:i:s') . " Create new PHPExcel object\n";
$objPHPExcel = new PHPExcel();

// Set properties
echo date('H:i:s') . " Set properties\n";
$objPHPExcel->getProperties()->setCreator("Maarten Balliauw")
->setLastModifiedBy("Maarten Balliauw")
->setTitle("Office 2007 XLSX Test Document")
->setSubject("Office 2007 XLSX Test Document")
->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.")
->setKeywords("office 2007 openxml php")
->setCategory("Test result file");
// Add some data
echo date('H:i:s') . " Add some data\n";
$objPHPExcel->setActiveSheetIndex(0)
->setCellValue('A1', 'Hello')
->setCellValue('B2', 'world!')
->setCellValue('C1', 'Hello')
->setCellValue('D2', 'world!');

// Miscellaneous glyphs, UTF-8
$objPHPExcel->setActiveSheetIndex(0)
->setCellValue('A4', 'Miscellaneous glyphs')
->setCellValue('A5', 'éàèùâêîôûëïüÿäöüç');

// Rename sheet
echo date('H:i:s') . " Rename sheet\n";
$objPHPExcel->getActiveSheet()->setTitle('Simple');


// Set active sheet index to the first sheet, so Excel opens this as the first sheet
$objPHPExcel->setActiveSheetIndex(0);


// Save Excel 2007 file
echo date('H:i:s') . " Write to Excel2007 format\n";


$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter ->save(str_replace('.php','.xlsx',__FILE__)); // Here I got error. excel file not save.

// Echo memory peak usage
echo date('H:i:s') . " Peak memory usage: " . (memory_get_peak_usage(true) / 1024 / 1024) . " MB\r\n";


// Echo done
echo date('H:i:s') . " Done writing file.\r\n";
exit;
?>
<?php
error_reporting(E_ALL);

date_default_timezone_set('Europe/London');

/** PHPExcel */
//require_once '../Classes/PHPExcel.php';
//Server root
include_once($_SERVER['DOCUMENT_ROOT']."/../include/common_class.php");
include_once(DOCUMENT_ROOT."/../include/db_class_mysqli.php");
include_once(DOCUMENT_ROOT."/../Classes/PHPExcel.php");

// Create new PHPExcel object
echo date('H:i:s') . " Create new PHPExcel object\n";
$objPHPExcel = new PHPExcel();

// Set properties
echo date('H:i:s') . " Set properties\n";
$objPHPExcel->getProperties()->setCreator("Maarten Balliauw")
->setLastModifiedBy("Maarten Balliauw")
->setTitle("Office 2007 XLSX Test Document")
->setSubject("Office 2007 XLSX Test Document")
->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.")
->setKeywords("office 2007 openxml php")
->setCategory("Test result file");
// Add some data
echo date('H:i:s') . " Add some data\n";
$objPHPExcel->setActiveSheetIndex(0)
->setCellValue('A1', 'Hello')
->setCellValue('B2', 'world!')
->setCellValue('C1', 'Hello')
->setCellValue('D2', 'world!');

// Miscellaneous glyphs, UTF-8
$objPHPExcel->setActiveSheetIndex(0)
->setCellValue('A4', 'Miscellaneous glyphs')
->setCellValue('A5', 'éàèùâêîôûëïüÿäöüç');

// Rename sheet
echo date('H:i:s') . " Rename sheet\n";
$objPHPExcel->getActiveSheet()->setTitle('Simple');


// Set active sheet index to the first sheet, so Excel opens this as the first sheet
$objPHPExcel->setActiveSheetIndex(0);


// Save Excel 2007 file
echo date('H:i:s') . " Write to Excel2007 format\n";


$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter ->save(str_replace('.php','.xlsx',__FILE__)); // Here I got error. excel file not save.

// Echo memory peak usage
echo date('H:i:s') . " Peak memory usage: " . (memory_get_peak_usage(true) / 1024 / 1024) . " MB\r\n";


// Echo done
echo date('H:i:s') . " Done writing file.\r\n";
exit;
?>

On Fri, Feb 25, 2011 at 7:15 AM, MarkBaker <notifications@codeplex.com> wrote:

From: MarkBaker

PHPExcel doesn't have any messages like "This Page appears broken", so I can't suggest much to help without knowing what your code might be doing.

Read the full discussion online.

To add a post to this discussion, reply to this email (PHPExcel@discussions.codeplex.com)

To start a new discussion for this project, email PHPExcel@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on CodePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at CodePlex.com




Feb 28, 2011 at 8:47 AM
Hi,

I figure it out.

I give permission to my folder. It works fine, while save in server folder.

but its not working for client server side. junk data save in excel sheet.

Herewith i attach the excel file, please have a look. and please guide me.


thanks
thenndral.

On Mon, Feb 28, 2011 at 1:25 PM, Thendral <thenndral@gmail.com> wrote:
Hi,

I think , close to find out the error where it is happening.
when use the following code, ini_set('display_errors', 1);
browser displays the following error. the error is could not close zip file.

how to resolve this error? where I did mistake? please let me know.

Fatal error: Uncaught exception 'Exception' with message 'Could not close zip file /home/swa/ads.photo.co.kr/htdocs/test/excel/Tests/01simple.xlsx.' in /home/swa/ads.photo.co.kr/Classes/PHPExcel/Writer/Excel2007.php:344 Stack trace: #0 /home/swa/ads.photo.co.kr/htdocs/test/excel/Tests/01simple.php(85): PHPExcel_Writer_Excel2007->save('/home/swa/ads....') #1 {main} thrown in /home/swa/ads.photo.co.kr/Classes/PHPExcel/Writer/Excel2007.php on line 344

Thanks in advance,
thenndral

On Mon, Feb 28, 2011 at 10:35 AM, Thendral <thenndral@gmail.com> wrote:
hello,

// $objWriter ->save(str_replace('.php','.xlsx',__FILE__));

I thought here "__FILE__" got error, so Is any configuration, I need to do in "Excel2007.php" near the top of the header.

/** PHPExcel root directory */
if (!defined('PHPEXCEL_ROOT')) {
/**
* @ignore
*/
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
}

If so please let me the code.

Thanks in advance,
thenndral.

On Fri, Feb 25, 2011 at 9:58 AM, Thendral <thenndral@gmail.com> wrote:
Hi Mark,

Thanks for your reply.

I'm new to PHPExcel. So I try to use tests code.

I didn't code newly. Please see below the code am using. I highlight the text where I got error.

Please guide me. It's Really a urgent task for me.

01simple.php

<?php
error_reporting(E_ALL);

date_default_timezone_set('Europe/London');

/** PHPExcel */
//require_once '../Classes/PHPExcel.php';
//Server root
include_once($_SERVER['DOCUMENT_ROOT']."/../include/common_class.php");
include_once(DOCUMENT_ROOT."/../include/db_class_mysqli.php");
include_once(DOCUMENT_ROOT."/../Classes/PHPExcel.php");

// Create new PHPExcel object
echo date('H:i:s') . " Create new PHPExcel object\n";
$objPHPExcel = new PHPExcel();

// Set properties
echo date('H:i:s') . " Set properties\n";
$objPHPExcel->getProperties()->setCreator("Maarten Balliauw")
->setLastModifiedBy("Maarten Balliauw")
->setTitle("Office 2007 XLSX Test Document")
->setSubject("Office 2007 XLSX Test Document")
->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.")
->setKeywords("office 2007 openxml php")
->setCategory("Test result file");
// Add some data
echo date('H:i:s') . " Add some data\n";
$objPHPExcel->setActiveSheetIndex(0)
->setCellValue('A1', 'Hello')
->setCellValue('B2', 'world!')
->setCellValue('C1', 'Hello')
->setCellValue('D2', 'world!');

// Miscellaneous glyphs, UTF-8
$objPHPExcel->setActiveSheetIndex(0)
->setCellValue('A4', 'Miscellaneous glyphs')
->setCellValue('A5', 'éàèùâêîôûëïüÿäöüç');

// Rename sheet
echo date('H:i:s') . " Rename sheet\n";
$objPHPExcel->getActiveSheet()->setTitle('Simple');


// Set active sheet index to the first sheet, so Excel opens this as the first sheet
$objPHPExcel->setActiveSheetIndex(0);


// Save Excel 2007 file
echo date('H:i:s') . " Write to Excel2007 format\n";


$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter ->save(str_replace('.php','.xlsx',__FILE__)); // Here I got error. excel file not save.

// Echo memory peak usage
echo date('H:i:s') . " Peak memory usage: " . (memory_get_peak_usage(true) / 1024 / 1024) . " MB\r\n";


// Echo done
echo date('H:i:s') . " Done writing file.\r\n";
exit;
?>
<?php
error_reporting(E_ALL);

date_default_timezone_set('Europe/London');

/** PHPExcel */
//require_once '../Classes/PHPExcel.php';
//Server root
include_once($_SERVER['DOCUMENT_ROOT']."/../include/common_class.php");
include_once(DOCUMENT_ROOT."/../include/db_class_mysqli.php");
include_once(DOCUMENT_ROOT."/../Classes/PHPExcel.php");

// Create new PHPExcel object
echo date('H:i:s') . " Create new PHPExcel object\n";
$objPHPExcel = new PHPExcel();

// Set properties
echo date('H:i:s') . " Set properties\n";
$objPHPExcel->getProperties()->setCreator("Maarten Balliauw")
->setLastModifiedBy("Maarten Balliauw")
->setTitle("Office 2007 XLSX Test Document")
->setSubject("Office 2007 XLSX Test Document")
->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.")
->setKeywords("office 2007 openxml php")
->setCategory("Test result file");
// Add some data
echo date('H:i:s') . " Add some data\n";
$objPHPExcel->setActiveSheetIndex(0)
->setCellValue('A1', 'Hello')
->setCellValue('B2', 'world!')
->setCellValue('C1', 'Hello')
->setCellValue('D2', 'world!');

// Miscellaneous glyphs, UTF-8
$objPHPExcel->setActiveSheetIndex(0)
->setCellValue('A4', 'Miscellaneous glyphs')
->setCellValue('A5', 'éàèùâêîôûëïüÿäöüç');

// Rename sheet
echo date('H:i:s') . " Rename sheet\n";
$objPHPExcel->getActiveSheet()->setTitle('Simple');


// Set active sheet index to the first sheet, so Excel opens this as the first sheet
$objPHPExcel->setActiveSheetIndex(0);


// Save Excel 2007 file
echo date('H:i:s') . " Write to Excel2007 format\n";


$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter ->save(str_replace('.php','.xlsx',__FILE__)); // Here I got error. excel file not save.

// Echo memory peak usage
echo date('H:i:s') . " Peak memory usage: " . (memory_get_peak_usage(true) / 1024 / 1024) . " MB\r\n";


// Echo done
echo date('H:i:s') . " Done writing file.\r\n";
exit;
?>

On Fri, Feb 25, 2011 at 7:15 AM, MarkBaker <notifications@codeplex.com> wrote:

From: MarkBaker

PHPExcel doesn't have any messages like "This Page appears broken", so I can't suggest much to help without knowing what your code might be doing.

Read the full discussion online.

To add a post to this discussion, reply to this email (PHPExcel@discussions.codeplex.com)

To start a new discussion for this project, email PHPExcel@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on CodePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at CodePlex.com





Coordinator
Feb 28, 2011 at 8:25 PM

Are you setting the correct headers when sending the file to the browser?

Look at 01simple-download-xls.php and 01simple-download-xlsx.php for examples, and ensure that there are no echoes in your script

Mar 1, 2011 at 1:57 AM
Hello MarkBaker,

Thanks for your reply.
This junk data save problem in 01simple-download-xls.php.
I just change then root path.I didn't change any other code.
Herewith i enclose my code. please check it out. and please guide me.

thanks,
thenndral



On Tue, Mar 1, 2011 at 6:25 AM, MarkBaker <notifications@codeplex.com> wrote:

From: MarkBaker

Are you setting the correct headers when sending the file to the browser?

Look at 01simple-download-xls.php and 01simple-download-xlsx.php for examples, and ensure that there are no echoes in your script

Read the full discussion online.

To add a post to this discussion, reply to this email (PHPExcel@discussions.codeplex.com)

To start a new discussion for this project, email PHPExcel@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on CodePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at CodePlex.com


Feb 19, 2014 at 9:13 AM
I got the same problem (ma not all the times...., so it cannot be a permission problem).
The reason why we got "This Page appears broken" is that the script dies on the save.
    $objWriter = new PHPExcel_Writer_Excel2007($objPHPExcel);
    $objWriter->setOffice2003Compatibility(true);
    $objWriter->save($file_name . "tmp");
Thanks for your help.
Feb 19, 2014 at 9:15 AM
By the way, is there any way to catch the error and then try to save file in other formats (for example?).
Otherwise all data are lost.... !!!!