test changes
This commit is contained in:
@@ -522,15 +522,24 @@ function booking_varietysessions_csv_report($timeslot_id) {
|
||||
header('Content-Transfer-Encoding: binary');
|
||||
header('Cache-Control: must-revalidate');
|
||||
header('Pragma: public');
|
||||
$rows = array(
|
||||
array('2003','1','-50.5','2010-01-01 23:00:00','2012-12-31 23:00:00'),
|
||||
array('2003','=B1', '23.5','2010-01-01 00:00:00','2012-12-31 00:00:00'),
|
||||
$data1 = array(
|
||||
array('5','3'),
|
||||
array('1','6'),
|
||||
);
|
||||
$data2 = array(
|
||||
array('2','7','9'),
|
||||
array('4','8','0'),
|
||||
);
|
||||
|
||||
$writer = new XLSXWriter();
|
||||
$writer->setAuthor('Some Author');
|
||||
foreach($rows as $row)
|
||||
$writer->writeSheetRow('Sheet1', $row);
|
||||
$writer->writeToStdOut();
|
||||
$writer->setAuthor('Doc Author');
|
||||
$writer->writeSheet($data1);
|
||||
$writer->writeSheet($data2);
|
||||
echo $writer->writeToString();
|
||||
|
||||
//foreach($rows as $row)
|
||||
// $writer->writeSheetRow('Sheet1', $row);
|
||||
//$writer->writeToStdOut();
|
||||
//$writer->writeToFile('example.xlsx');
|
||||
//echo $writer->writeToString();
|
||||
exit(0);
|
||||
|
@@ -85,6 +85,24 @@ Class XLSXWriter
|
||||
return $string;
|
||||
}
|
||||
|
||||
public function sanitize_filename($filename) //http://msdn.microsoft.com/en-us/library/aa365247%28VS.85%29.aspx
|
||||
{
|
||||
$nonprinting = array_map('chr', range(0,31));
|
||||
$invalid_chars = array('<', '>', '?', '"', ':', '|', '\\', '/', '*', '&');
|
||||
$all_invalids = array_merge($nonprinting,$invalid_chars);
|
||||
return str_replace($all_invalids, "", $filename);
|
||||
}
|
||||
//------------------------------------------------------------------
|
||||
public function sanitize_sheetname($sheetname)
|
||||
{
|
||||
static $badchars = '\\/?*:[]';
|
||||
static $goodchars = ' ';
|
||||
$sheetname = strtr($sheetname, $badchars, $goodchars);
|
||||
$sheetname = substr($sheetname, 0, 31);
|
||||
$sheetname = trim(trim(trim($sheetname),"'"));//trim before and after trimming single quotes
|
||||
return !empty($sheetname) ? $sheetname : 'Sheet'.((rand()%900)+100);
|
||||
}
|
||||
|
||||
public function writeToFile($filename)
|
||||
{
|
||||
@unlink($filename);//if the zip already exists, overwrite it
|
||||
|
Reference in New Issue
Block a user