How can I set parts of the text font bold in one cell

Topics: User Forum
Aug 24, 2011 at 6:29 AM


Now suppose the text of cell A1 is 'Dear Amy,Thank you for using!'

I just want to set the font of text 'Dear Amy'  to be bold

What should I do.

Aug 24, 2011 at 9:57 AM
Edited Aug 24, 2011 at 9:59 AM

before you set the value into cell, write this


Aug 24, 2011 at 10:01 AM


Thank you for answer,

But I only want to set 'Dear Amy' to be bold except 'Thank you for using!'

And they are in the same cell

Aug 24, 2011 at 12:55 PM

You would do something like this...

$objRichText = new PHPExcel_RichText();

$objBold = $objRichText->createTextRun("Dear Amy");

$objNormal = $objRichText->createTextRun(",Thank you for using!");

$data = $objRichText;

Aug 25, 2011 at 2:04 AM


Thank you for your answer.

I tried to use the coding which you have mentioned,but it didn't work. 

Maybe it does not support for Rich-Text in PHPExcel_Writer_Excel5

It means that I can not set the style like that in the same cell,doesn't it?

Aug 25, 2011 at 1:29 PM

Hmm, you're right -- I can only see the rich text in Excel 2007. :(

Aug 25, 2011 at 1:34 PM
Edited Aug 25, 2011 at 1:35 PM

Oh, here's why: