Writing HTML as Rich Text

Topics: Developer Forum, User Forum
May 21, 2014 at 4:23 PM

I'm trying to write HTML into an excel document and have it appear in proper formatting. For instance, if a word appears inside <sup> tags, the word should appear in the excel document with superscript formatting. I have been trying to replace one type of tag and then another, but it erases my previous formatting (my code is below).
$tagCount1 = preg_match_all('/<sup[^>]*>(.*?)<\/sup>/is', $value1, $matches1);
$tagSplit1 = preg_split('/<sup[^>]*>(.*?)<\/sup>/is', $value1);
$objRichText1 = new PHPExcel_RichText();
    $objModified1 = $objRichText1->createTextRun($matches1[1][$k]);
$testValue = $objPHPExcel->getActiveSheet()->getCell($column.$row)->getFormattedValue();
The $testValue does not contain the original formatting that I had done to it (the superscript in this case). Anyone know why this is happening or if there is an easier to write HTML as Rich Text?