3
This method creates an Excel spreadsheet, with int
and string
:
public function arrayToXls($input) {
// BoF
$ret = pack('ssssss', 0x809, 0x8, 0x0, 0x10, 0x0, 0x0);
// array_values is used to ensure that the array is numerically indexed
foreach (array_values($input) as $lineNumber => $row) {
foreach (array_values($row) as $colNumber => $data) {
if (is_numeric($data)) {
// number, store as such
$ret .= pack('sssssd', 0x203, 14, $lineNumber, $colNumber, 0x0, $data);
} else {
// everything else store as string
$len = strlen($data);
$ret .= pack('ssssss', 0x204, 8 + $len, $lineNumber, $colNumber, 0x0, $len) . $data;
}
}
}
//EoF
$ret .= pack('ss', 0x0A, 0x00);
return $ret;
}
I would like to add an image, could help in the change I need to make this line for this?
$ret .= pack('ssssss', 0x204, 8 + $len, $lineNumber, $colNumber, 0x0, $len) . $data;
And I also need to change the color of the linhs
$ret .= pack('ss', 0x0A, 0x00);
Does anyone have any documentation or have ever done this?
I’m not familiar with php, but if you’re using Spreadsheet_excel_writer check out http://pear.php.net/manual/en/package.fileformats.spreadsheet-excel-writer.php, it might help.
– Paulo Balbino