libraries/tbs/plugins/tbs_plugin_opentbs.php
function Misc_ColNum($ColRef, $IsODF) {

		if ($IsODF) {
			$p = strpos($ColRef, '.');
			if ($p!==false) $ColRef = substr($ColRef, $p); // delete the table name wich is in prefix
			$ColRef = str_replace( array('.','$'), '', $ColRef);
			$ColRef = explode(':', $ColRef);
			$ColRef = $ColRef[0];
		}

		$num = 0;
		$rank = 0;
		for ($i=strlen($ColRef)-1;$i>=0;$i--) {
			$l = $ColRef[$i];
			if (!is_numeric($l)) {
				$l = ord(strtoupper($l)) -64;
				if ($l>0 && $l<27) {
					$num = $num + $l*pow(26,$rank);
				} else {
					return $this->RaiseError('(Sheet) Reference of cell \''.$ColRef.'\' cannot be recognized.');
				}
				$rank++;
			}
		}

		return $num;

	}
function Misc_ColNum($ColRef, $IsODF) {

		if ($IsODF) {
			$p = strpos($ColRef, '.');
			if ($p!==false) $ColRef = substr($ColRef, $p); // delete the table name wich is in prefix
			$ColRef = str_replace( array('.','$'), '', $ColRef);
			$ColRef = explode(':', $ColRef);
			$ColRef = $ColRef[0];
		}

		$num = 0;
		$rank = 0;
		for ($i=strlen($ColRef)-1;$i>=0;$i--) {
			$l = $ColRef[$i];
			if (!is_numeric($l)) {
				$l = ord(strtoupper($l)) -64;
				if ($l>0 && $l<27) {
					$num = $num + $l*pow(26,$rank);
				} else {
					return $this->RaiseError('(Sheet) Reference of cell \''.$ColRef.'\' cannot be recognized.');
				}
				$rank++;
			}
		}

		return $num;

	}
function Misc_ColNum ( $ ColRef , $ IsODF ) { if ( $ IsODF ) { $ p = strpos ( $ ColRef , '.' ) ; if ( $ p !== false ) $ ColRef = substr ( $ ColRef , $ p ) ; // delete the table name wich is in prefix $ ColRef = str_replace ( array ( '.' , '$' ) , '' , $ ColRef ) ; $ ColRef = explode ( ':' , $ ColRef ) ; $ ColRef = $ ColRef [ 0 ] ; } $ num = 0 ; $ rank = 0 ; for ( $ i = strlen ( $ ColRef ) - 1 ; $ i >= 0 ; $ i -- ) { $ l = $ ColRef [ $ i ] ; if ( ! is_numeric ( $ l ) ) { $ l = ord ( strtoupper ( $ l ) ) - 64 ; if ( $ l > 0 && $ l < 27 ) { $ num = $ num + $ l * pow ( 26 , $ rank ) ; } else { return $ this -> RaiseError ( '(Sheet) Reference of cell \'' . $ ColRef . '\' cannot be recognized.' ) ; } $ rank ++ ; } } return $ num ; }
Return the column number from a cell reference like "B3".
Return the column number from a cell reference like B3 .