clownglove / php-excel

Automatically exported from code.google.com/p/php-excel
MIT License
0 stars 0 forks source link

XML entities are not encoded #9

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. put text containing an: ampersand, apostrophe, double-quote, less-than
and/or greater-than in the data for a cell.
2. Excel will fail to read the resulting file, complaining that illegal XML
characters are found.

Please provide any additional information below.

Text in cells must be XML encoded using:
str_replace(''', ''', htmlspecialchars($text, ENT_QUOTES));

Original issue reported on code.google.com by gmea...@gmail.com on 28 Oct 2008 at 9:29

GoogleCodeExporter commented 8 years ago
hi,

Any idea to modify or update the existing excel file with php?

Thanks

Original comment by almight...@gmail.com on 3 Jul 2009 at 8:02

GoogleCodeExporter commented 8 years ago
@gmeader: Thanks for this report. I am currently trying to address this issue in
version 2:

http://code.google.com/p/php-excel/source/browse/#svn/branches/version02

However, I still need a conversion table to quickly convert special characters 
to the
necessary representation in the used charset. This is a performance issue since
larger arrays will create quite some heavy load when trying to convert every 
single cell.

@almightyad: Modifications will only be possible as long as the file has not 
been
converted to the binary xls-format. It's a great idea, however. It should not 
be too
difficult to read out the Excel-XML into an array using SimpleXML, then making
changes to the structures and values and deliver the result again in an excel
document. I need to think about it.

Original comment by oliver.s...@gmail.com on 10 Sep 2009 at 10:04

GoogleCodeExporter commented 8 years ago
I will address this issue with a new version and/or a patch for version 1.

Original comment by oliver.s...@gmail.com on 10 Sep 2009 at 12:27

GoogleCodeExporter commented 8 years ago
I've tried to fix this with version 1.1. However, I still need to test this
thoroughly. Check the download section at:

http://code.google.com/p/php-excel/downloads/list

Original comment by oliver.s...@gmail.com on 10 Sep 2009 at 2:26

GoogleCodeExporter commented 8 years ago

Original comment by oliver.s...@gmail.com on 10 Sep 2009 at 3:53

GoogleCodeExporter commented 8 years ago
I'm using the following version shipped with a Drupal module to output Excel 
files...

// $Id: php-excel.class.php,v 1.1.2.1 2009/11/04 17:22:40 jkarsum Exp $

... and am seeing this same issue. I notice the addRow function calls 
htmlentities in
order to generate valid XML, but am confused as to why Excel doesn't decode 
these
properly.

Original comment by raint...@gmail.com on 29 Apr 2010 at 6:49