我想使用 PHPExcel 让文本在 1 个单元格内具有不同的颜色,但我找不到有关它的信息。是否可以?
我相信它可以从 xls 中完成,但是可以在 PHPExcel 中使用编程来完成吗?
是的,可以使用 Rich Text 对象在 PHPExcel 中完成。
它们被描述在PHPExcel 文档并且有提供的例子
$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);
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)