Exemplo n.º 1
0
 /**
  * @access 	public
  * @param 	integer			$col				
  * @return 	string					
  */
 public function getColumnName($col)
 {
     $lettres = Fonction::getLetters(true);
     if (isset($lettres[$col])) {
         return $lettres[$col];
     } else {
         return 0;
     }
 }
Exemplo n.º 2
0
 /**
  * Fonction qui set comme contenu de cellule une somme (par exemple A1:B6;C10)
  *
  * @access 	public
  * @param 	string			$formula				La formule (par exemple 'A1:B6;C10')
  * @return 	void
  */
 public function setFormulaSUM($formula)
 {
     $f = strpos($formula, '=SUM(') === false ? '=SUM(' . $formula . ')' : $formula;
     // On sauve la formule
     $f = str_replace('(', '([.', $f);
     $f = str_replace(')', '])', $f);
     $f = str_replace(';', '];[.', $f);
     $f = str_replace(':', ':.', $f);
     // On en extrait les donn�s
     $formula = ltrim($formula, '=SUM(');
     $formula = rtrim($formula, ')');
     $l = Fonction::getLetters(true);
     $somme = 0;
     $blocs = explode(';', $formula);
     $cellules = $this->parent->getCells();
     foreach ($blocs as $bloc) {
         $cells = explode(':', $bloc);
         $tab = array();
         foreach ($cells as $cell) {
             $cols = '';
             $row = '';
             for ($i = 0; $i < strlen($cell); $i++) {
                 if (is_int($cell[$i]) || is_float($cell[$i]) || is_numeric($cell[$i])) {
                     $row .= $cell[$i];
                 } else {
                     $cols .= $cell[$i];
                 }
             }
             $col = array_search(strtolower($cols), $l);
             $tab[] = $cellules[$row][$col];
         }
         if (count($tab) == 1) {
             $somme += $tab[0]->getContent() * 1;
         } else {
             $cells = $this->parent->getRangeCells($tab[0], $tab[1], '_setSum', '', $somme);
         }
     }
     $this->formula = $f;
     $this->contenu = $somme;
     $this->type = 'float';
     return $this->type;
 }
Exemplo n.º 3
0
 /**
  * @access 	public
  * @return 	TableCell		$style			
  */
 public function getCellAddress()
 {
     $cell = $this->cellAddress;
     $l = Fonction::getLetters(true);
     return $this->sheetAddress . '.' . $l[$cell->getX()] . $cell->getY();
 }