FAQ
Edit report at http://pear.php.net/bugs/bug.php?id=11133&edit=1

ID: 11133
Updated by: daniel.oconnor@gmail.com
Reported By: leclat at hotmail dot com
Summary: Invalid File Format
-Status: Feedback
+Status: No Feedback
Type: Bug
Package: Spreadsheet_Excel_Writer
Operating System: Windows XP
Package Version: 0.9.1
PHP Version: 5.1.4
Roadmap Versions:
New Comment:

-Status: Feedback
+Status: No Feedback



Previous Comments:
------------------------------------------------------------------------

[2009-11-29 17:50:55] cschmitz

-Status: Open
+Status: Feedback
Thank you for taking the time to report a problem with the package.
Unfortunately you are not using a current version of the package --
the problem might already be fixed. Please download a new
version from http://pear.php.net/packages.php

If you are able to reproduce the bug with one of the latest
versions, please change the package version on this bug report
to the version you tested and change the status back to "Open".
Again, thank you for your continued support of PEAR.

------------------------------------------------------------------------

[2008-03-22 09:46:56] doconnor

OOO 2.3.1 (windows) just to be specific

------------------------------------------------------------------------

[2008-03-22 09:44:50] doconnor

Doing

<?php

// Include PEAR::Spreadsheet_Excel_Writer
require_once "Spreadsheet/Excel/Writer.php";

// Create an instance
$xls =& new Spreadsheet_Excel_Writer();

$xls->setVersion(8);

// Send HTTP headers to tell the browser what's coming
$xls->send("test.xls");

// Add a worksheet to the file, returning an object to add data to
$sheet =& $xls->addWorksheet('Binary Count');

// Write some numbers
for ( $i=0;$i<11;$i++ ) {
// Use PHP's decbin() function to convert integer to binary
$sheet->writeString($i,0,decbin($i));
}

// Finish the spreadsheet, dumping it to the browser
ob_start();
$xls->close();
file_put_contents("bug-11133.xls", ob_get_clean());
?>

Works for me with OpenOffice.

------------------------------------------------------------------------

[2007-05-24 15:38:14] leclat

Description:
------------
While I think this package is fantastic I've noticed a problem with it.
I can produce a file that MS Excel will open but technically the file
that is output is not 100% compliant with Excel standards. Produce a
file open it in Excel then save a copy of it. If you do a binary
comparison of the two files you will notice some descrepencies in the
header and the footer sections of the two files.

I noticed this issue because a client of mine is using QuickView Plus.
QVP is a tool that can view many types of files. My client has it
associated with Internet Explorer so when IE sees the MIME type
vnd.ms-excel instead of putting Excel in the browser it tries to use QVP
instead. The problem I have is that QVP can't recognize the file because
the headers are not 100% what it expects for an Excel file. Since QVP
thinks the file is corrupt the user's options are either Save or
Cancel.

A 30 day trial of QuickView Plus can be downloaded to evaluate this.


Test script:
---------------
<?php

// Include PEAR::Spreadsheet_Excel_Writer
require_once "Spreadsheet/Excel/Writer.php";

// Create an instance
$xls =& new Spreadsheet_Excel_Writer();

$xls->setVersion(8);

// Send HTTP headers to tell the browser what's coming
$xls->send("test.xls");

// Add a worksheet to the file, returning an object to add data to
$sheet =& $xls->addWorksheet('Binary Count');

// Write some numbers
for ( $i=0;$i<11;$i++ ) {
// Use PHP's decbin() function to convert integer to binary
$sheet->writeString($i,0,decbin($i));
}

// Finish the spreadsheet, dumping it to the browser
$xls->close();
?>

Expected result:
----------------
The file is opened as an Excel file in QuickView Plus.

Actual result:
--------------
As stated in the description QuickView Plus doesn't recognize the file
as a "valid" Excel file and therefore the user has two options, Save or
Cancel.

------------------------------------------------------------------------

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppear-bugs @
categoriesphp
postedSep 29, '11 at 8:14a
activeSep 29, '11 at 8:14a
posts1
users1
websitepear.php.net

1 user in discussion

Daniel Oconnor: 1 post

People

Translate

site design / logo © 2022 Grokbase