php - Read Excel Data (Rich Excel Data) -
i want read data form excel file , show in html. know there several libraries phpexcel, php-exelreader so.
but, want keep format in excel file.
example :
−19×10−17 j should parsed −19×10<sup>−17</sup> j
and
m1r1 : m2r2 m<sub>1</sub>r<sub>1</sub> : m<sub>2</sub>r<sub>2</sub>
.
is there library so? have googled did not solution this. please recommend libraries or tutorial task.
any highly appreciated.
update - want store data in database.
got solution. it's phpexcel.
while fetching values cells, did following.
$value = $cell->getvalue(); if($value instanceof phpexcel_richtext) { $cellvalueasstring = ''; $elements = $value->getrichtextelements(); foreach ($elements $element) { if ($element instanceof phpexcel_richtext_run) { if ($element->getfont()->getsuperscript()) { $cellvalueasstring .= '<sup>'; } else if ($element->getfont()->getsubscript()) { $cellvalueasstring .= '<sub>'; } } $celltext = $element->gettext(); $cellvalueasstring .= htmlspecialchars($celltext); if ($element instanceof phpexcel_richtext_run) { if ($element->getfont()->getsuperscript()) { $cellvalueasstring .= '</sup>'; } else if ($element->getfont()->getsubscript()) { $cellvalueasstring .= '</sub>'; } } } $value = $cellvalueasstring; }
Comments
Post a Comment