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 you help with the change I need to make in 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 line
$ret .= pack('ss', 0x0A, 0x00);
Does anyone have any documentation or have you already done this?