Reputation: 923
im trying to bold text but im failing to do so, for a reason i realy dont know, i have followed steps in the documentation of PHPExcel, but to no result, here is my code:
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);
Upvotes: 0
Views: 5696
Reputation: 212402
Upgrading from release 1.7.2 to a more recent version that includes support for Rich Text in the Excel5 writer might help... version 1.7.2 is nearly 3-years old. 1.7.7 is the current production release, with 1.7.8 already overdue but available on github.
This was Work item #8916 on the Issues list, and support was added in production release 1.7.7
Upvotes: 1