mirror of
https://github.com/retailcrm/PHPExcel.git
synced 2024-11-22 21:36:05 +03:00
Modified some of the examples to show rich text and additional download headers that might be needed
This commit is contained in:
parent
4e8dea7883
commit
4d9258c9e1
@ -75,6 +75,14 @@ $objPHPExcel->setActiveSheetIndex(0);
|
||||
header('Content-Type: application/vnd.ms-excel');
|
||||
header('Content-Disposition: attachment;filename="01simple.xls"');
|
||||
header('Cache-Control: max-age=0');
|
||||
// If you're serving to IE 9, then the following may be needed
|
||||
header('Cache-Control: max-age=1');
|
||||
|
||||
// If you're serving to IE over SSL, then the following may be needed
|
||||
header ('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past
|
||||
header ('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); // always modified
|
||||
header ('Cache-Control: cache, must-revalidate'); // HTTP/1.1
|
||||
header ('Pragma: public'); // HTTP/1.0
|
||||
|
||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
|
||||
$objWriter->save('php://output');
|
||||
|
@ -109,6 +109,17 @@ $objPHPExcel->getActiveSheet()->getStyle('C11')->getNumberFormat()->setFormatCod
|
||||
$objPHPExcel->getActiveSheet()->setCellValue('A12', 'NULL')
|
||||
->setCellValue('C12', NULL);
|
||||
|
||||
$objRichText = new PHPExcel_RichText();
|
||||
$objRichText->createText('你好 ');
|
||||
$objPayable = $objRichText->createTextRun('你 好 吗?');
|
||||
$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()->setCellValue('A13', 'Rich Text')
|
||||
->setCellValue('C13', $objRichText);
|
||||
|
||||
$objPHPExcel->getActiveSheet()->getColumnDimension('B')->setAutoSize(true);
|
||||
$objPHPExcel->getActiveSheet()->getColumnDimension('C')->setAutoSize(true);
|
||||
|
@ -109,6 +109,19 @@ $objPHPExcel->getActiveSheet()->getStyle('C11')->getNumberFormat()->setFormatCod
|
||||
$objPHPExcel->getActiveSheet()->setCellValue('A12', 'NULL')
|
||||
->setCellValue('C12', NULL);
|
||||
|
||||
$objRichText = new PHPExcel_RichText();
|
||||
$objRichText->createText('你好 ');
|
||||
|
||||
$objPayable = $objRichText->createTextRun('你 好 吗?');
|
||||
$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()->setCellValue('A13', 'Rich Text')
|
||||
->setCellValue('C13', $objRichText);
|
||||
|
||||
|
||||
$objPHPExcel->getActiveSheet()->getColumnDimension('B')->setAutoSize(true);
|
||||
$objPHPExcel->getActiveSheet()->getColumnDimension('C')->setAutoSize(true);
|
||||
|
Loading…
Reference in New Issue
Block a user