Rich text not working

Topics: Developer Forum
Jul 29, 2010 at 6:52 PM
Edited Jul 29, 2010 at 7:09 PM
Hi, I've tried to add some rich text fields to a document but it shows just as plain text. I've copied the code from the documentation

$objRichText =new PHPExcel_RichText( $objPHPExcel->getActiveSheet()->getCell('A18') );
$objRichText->createText('This invoice is ');

$objPayable = $objRichText->createTextRun('payable within thirty days after the end of the month');
$objPayable->getFont()->setBold(true);
$objPayable->getFont()->setItalic(true);
$objPayable->getFont()->setColor( new PHPExcel_Style_Color( PHPExcel_Style_Color::COLOR_DARKGREEN ) );

$objRichText->createText(', unless specified otherwise on the invoice.');

This puts the text into the cell but without formatting.

When I tried

$objRichText = new PHPExcel_RichText();
$objRichText->createText('This invoice is ');

$objPayable = $objRichText->createTextRun('payable within thirty days after the end of the month');
$objPayable->getFont()->setBold(true);
$objPayable->getFont()->setItalic(true);
$objPayable->getFont()->setColor( new PHPExcel_Style_Color( PHPExcel_Style_Color::COLOR_DARKGREEN ) );

$objRichText->createText(', unless specified otherwise on the invoice.');

$objPHPExcel->getActiveSheet()->getCell('A18')->setValue($objRichText);

the script didn't even finish nor has shown any error.

Do you have any suggestions?

Thanks
Mar 2, 2011 at 9:17 AM

It seems to be work only for the Excel2007 format

Coordinator
Mar 2, 2011 at 7:59 PM

Work Item 8916. This is a known issue.