Example #1
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->_str_total =& $str_total;
     $this->_str_unique =& $str_unique;
     $this->_str_table =& $str_table;
     $this->_colors =& $colors;
     $this->_parser = $parser;
     $this->_phpSheet = $phpSheet;
     //$this->ext_sheets		= array();
     //$this->offset			= 0;
     $this->_xls_strmax = 255;
     $this->_colinfo = array();
     $this->_selection = array(0, 0, 0, 0);
     $this->_active_pane = 3;
     $this->_print_headers = 0;
     $this->_outline_style = 0;
     $this->_outline_below = 1;
     $this->_outline_right = 1;
     $this->_outline_on = 1;
     $this->_fntHashIndex = 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());
 }
Example #2
0
 /**
  * Class constructor
  *
  * @param PHPExcel    $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 $phpExcel = null, &$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->strTotal =& $str_total;
     $this->strUnique =& $str_unique;
     $this->strTable =& $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());
         }
     }
 }
Example #3
0
 /**
  * Constructor
  *
  * @param int  $BIFF_version		 BIFF version
  * @param int  $str_total		Total number of strings
  * @param int  $str_unique		Total number of unique strings
  * @param array  $str_table
  * @param mixed   $parser	  The formula parser created for the Workbook
  * @param string   $tempDir	  The temporary directory to be used
  * @param PHPExcel_Worksheet $phpSheet
  */
 public function __construct($BIFF_version, &$str_total, &$str_unique, &$str_table, &$colors, $parser, $preCalculateFormulas, $phpSheet)
 {
     // It needs to call its parent's constructor explicitly
     parent::__construct();
     $this->_BIFF_version = $BIFF_version;
     if ($BIFF_version == 0x600) {
         // change BIFFwriter limit for CONTINUE records
         $this->_limit = 8224;
     }
     $this->_preCalculateFormulas = $preCalculateFormulas;
     $this->_str_total =& $str_total;
     $this->_str_unique =& $str_unique;
     $this->_str_table =& $str_table;
     $this->_colors =& $colors;
     $this->_parser = $parser;
     $this->_phpSheet = $phpSheet;
     //$this->ext_sheets		= array();
     //$this->offset			= 0;
     $this->_xls_strmax = 255;
     $this->_colinfo = array();
     $this->_selection = array(0, 0, 0, 0);
     $this->_active_pane = 3;
     $this->_print_headers = 0;
     $this->_outline_style = 0;
     $this->_outline_below = 1;
     $this->_outline_right = 1;
     $this->_outline_on = 1;
     // calculate values for DIMENSIONS record
     $this->_firstRowIndex = 0;
     $this->_lastRowIndex = -1;
     $this->_firstColumnIndex = 0;
     $this->_lastColumnIndex = -1;
     foreach ($this->_phpSheet->getCellCollection(false) as $cellID) {
         preg_match('/^(\\w+)(\\d+)$/U', $cellID, $matches);
         list(, $col, $row) = $matches;
         $column = PHPExcel_Cell::columnIndexFromString($col) - 1;
         // Don't break Excel!
         if ($row + 1 > 65536 or $column + 1 > 256) {
             break;
         }
         $this->_firstRowIndex = min($this->_firstRowIndex, $row);
         $this->_lastRowIndex = max($this->_lastRowIndex, $row);
         $this->_firstColumnIndex = min($this->_firstColumnIndex, $column);
         $this->_lastColumnIndex = max($this->_lastColumnIndex, $column);
     }
     $this->_countCellStyleXfs = count($phpSheet->getParent()->getCellStyleXfCollection());
 }
Example #4
0
 /**
  * Class constructor
  *
  * @param PHPExcel $phpExcel The Workbook
  * @param int $BIFF_verions BIFF version
  * @param int  $str_total		Total number of strings
  * @param int  $str_unique		Total number of unique strings
  * @param array  $str_table
  * @param mixed   $parser	  The formula parser created for the Workbook
  */
 public function __construct(PHPExcel $phpExcel = null, $BIFF_version = 0x600, &$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->_codepage = 0x4e4;
     // FIXME: should change for BIFF8
     $this->_country_code = -1;
     $this->_str_total =& $str_total;
     $this->_str_unique =& $str_unique;
     $this->_str_table =& $str_table;
     $this->_colors =& $colors;
     $this->_setPaletteXl97();
     $this->_phpExcel = $phpExcel;
     if ($BIFF_version == 0x600) {
         $this->_BIFF_version = 0x600;
         // change 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
         // for BIFF8
         if ($this->_BIFF_version == 0x600) {
             $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());
         }
     }
 }
Example #5
0
	/**
	 * Constructor
	 *
	 * @param int $BIFF_version
	 *        	BIFF version
	 * @param int $str_total
	 *        	number of strings
	 * @param int $str_unique
	 *        	number of unique strings
	 * @param array $str_table        	
	 * @param mixed $parser
	 *        	The formula parser created for the Workbook
	 * @param string $tempDir
	 *        	The temporary directory to be used
	 * @param PHPExcel_Worksheet $phpSheet        	
	 */
	public function __construct($BIFF_version, &$str_total, &$str_unique, &$str_table, &$colors, $parser, $preCalculateFormulas, $phpSheet) {
		// It needs to call its parent's constructor explicitly
		parent::__construct ();
		
		$this->_BIFF_version = $BIFF_version;
		if ($BIFF_version == 0x0600) {
			// change BIFFwriter limit for CONTINUE records
			$this->_limit = 8224;
		}
		
		$this->_preCalculateFormulas = $preCalculateFormulas;
		$this->_str_total = &$str_total;
		$this->_str_unique = &$str_unique;
		$this->_str_table = &$str_table;
		$this->_colors = &$colors;
		$this->_parser = $parser;
		
		$this->_phpSheet = $phpSheet;
		
		// $this->ext_sheets = array();
		// $this->offset = 0;
		$this->_xls_strmax = 255;
		$this->_colinfo = array ();
		$this->_selection = array (
				0,
				0,
				0,
				0 
		);
		$this->_active_pane = 3;
		
		$this->_print_headers = 0;
		
		$this->_outline_style = 0;
		$this->_outline_below = 1;
		$this->_outline_right = 1;
		$this->_outline_on = 1;
		
		// calculate values for DIMENSIONS record
		$col = $row = array ();
		foreach ( $this->_phpSheet->getCellCollection ( false ) as $cellID ) {
			list ( $c, $r ) = sscanf ( $cellID, '%[A-Z]%d' );
			$row [$r] = $r;
			$col [$c] = strlen ( $c ) . $c;
		}
		// Determine lowest and highest column and row
		$this->_firstRowIndex = (count ( $row ) > 0) ? min ( $row ) : 1;
		$this->_lastRowIndex = (count ( $row ) > 0) ? max ( $row ) : 1;
		if ($this->_firstRowIndex > 65535)
			$this->_firstRowIndex = 65535;
		if ($this->_lastRowIndex > 65535)
			$this->_lastRowIndex = 65535;
		
		$this->_firstColumnIndex = (count ( $col ) > 0) ? PHPExcel_Cell::columnIndexFromString ( substr ( min ( $col ), 1 ) ) : 1;
		$this->_lastColumnIndex = (count ( $col ) > 0) ? PHPExcel_Cell::columnIndexFromString ( substr ( max ( $col ), 1 ) ) : 1;
		
		if ($this->_firstColumnIndex > 255)
			$this->_firstColumnIndex = 255;
		if ($this->_lastColumnIndex > 255)
			$this->_lastColumnIndex = 255;
		
		$this->_countCellStyleXfs = count ( $phpSheet->getParent ()->getCellStyleXfCollection () );
	}
Example #6
0
 /**
  * Constructor
  *
  * @param int  $BIFF_version		 BIFF version
  * @param int  $str_total		Total number of strings
  * @param int  $str_unique		Total number of unique strings
  * @param array  $str_table
  * @param mixed   $parser	  The formula parser created for the Workbook
  * @param string   $tempDir	  The temporary directory to be used
  * @param PHPExcel_Worksheet $phpSheet
  */
 public function __construct($BIFF_version, &$str_total, &$str_unique, &$str_table, $parser, $tempDir = '', $phpSheet)
 {
     // It needs to call its parent's constructor explicitly
     parent::__construct();
     $this->_BIFF_version = $BIFF_version;
     if ($BIFF_version == 0x600) {
         // change BIFFwriter limit for CONTINUE records
         $this->_limit = 8224;
     }
     $this->_str_total =& $str_total;
     $this->_str_unique =& $str_unique;
     $this->_str_table =& $str_table;
     $this->_parser = $parser;
     $this->_phpSheet = $phpSheet;
     //$this->ext_sheets		= array();
     $this->_filehandle = '';
     $this->_using_tmpfile = true;
     //$this->fileclosed		= 0;
     //$this->offset			= 0;
     $this->_xls_strmax = 255;
     $this->_colinfo = array();
     $this->_selection = array(0, 0, 0, 0);
     $this->_active_pane = 3;
     $this->_print_headers = 0;
     $this->_outline_style = 0;
     $this->_outline_below = 1;
     $this->_outline_right = 1;
     $this->_outline_on = 1;
     $this->_dv = array();
     $this->_tmp_dir = $tempDir;
     // calculate values for DIMENSIONS record
     $this->_firstRowIndex = 0;
     $this->_lastRowIndex = -1;
     $this->_firstColumnIndex = 0;
     $this->_lastColumnIndex = -1;
     foreach ($this->_phpSheet->getCellCollection(false) as $cell) {
         $row = $cell->getRow() - 1;
         $column = PHPExcel_Cell::columnIndexFromString($cell->getColumn()) - 1;
         // Don't break Excel!
         if ($row + 1 > 65536 or $column + 1 > 256) {
             break;
         }
         $this->_firstRowIndex = min($this->_firstRowIndex, $row);
         $this->_lastRowIndex = max($this->_lastRowIndex, $row);
         $this->_firstColumnIndex = min($this->_firstColumnIndex, $column);
         $this->_lastColumnIndex = max($this->_lastColumnIndex, $column);
     }
     $this->_initialize();
     $this->_countCellStyleXfs = count($phpSheet->getParent()->getCellStyleXfCollection());
 }