我试图加粗文本但我没有这样做,原因我真的不知道,我已经按照 PHPExcel 文档中的步骤操作,但没有结果,这是我的代码:
require_once './classes/PHPExcel.php';
Create new PHPExcel object
$objPHPExcel = new PHPExcel();
include('./classes/PHPExcel/Writer/Excel5.php');
$objPHPExcel->getActiveSheet()->mergeCells('A1:k1');
$objPHPExcel->getActiveSheet()->getColumnDimension('A')->setWidth(25);
$objPHPExcel->getActiveSheet()->getColumnDimension('B')->setWidth(18);
$objPHPExcel->getActiveSheet()->getColumnDimension('C')->setWidth(18);
$objPHPExcel->getActiveSheet()->getColumnDimension('D')->setWidth(18);
$objPHPExcel->getActiveSheet()->getColumnDimension('E')->setWidth(40);
$objPHPExcel->getActiveSheet()
->setcellValue('A25', "Answer")
->setcellValue('B25', "Surname")
->setcellValue('C25', "Name")
->setcellValue('D25', "Contact Number")
->setcellValue('E25', "Comment");
//some stuff in between...
//problem starts here...
$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);