Closed Dmo3 closed 1 year ago
I'd be grateful to learn the answer too...
<?php
include_once("XlsWriter.class.php");
$header = [
'created' => 'date',
'product_id' => 'integer',
'quantity' => '#,##0',
'amount' => 'price',
'description' => 'string',
'tax' => '[$$-1009]#,##0.00;[RED]-[$$-1009]#,##0.00',
];
$data = [
['2015-01-01', 873, 1, '44.00', 'misc', '=D2*0.05'],
['2015-01-12', 324, 2, '88.00', 'none', '=D3*0.05'],
];
$writer = new XLSXWriter();
$styles = [
'widths' => [3, 20, 30, 40],
'font' => 'Arial', 'font-size' => 10,
'font-style' => 'bold', 'fill' => '#eee',
'halign' => 'center', 'border' => 'left,right,top,bottom',
];
$styles2 = [
['font' => 'Arial', 'font-size' => 10, 'font-style' => 'bold', 'halign' => 'left', 'border' => 'left,right,top,bottom', 'fill' => '#ffc'],
['fill' => '#fcf'],
['fill' => '#fcf'],
['fill' => '#fcf'],
['fill' => '#ccf'],
['fill' => '#cff'],
];
$writer->writeSheetHeader('Sheet1', $header,$styles);
foreach ($data as $row)
$writer->writeSheetRow('Sheet1', $row, $styles2);
$writer->writeToFile('example1.xlsx');
see examples/ex03-styles.php
Hi,
Is there any option that allows me to specify the style for a specific word in the string of cell
Like this
italic with some bold text
?