SimpleExcel_Writer_XML -> saveToFile($data);
cristobal opened this issue · 1 comments
cristobal commented
When using the XML variant for the library and setting the data directly for the writer using the setData
method instead of the adding the items trough the addRow
method. All the items will only get outputted as an Array
string in the resulting xml output.
Resulting in something like this:
<?xml version="1.0"?>
…
<Worksheet ss:Name="Sheet1">
<Table>Array
</Table>
</Worksheet>
</Workbook>
A solution to this is to modify the setData
method to instead:
public function setData($values){
if(!is_array($values)){
$values = array($values);
}
$this->xml_data = ""; // reset the xml data.
// append values as rows
foreach ($values as $value) {
$this->addRow($value);
}
}
Thanks for the library btw.
Great work :)
faisalman commented
Hi Cristobal thanks for the fix :) I guess I should write a test for this lib