« Programmation PHP/PHPExcel » : différence entre les versions

Contenu supprimé Contenu ajouté
Ligne 58 :
 
== Modifications ==
Les propriétés des cellules sont présentées sous forme de tableaux multidimensionnels :
Propriétés des cellules.
<source lang=php>
{{...}}
$style = array(
'borders' => array(
'outline' => array(
'style' => PHPExcel_Style_Border::BORDER_THICK,
'color' => array('argb' => 'FFFF0000'),
),
),
'font' => array(
'bold' => true,
'name' => 'Tahoma',
'size' => 10,
'color' => array('rgb' => 'FF0000'),
),
'fill' => array(
'type' => PHPExcel_Style_Fill::FILL_SOLID,
'color' => array('rgb' => 'C3C3E5')
),
'alignment' => array(
'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_CENTER,
'vertical' => PHPExcel_Style_Alignment::VERTICAL_CENTER,
'wrap' => true // retour à la ligne automatique
)
);
 
// Ajout du style ci-dessus en feuille 2 d'un fichier existant
$objPHPExcel = new PHPExcel;
$writer = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$s = $objPHPExcel->createSheet();
$s->setTitle('Feuille style');
$s = $objPHPExcel->setActiveSheetIndex($objPHPExcel->getSheetCount()-1);
$s->setCellValue('A1','Hello style');
$s->getStyle('A1')->applyFromArray($style);
$writer->save('./HelloWorld4.xlsx');
</source>
 
== Références ==