From f54345fc371f172191cd065e31e6e5d48311b164 Mon Sep 17 00:00:00 2001 From: Erich Date: Tue, 22 Aug 2017 22:23:10 +0200 Subject: [PATCH 1/3] Update xlsxwriter.class.php added setTitle for setting the title in the properties --- xlsxwriter.class.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/xlsxwriter.class.php b/xlsxwriter.class.php index a3a97cd7d..bd901563c 100644 --- a/xlsxwriter.class.php +++ b/xlsxwriter.class.php @@ -12,6 +12,7 @@ class XLSXWriter const EXCEL_2007_MAX_ROW=1048576; const EXCEL_2007_MAX_COL=16384; //------------------------------------------------------------------ + protected $title ='Doc Title'; protected $author ='Doc Author'; protected $sheets = array(); protected $temp_files = array(); @@ -33,6 +34,7 @@ public function __construct() $this->addCellStyle($number_format='GENERAL', $style_string=null); } + public function setTitle($title='') { $this->title=$title; } public function setAuthor($author='') { $this->author=$author; } public function setTempDir($tempdir='') { $this->tempdir=$tempdir; } @@ -529,6 +531,7 @@ protected function buildCoreXML() $core_xml.=''."\n"; $core_xml.=''; $core_xml.=''.date("Y-m-d\TH:i:s.00\Z").'';//$date_time = '2014-10-25T15:54:37.00Z'; + $core_xml.=''.self::xmlspecialchars($this->title).''; $core_xml.=''.self::xmlspecialchars($this->author).''; $core_xml.='0'; $core_xml.=''; From fd6f1415ab583795e5854c1a27d27997da3f6993 Mon Sep 17 00:00:00 2001 From: Unamata Sanatarai Date: Thu, 30 Nov 2017 11:37:27 +0100 Subject: [PATCH 2/3] Removed unnecessary empty IF, updated cell reference --- example-cli.php | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/example-cli.php b/example-cli.php index 2df4d0b9e..2f0ca344d 100644 --- a/example-cli.php +++ b/example-cli.php @@ -5,19 +5,10 @@ error_reporting(E_ALL & ~E_NOTICE); $filename = "example.xlsx"; -$as_command_line = php_sapi_name()!='cli' ? true : false; -if () -{ - header('Content-disposition: attachment; filename="'.XLSXWriter::sanitize_filename($filename).'"'); - header("Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); - 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','=B2', '23.5','2010-01-01 00:00:00','2012-12-31 00:00:00'), + array('2003','=B1', '23.5','2010-01-01 00:00:00','2012-12-31 00:00:00'), ); $writer = new XLSXWriter(); $writer->setAuthor('Some Author'); @@ -25,7 +16,3 @@ $writer->writeSheetRow('Sheet1', $row); $writer->writeToFile('example.xlsx'); -//$writer->writeToStdOut(); -//echo $writer->writeToString(); -exit(0); - From 27a4f9d71003645dd6bd1c5f5b0a8537d913dbb3 Mon Sep 17 00:00:00 2001 From: mk-j Date: Sat, 2 Dec 2017 08:01:45 -0700 Subject: [PATCH 3/3] tweaking example.php --- example.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/example.php b/example.php index 5d315f4df..d76a8dc07 100644 --- a/example.php +++ b/example.php @@ -13,7 +13,7 @@ $rows = array( array('2003','1','-50.5','2010-01-01 23:00:00','2012-12-31 23:00:00'), - array('2003','=B2', '23.5','2010-01-01 00:00:00','2012-12-31 00:00:00'), + array('2003','=B1', '23.5','2010-01-01 00:00:00','2012-12-31 00:00:00'), ); $writer = new XLSXWriter(); $writer->setAuthor('Some Author');