Ejemplo n.º 1
0
 /**
  * Accepts a range, returning it as a range that falls within the current highest row and column of the worksheet
  *
  * @param string $range
  * @return string Adjusted range value
  */
 public function shrinkRangeToFit($range)
 {
     $maxCol = $this->getHighestColumn();
     $maxRow = $this->getHighestRow();
     $maxCol = PHPExcel_Cell::columnIndexFromString($maxCol);
     $rangeBlocks = explode(' ', $range);
     foreach ($rangeBlocks as &$rangeSet) {
         $rangeBoundaries = PHPExcel_Cell::getRangeBoundaries($rangeSet);
         if (PHPExcel_Cell::columnIndexFromString($rangeBoundaries[0][0]) > $maxCol) {
             $rangeBoundaries[0][0] = PHPExcel_Cell::stringFromColumnIndex($maxCol);
         }
         if ($rangeBoundaries[0][1] > $maxRow) {
             $rangeBoundaries[0][1] = $maxRow;
         }
         if (PHPExcel_Cell::columnIndexFromString($rangeBoundaries[1][0]) > $maxCol) {
             $rangeBoundaries[1][0] = PHPExcel_Cell::stringFromColumnIndex($maxCol);
         }
         if ($rangeBoundaries[1][1] > $maxRow) {
             $rangeBoundaries[1][1] = $maxRow;
         }
         $rangeSet = $rangeBoundaries[0][0] . $rangeBoundaries[0][1] . ':' . $rangeBoundaries[1][0] . $rangeBoundaries[1][1];
     }
     unset($rangeSet);
     $stRange = implode(' ', $rangeBlocks);
     return $stRange;
 }
Ejemplo n.º 2
0
                $xfIndex = self::_GetInt2d($recordData, $offset);
                // offset: var; size: 4; RK value
                $numValue = self::_GetIEEE754(self::_GetInt4d($recordData, $offset + 2));
                $cell = $this->_phpSheet->getCell($columnString . ($row + 1));
                if (!$this->_readDataOnly) {
                    // add style
                    $cell->setXfIndex($this->_mapCellXfIndex[$xfIndex]);
                }
                // add cell value
                $cell->setValueExplicit($numValue, PHPExcel_Cell_DataType::TYPE_NUMERIC);
            }
            $offset += 6;
        }
    }
    /**
	 * Read NUMBER record
	 * This record represents a cell that contains a
	 * floating-point value.