///<summary> ///Convert formula token to string representation. ///</summary> ///<returns>formula token string representation</returns> public override string ToString() { string text1 = this.IsRowRelative ? ExcelRowCollection.RowIndexToName(this.row) : (RefFormulaToken.AbsoluteCellMark + ExcelRowCollection.RowIndexToName(this.row)); string text2 = this.IsColumnRelative ? ExcelColumnCollection.ColumnIndexToName(this.column) : (RefFormulaToken.AbsoluteCellMark + ExcelColumnCollection.ColumnIndexToName(this.column)); return(text2 + text1); }
// Properties ///<summary> ///Gets the row with the specified name. ///</summary> ///<param name="name">The name of the row.</param> ///<example> Look at following code for cell referencing examples: ///<code lang="Visual Basic"> ///Dim ws As ExcelWorksheet = excelFile.Worksheets.ActiveWorksheet /// ///ws.Cells("B2").Value = "Cell B2." ///ws.Cells(6, 0).Value = "Cell in row 7 and column A." /// ///ws.Rows(2).Cells(0).Value = "Cell in row 3 and column A." ///ws.Rows("4").Cells("B").Value = "Cell in row 4 and column B." /// ///ws.Columns(2).Cells(4).Value = "Cell in column C and row 5." ///ws.Columns("AA").Cells("6").Value = "Cell in AA column and row 6." ///</code> ///<code lang="C#"> ///ExcelWorksheet ws = excelFile.Worksheets.ActiveWorksheet; /// ///ws.Cells["B2"].Value = "Cell B2."; ///ws.Cells[6,0].Value = "Cell in row 7 and column A."; /// ///ws.Rows[2].Cells[0].Value = "Cell in row 3 and column A."; ///ws.Rows["4"].Cells["B"].Value = "Cell in row 4 and column B."; /// ///ws.Columns[2].Cells[4].Value = "Cell in column C and row 5."; ///ws.Columns["AA"].Cells["6"].Value = "Cell in AA column and row 6."; ///</code> ///</example> public ExcelRow this[string name] { get { return(this[ExcelRowCollection.RowNameToIndex(name)]); } }
internal ExcelRowCollection(ExcelWorksheet parent, ExcelRowCollection sourceRows) : base(parent) { base.MaxOutlineLevel = sourceRows.MaxOutlineLevel; foreach (ExcelRow row1 in sourceRows) { base.Items.Add(new ExcelRow(this, row1)); } }
public static void SetAreaRows(string value, out ushort firstRow, out ushort lastRow) { firstRow = 0; lastRow = 0; Match match1 = AreaFormulaToken.IsCellRangeRegex.Match(value); firstRow = (ushort)ExcelRowCollection.RowNameToIndex(match1.Groups["Row1"].Value); lastRow = (ushort)ExcelRowCollection.RowNameToIndex(match1.Groups["Row2"].Value); }
///<summary> ///Convert formula token to string representation. ///</summary> ///<returns>formula token string representation</returns> public override string ToString() { string text1 = this.IsFirstRowRelative ? ExcelRowCollection.RowIndexToName(this.FirstRow) : (RefFormulaToken.AbsoluteCellMark + ExcelRowCollection.RowIndexToName(this.FirstRow)); string text2 = this.IsLastRowRelative ? ExcelRowCollection.RowIndexToName(this.LastRow) : (RefFormulaToken.AbsoluteCellMark + ExcelRowCollection.RowIndexToName(this.LastRow)); string text3 = this.IsFirstColumnRelative ? ExcelColumnCollection.ColumnIndexToName(this.FirstColumn) : (RefFormulaToken.AbsoluteCellMark + ExcelColumnCollection.ColumnIndexToName(this.FirstColumn)); string text4 = this.IsLastColumnAbsolute ? ExcelColumnCollection.ColumnIndexToName(this.LastColumn) : (RefFormulaToken.AbsoluteCellMark + ExcelColumnCollection.ColumnIndexToName(this.LastColumn)); string[] textArray1 = new string[] { text3, text1, ":", text4, text2 }; return(string.Concat(textArray1)); }
private void AdjustArraySize(int index) { if (index > (base.Items.Count - 1)) { ExcelRowCollection.ExceptionIfRowOutOfRange(index); int num2 = index - (base.Items.Count - 1); for (int num1 = 0; num1 < num2; num1++) { base.Items.Add(new ExcelRow(this, base.Items.Count)); } } }
private void SetRow(string row) { if (row[0] == RefFormulaToken.AbsoluteCellMark) { this.IsRowRelative = false; row = row.Substring(1); } else { this.IsRowRelative = true; } this.row = (ushort)ExcelRowCollection.RowNameToIndex(row); }
private static bool IsValidCell(Match regexMatch) { string text1 = regexMatch.Groups["Row"].Value; if (text1[0] == RefFormulaToken.AbsoluteCellMark) { text1 = text1.Remove(0, 1); } string text2 = regexMatch.Groups["Column"].Value; if (text2[0] == RefFormulaToken.AbsoluteCellMark) { text2 = text2.Remove(0, 1); } if (RefFormulaToken.IsColumnValid(ExcelColumnCollection.ColumnNameToIndex(text2))) { return(RefFormulaToken.IsRowValid(ExcelRowCollection.RowNameToIndex(text1))); } return(false); }
internal ExcelRow(ExcelRowCollection parent, int index) : base(parent, index) { this.height = 0xff; this.cellCollection = new ExcelCellCollection(parent.Parent); }
// Methods internal ExcelRow(ExcelRowCollection parent, ExcelRow sourceRow) : base(parent, sourceRow) { this.height = 0xff; this.height = sourceRow.height; this.cellCollection = new ExcelCellCollection(parent.Parent, sourceRow.cellCollection); }
public static ushort CellToRow(string value) { return((ushort)ExcelRowCollection.RowNameToIndex(RefFormulaToken.IsCellRegex.Match(value).Groups["Row"].Value)); }