test changes
This commit is contained in:
@@ -522,15 +522,24 @@ function booking_varietysessions_csv_report($timeslot_id) {
|
|||||||
header('Content-Transfer-Encoding: binary');
|
header('Content-Transfer-Encoding: binary');
|
||||||
header('Cache-Control: must-revalidate');
|
header('Cache-Control: must-revalidate');
|
||||||
header('Pragma: public');
|
header('Pragma: public');
|
||||||
$rows = array(
|
$data1 = array(
|
||||||
array('2003','1','-50.5','2010-01-01 23:00:00','2012-12-31 23:00:00'),
|
array('5','3'),
|
||||||
array('2003','=B1', '23.5','2010-01-01 00:00:00','2012-12-31 00:00:00'),
|
array('1','6'),
|
||||||
);
|
);
|
||||||
|
$data2 = array(
|
||||||
|
array('2','7','9'),
|
||||||
|
array('4','8','0'),
|
||||||
|
);
|
||||||
|
|
||||||
$writer = new XLSXWriter();
|
$writer = new XLSXWriter();
|
||||||
$writer->setAuthor('Some Author');
|
$writer->setAuthor('Doc Author');
|
||||||
foreach($rows as $row)
|
$writer->writeSheet($data1);
|
||||||
$writer->writeSheetRow('Sheet1', $row);
|
$writer->writeSheet($data2);
|
||||||
$writer->writeToStdOut();
|
echo $writer->writeToString();
|
||||||
|
|
||||||
|
//foreach($rows as $row)
|
||||||
|
// $writer->writeSheetRow('Sheet1', $row);
|
||||||
|
//$writer->writeToStdOut();
|
||||||
//$writer->writeToFile('example.xlsx');
|
//$writer->writeToFile('example.xlsx');
|
||||||
//echo $writer->writeToString();
|
//echo $writer->writeToString();
|
||||||
exit(0);
|
exit(0);
|
||||||
|
@@ -85,6 +85,24 @@ Class XLSXWriter
|
|||||||
return $string;
|
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)
|
public function writeToFile($filename)
|
||||||
{
|
{
|
||||||
@unlink($filename);//if the zip already exists, overwrite it
|
@unlink($filename);//if the zip already exists, overwrite it
|
||||||
|
Reference in New Issue
Block a user