Got invalid XLSX file, when symbol "&" happens in any field. Think it can be connected with XML restrictions.

Comments

d.novikov’s picture

The issue appeared due to è symbol in the data. Note, that Microsoft Excel opened file normally, but Google Docs and Libre Office - didn't. When I manually placed È instead of è, things had gone ok in Libre Office.

Probably the reason lays in php-excel.class.php, contributed with a module:

$v = htmlentities($v, ENT_COMPAT, $this->sEncoding);
$cells .= "<Cell><Data ss:Type=\"$type\">" . $v . "</Data></Cell>\n";

Result of htmlentities() output depends on PHP version and flags combination: php.net/manual/en/function.htmlentities.php#103486

creaoy’s picture

Status: Active » Closed (duplicate)

Duplicate 897830

sdjewani’s picture

i am using the same file, to export in excel, but i have a problem that html entities appears encoded , i want decoded html entity, any buddy can suggest how can i.

creaoy’s picture

Can you please provide more details? I will need data to test?
This was fixed in latest dev.

sdjewani’s picture

this is snap of my code
$v = htmlentities($v, ENT_COMPAT, $this->sEncoding);
$cells .= "" . $v . "\n";

this is working fine except it returns html entity code without converting it as " Immunomodulatory Drugs (IMiDs & # 8482;):"
but it should be like "Immunomodulatory Drugs (IMiDs™):".