public function Excel_XML::generateXML in Ubercart CSV 6.2
Same name and namespace in other branches
- 7.2 inc/excel-export.inc \Excel_XML::generateXML()
Generate the excel file
Parameters
string $filename Name of excel file to generate (...xls):
File
- inc/
excel-export.inc, line 153
Class
- Excel_XML
- Generating excel documents on-the-fly from PHP5
Code
public function generateXML($filename = 'excel-export') {
// correct/validate filename
$filename = preg_replace('/[^aA-zZ0-9\\_\\-]/', '', $filename);
// deliver header (as recommended in php manual)
header("Content-Type: application/vnd.ms-excel; charset=" . $this->sEncoding);
header("Content-Disposition: inline; filename=\"" . $filename . ".xls\"");
// print out document to the browser
// need to use stripslashes for the damn ">"
echo stripslashes(sprintf($this->header, $this->sEncoding));
echo "\n<Worksheet ss:Name=\"" . $this->sWorksheetTitle . "\">\n<Table>\n";
foreach ($this->lines as $line) {
echo $line;
}
echo "</Table>\n</Worksheet>\n";
echo $this->footer;
}