diff --git a/README.md b/README.md index 11e0d82..6d8fdb8 100644 --- a/README.md +++ b/README.md @@ -144,15 +144,16 @@ $xlsx->rightToLeft(); // Set Meta Data Files // this data in propertis Files and Info file in Office -$xlsx->setAuthor("Sergey Shuchkin") -$xlsx->setCompany("Sergey Shuchkin Company") -$xlsx->setManager("Sergey Shuchkin Manager") -$xlsx->setTitle("This is Title") -$xlsx->setSubject("This is Subject") -$xlsx->setKeywords("Keywords1, Keywords2, Keywords3, KeywordsN") -$xlsx->setDescription("This is Description") -$xlsx->setCategory("This is Сategory") -$xlsx->setApplication("This Is Best Application For Generate") +$xlsx->setAuthor('Sergey Shuchkin ') + ->setCompany('Microsoft ') + ->setManager('Bill Gates ') + ->setLastModifiedBy("Sergey Shuchkin ") + ->setTitle('This is Title') + ->setSubject('This is Subject') + ->setKeywords('Keywords1, Keywords2, Keywords3, KeywordsN') + ->setDescription('This is Description') + ->setCategory('This is Сategory') + ->setApplication('Shuchkin\SimpleXLSXGen') ``` ### JS array to Excel (AJAX) ```php diff --git a/src/SimpleXLSXGen.php b/src/SimpleXLSXGen.php index 1233d26..2ee9e0f 100644 --- a/src/SimpleXLSXGen.php +++ b/src/SimpleXLSXGen.php @@ -39,6 +39,7 @@ class SimpleXLSXGen protected $application; protected $keywords; protected $category; + protected $lastModifiedBy; const N_NORMAL = 0; // General const N_INT = 1; // 0 const N_DEC = 2; // 0.00 @@ -92,12 +93,13 @@ class SimpleXLSXGen { $this->subject = ''; $this->title = ''; - $this->author = 'Sergey Shuchkin'; - $this->company = 'Sergey Shuchkin'; - $this->manager = 'Sergey Shuchkin'; + $this->author = 'Sergey Shuchkin '; + $this->company = 'Sergey Shuchkin '; + $this->manager = 'Sergey Shuchkin '; $this->description = ''; $this->keywords = ''; $this->category = ''; + $this->lastModifiedBy = 'Sergey Shuchkin '; $this->application = __CLASS__; $this->curSheet = -1; @@ -160,6 +162,7 @@ class SimpleXLSXGen {TITLE} {SUBJECT} {AUTHOR} + {LAST_MODIFY_BY} {KEYWORD} {DESCRIPTION} {CATEGORY} @@ -342,19 +345,19 @@ class SimpleXLSXGen $s .= ''; } $search = ['{SHEETS}', '{APP}']; - $replace = [$s, $this->application]; + $replace = [$s, $this->esc($this->application)]; $template = str_replace($search, $replace, $template); $this->_writeEntry($fh, $cdrec, $cfilename, $template); $entries++; } elseif ($cfilename === 'docProps/app.xml') { $search = ['{APP}', '{COMPANY}', '{MANAGER}']; - $replace = [$this->application, $this->company, $this->manager]; + $replace = [$this->esc($this->application), $this->esc($this->company), $this->esc($this->manager)]; $template = str_replace($search, $replace, $template); $this->_writeEntry($fh, $cdrec, $cfilename, $template); $entries++; } elseif ($cfilename === 'docProps/core.xml') { - $search = ['{DATE}', '{AUTHOR}', '{TITLE}', '{SUBJECT}', '{KEYWORD}', '{DESCRIPTION}', '{CATEGORY}']; - $replace = [gmdate('Y-m-d\TH:i:s\Z'), $this->author, $this->title, $this->subject, $this->keywords, $this->description, $this->category]; + $search = ['{DATE}', '{AUTHOR}', '{TITLE}', '{SUBJECT}', '{KEYWORD}', '{DESCRIPTION}', '{CATEGORY}', '{LAST_MODIFY_BY}']; + $replace = [gmdate('Y-m-d\TH:i:s\Z'), $this->esc($this->author), $this->esc($this->title), $this->esc($this->subject), $this->esc($this->keywords), $this->esc($this->description), $this->esc($this->category), $this->esc($this->lastModifiedBy)]; $template = str_replace($search, $replace, $template); $this->_writeEntry($fh, $cdrec, $cfilename, $template); $entries++; @@ -1070,6 +1073,12 @@ class SimpleXLSXGen return $this; } + public function setLastModifiedBy($lastModifiedBy) + { + $this->lastModifiedBy = $lastModifiedBy; + return $this; + } + public function autoFilter($range) { $this->sheets[$this->curSheet]['autofilter'] = $range;