public ExcelCell this[string contextName] { get { int firstRow; int firstColumn; switch (this.IndexingMode) { case RangeIndexingMode.Rectangular: PositionToRowColumn(contextName, out firstRow, out firstColumn); break; case RangeIndexingMode.Horizontal: firstRow = this.firstRow; firstColumn = ExcelColumnCollection.ColumnNameToIndex(contextName); break; case RangeIndexingMode.Vertical: firstRow = ExcelRowCollection.RowNameToIndex(contextName); firstColumn = this.firstColumn; break; default: throw new Exception("Internal: Unknown indexing mode."); } this.ExceptionIfRowColumnOutOfRange(firstRow, firstColumn); return(base.Parent.Rows[firstRow].AllocatedCells[firstColumn]); } }
public static void SetAreaColumns(string value, out byte firstColumn, out byte lastColumn) { firstColumn = 0; lastColumn = 0; Match match = IsCellRangeRegex.Match(value); firstColumn = (byte)ExcelColumnCollection.ColumnNameToIndex(match.Groups["Column1"].Value); lastColumn = (byte)ExcelColumnCollection.ColumnNameToIndex(match.Groups["Column2"].Value); }
private void SetLastColumn(string column) { if (column[0] == RefFormulaToken.AbsoluteCellMark) { this.IsLastColumnAbsolute = false; column = column.Substring(1); } else { this.IsLastColumnAbsolute = true; } this.lastColumn = (byte)ExcelColumnCollection.ColumnNameToIndex(column); }
private void SetColumn(string column) { if (column[(0)] == AbsoluteCellMark) { this.IsColumnRelative = false; column = column.Substring(1); } else { this.IsColumnRelative = true; } this.column = (byte)ExcelColumnCollection.ColumnNameToIndex(column); }
private static bool IsValidCell(Match regexMatch) { string name = regexMatch.Groups["Row"].Value; if (name[0] == AbsoluteCellMark) { name = name.Remove(0, 1); } string str2 = regexMatch.Groups["Column"].Value; if (str2[0] == AbsoluteCellMark) { str2 = str2.Remove(0, 1); } return(IsColumnValid(ExcelColumnCollection.ColumnNameToIndex(str2)) && IsRowValid(ExcelRowCollection.RowNameToIndex(name))); }
internal static void PositionToRowColumn(string position, out int row, out int column, out bool wrongFormat) { string name = position.Split(new char[] { '1', '2', '3', '4', '5', '6', '7', '8', '9' }, 2)[0]; if ((name.Length != 0) && (name.Length != position.Length)) { string str2 = position.Remove(0, name.Length); row = ExcelRowCollection.RowNameToIndex(str2); column = ExcelColumnCollection.ColumnNameToIndex(name); wrongFormat = false; } else { column = -1; row = -1; wrongFormat = true; } }
public static byte CellToColumn(string value) { return((byte)ExcelColumnCollection.ColumnNameToIndex(IsCellRegex.Match(value).Groups["Column"].Value)); }