Пример #1
0
 /**
  * Class constructor
  *
  * @param \PHPExcel\Spreadsheet $phpExcel The Workbook
  * @param int        &$str_total        Total number of strings
  * @param int        &$str_unique    Total number of unique strings
  * @param array        &$str_table        String Table
  * @param array        &$colors        Colour Table
  * @param mixed        $parser            The formula parser created for the Workbook
  */
 public function __construct(\PHPExcel\Spreadsheet $phpExcel, &$str_total, &$str_unique, &$str_table, &$colors, $parser)
 {
     // It needs to call its parent's constructor explicitly
     parent::__construct();
     $this->parser = $parser;
     $this->biffSize = 0;
     $this->palette = array();
     $this->countryCode = -1;
     $this->stringTotal =& $str_total;
     $this->stringUnique =& $str_unique;
     $this->stringTable =& $str_table;
     $this->colors =& $colors;
     $this->setPaletteXl97();
     $this->phpExcel = $phpExcel;
     // set BIFFwriter limit for CONTINUE records
     //        $this->_limit = 8224;
     $this->codepage = 0x4b0;
     // Add empty sheets and Build color cache
     $countSheets = $phpExcel->getSheetCount();
     for ($i = 0; $i < $countSheets; ++$i) {
         $phpSheet = $phpExcel->getSheet($i);
         $this->parser->setExtSheet($phpSheet->getTitle(), $i);
         // Register worksheet name with parser
         $supbook_index = 0x0;
         $ref = pack('vvv', $supbook_index, $i, $i);
         $this->parser->references[] = $ref;
         // Register reference with parser
         // Sheet tab colors?
         if ($phpSheet->isTabColorSet()) {
             $this->addColor($phpSheet->getTabColor()->getRGB());
         }
     }
 }
Пример #2
0
 /**
  * Store Worksheet data in memory using the parent's class append() or to a
  * temporary file, the default.
  *
  * @param string $data The binary data to append
  */
 function _append($data)
 {
     if ($this->_using_tmpfile) {
         // Add CONTINUE records if necessary
         if (strlen($data) > $this->_limit) {
             $data = $this->_add_continue($data);
         }
         fwrite($this->_filehandle, $data);
         $this->_datasize += strlen($data);
     } else {
         parent::_append($data);
     }
 }
Пример #3
0
 /**
  * Constructor
  *
  * @param int        &$str_total        Total number of strings
  * @param int        &$str_unique    Total number of unique strings
  * @param array        &$str_table        String Table
  * @param array        &$colors        Colour Table
  * @param mixed        $parser            The formula parser created for the Workbook
  * @param boolean    $preCalculateFormulas    Flag indicating whether formulas should be calculated or just written
  * @param string    $phpSheet        The worksheet to write
  * @param \PHPExcel\Worksheet $phpSheet
  */
 public function __construct(&$str_total, &$str_unique, &$str_table, &$colors, $parser, $preCalculateFormulas, $phpSheet)
 {
     // It needs to call its parent's constructor explicitly
     parent::__construct();
     // change BIFFwriter limit for CONTINUE records
     //        $this->_limit = 8224;
     $this->_preCalculateFormulas = $preCalculateFormulas;
     $this->stringTotal =& $str_total;
     $this->stringUnique =& $str_unique;
     $this->stringTable =& $str_table;
     $this->colors =& $colors;
     $this->parser = $parser;
     $this->phpSheet = $phpSheet;
     //$this->ext_sheets        = array();
     //$this->offset            = 0;
     $this->xlsStringMaxLength = 255;
     $this->columnInfo = array();
     $this->selection = array(0, 0, 0, 0);
     $this->activePane = 3;
     $this->_print_headers = 0;
     $this->outlineStyle = 0;
     $this->outlineBelow = 1;
     $this->outlineRight = 1;
     $this->outlineOn = 1;
     $this->fontHashIndex = array();
     // calculate values for DIMENSIONS record
     $minR = 1;
     $minC = 'A';
     $maxR = $this->phpSheet->getHighestRow();
     $maxC = $this->phpSheet->getHighestColumn();
     // Determine lowest and highest column and row
     //        $this->firstRowIndex = ($minR > 65535) ? 65535 : $minR;
     $this->lastRowIndex = $maxR > 65535 ? 65535 : $maxR;
     $this->firstColumnIndex = \PHPExcel\Cell::columnIndexFromString($minC);
     $this->lastColumnIndex = \PHPExcel\Cell::columnIndexFromString($maxC);
     //        if ($this->firstColumnIndex > 255) $this->firstColumnIndex = 255;
     if ($this->lastColumnIndex > 255) {
         $this->lastColumnIndex = 255;
     }
     $this->countCellStyleXfs = count($phpSheet->getParent()->getCellStyleXfCollection());
 }