예제 #1
0
 /**
  *  pre configuration of csv file
  */
 protected function init()
 {
     $this->csvWriter->setDelimiter("\t");
     //the delimiter will be the tab character
     $this->csvWriter->setNewline("\r\n");
     //use windows line endings for compatibility with some csv libraries
     $this->csvWriter->setEncodingFrom("utf-8");
 }
예제 #2
0
 /**
  * Prepare the writer.
  */
 public function prepare()
 {
     if (!$this->csv) {
         $this->csv = Writer::createFromFileObject(new SplFileObject($this->filename, 'w'));
         $this->csv->setDelimiter($this->delimiter);
         $this->csv->setEnclosure($this->enclosure);
     }
     if ($this->header !== null) {
         $this->writeItem($this->header);
     }
 }