Home >Backend Development >PHP Tutorial >objrichtext-PHPExcel中独立字体块$objRichText设置字体不起作用

objrichtext-PHPExcel中独立字体块$objRichText设置字体不起作用

WBOY
WBOYOriginal
2016-06-02 11:34:311338browse

objrichtextphpphpexcel字体效果不能显示

$objPHPExcel = new PHPExcel();
$objPHPExcel->getActiveSheet()->getDefaultStyle()->getFont()->setSize(11)->setName('UTF-8');

$objPHPExcel->getActiveSheet()->setTitle('sheet1');

$sheet = $objPHPExcel->setActiveSheetIndex(0);

$objRichText = new PHPExcel_RichText();
$objRichText->createText('');
$objPayable = $objRichText->createTextRun('红色字体');
$objPayable->getFont()->setColor(new PHPExcel_Style_Color(PHPExcel_Style_Color::COLOR_RED ));
$sheet->setCellValue('E6', '后面是红色字体:'.$objRichText);

上面是我的代码。
结果是objPayable中的文字能显示,但是给他加的任何字体效果都不能显示。
百思不得解了,求助

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn