Topics: Developer Forum, User Forum
Mar 31, 2014 at 11:30 PM

I have a problem with RichText an Excel5, PHPExcel version 1.8. With RichText I want to superscript some letters. This works fine for a few cells, but if I want to do that in more than 20 it fails. Not the creating of the excel file fails but if I try to open the file, a dialogue box tells me, that there are some mistakes and they try to repair it. At least some data are missing. If I split the dataset into two or more parts, there is no problem and it works fine. But at least I want to get one Excel-file with all data.

Do you have any hint for me?
           $val_string = "some value with m##3##";
            //condition superScript
            if (preg_match('/##(.+)##/i', $val_string, $result)) {
                $objRichText = new PHPExcel_RichText();
                $parts = explode("##", $val_string);
//this line is just my workaround :(
        $objCubed = $objRichText->createText($parts[0]."^".$parts[1].$parts[2]);
/* this code doesn't work for the whole dataset
        $objCubed = $objRichText->createText($parts[0]);
        $objCubed = $objRichText->createTextRun($parts[1]);
        $objCubed = $objRichText->createText($parts[2]);
            } else
                $objRichText = $val_string;
            $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($column, $row, $objRichText);
thanx in advance