如何使用 PHPExcel 创建粗体单元格值?我知道我可以使用\n 在文本中添加回车符,但是是否有某种方法可以将单元格值的一部分加粗?我也尝试过使用 html 格式,例如 或 但它没有用。
最佳答案
您可以使用富文本格式将单元格中的部分文本加粗,如开发人员文档第 4.6.37 节所述。
$objRichText = new PHPExcel_RichText();
$objRichText->createText('This text is ');
$objBold = $objRichText->createTextRun('bold');
$objBold->getFont()->setBold(true);
$objRichText->createText(' within the cell.');
$objPHPExcel->getActiveSheet()->getCell('A18')->setValue($objRichText);
关于PHPExcel - 如何使部分文本加粗,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8045056/