d_excel_reader_writer.php (1481B)
1 <?php 2 use d_excel_reader_writer\XLSXWriter; 3 use d_excel_reader_writer\SpreadsheetReader; 4 5 class d_excel_reader_writer { 6 private $writer; 7 private $reader; 8 9 public function __construct() { 10 $this->writer = new XLSXWriter(); 11 } 12 13 public function setAuthor($author = '') { 14 $this->writer->setAuthor($author); 15 } 16 17 public function setTempDir($tempdir = '') { 18 $this->writer->setTempDir($tempdir); 19 } 20 21 public function setDefaultColumnWidth($columnWidth) { 22 $this->writer->setDefaultColumnWidth($columnWidth); 23 } 24 25 public function setColumnWidths($columnWidths) { 26 $this->writer->setColumnWidths($columnWidths); 27 } 28 29 public function writeSheet($data) { 30 $this->writer->writeSheet($data); 31 } 32 33 public function writeSheetHeader($sheet_name, array $header_types, $suppress_row = false) { 34 $this->writer->writeSheetHeader($sheet_name, $header_types, $suppress_row); 35 } 36 37 public function writeSheetRow($sheet_name, array $row, $style = null) { 38 $this->writer->writeSheetRow($sheet_name, $row, $style); 39 } 40 41 public function writeToStdOut() { 42 return $this->writer->writeToStdOut(); 43 } 44 45 public function writeToString() { 46 return $this->writer->writeToString(); 47 } 48 49 public function writeToFile($filename) { 50 $this->writer->writeToFile($filename); 51 } 52 53 public function readFromFile($filepath, $original_filename = false, $mimetype = false) { 54 $this->reader = new SpreadsheetReader($filepath, $original_filename, $mimetype); 55 56 return $this->reader; 57 } 58 } 59 ?>