Special character not supporting in superscript/subscript in Richhtml

Topics: User Forum
Jul 23, 2012 at 6:45 AM


I am in the need to use Special character in superscript. I am using the below code to make an special character to superscript but i am getting junk character in the excel while writing. So please any one can me guide to handle special character in in superscript and subscript.

Sample code : 

$vString = "Testing by Sãravanan";
$vTagStr = "†";
$objRichText = new PHPExcel_RichText();
$objBold = $objRichText->createTextRun($vTagStr);
$vFileName = "sample.xls";
header('Content-Encoding: UTF-8');
header('Content-Type: application/vnd.ms-excel'); //mime type
header('Content-Disposition: attachment;filename="'.$vFileName.'"'); //tell browser what's the file name
header('Cache-Control: max-age=0'); //no cache
$objWriter = PHPExcel_IOFactory::createWriter($this->excel, 'Excel5');
//force user to download the Excel file without writing it to server's HD





Jul 23, 2012 at 8:09 AM

Are you sure your PHP file is encoded as UTF-8? (without BOM)

Jul 23, 2012 at 8:35 AM

Thanks for your quick reply. Ya i am sure, since without using superscript/subscript, special characters coming without no issues.

Sep 24, 2012 at 7:31 PM

Try your character as an HTML entity, then run html_entity_decode() on it.