public function replaceAreasCallback($matches) { $c1_col = SpreadSheetCell::getColIndex($matches[1]); $c1_row = (int) $matches[2]; $c2_col = SpreadSheetCell::getColIndex($matches[3]); $c2_row = (int) $matches[4]; $diap = array(); for ($i = $c1_row; $i <= $c2_row; $i++) { for ($j = $c1_col; $j <= $c2_col; $j++) { $diap[] = SpreadSheetCell::getColName($j) . $i; } } return implode(";", $diap); }
public function parse_coord($coord) { if (is_array($coord)) { if (isset($coord[0])) { $row = $coord[0]; } if (isset($coord[1])) { $col = $coord[1]; } if (isset($coord['r'])) { $row = $coord['r']; } if (isset($coord['row'])) { $row = $coord['row']; } if (isset($coord['rowid'])) { $row = $coord['rowid']; } if (isset($coord['c'])) { $col = $coord['c']; } if (isset($coord['col'])) { $col = $coord['col']; } if (isset($coord['column'])) { $col = $coord['column']; } if (isset($coord['columnid'])) { $col = $coord['columnid']; } if (isset($coord['cLetter'])) { $colLetter = $coord['cLetter']; } else { if (isset($coord['colLetter'])) { $colLetter = $coord['colLetter']; } else { if (isset($coord['columnLetter'])) { $colLetter = $coord['columnLetter']; } } } if (!isset($col) && !isset($colLetter)) { return false; } if (!isset($col)) { $col = SpreadSheetCell::getColIndex($colLetter); } if (!isset($colLetter)) { $colLetter = SpreadSheetCell::getColName($col); } else { SpreadSheetCell::getColName($col); } return array('col' => $col, 'row' => $row, 'colLetter' => $colLetter); } preg_match("/^([a-z]+)([0-9]+)\$/i", $coord, $coords); if (count($coords) != 3) { return false; } $colLetter = $coords[1]; $row = $coords[2]; $col = SpreadSheetCell::getColIndex($colLetter); return array('col' => $col, 'row' => $row, 'colLetter' => $colLetter); }