Beispiel #1
0
 // 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)]);
     }
 }
Beispiel #2
0
        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);
        }
 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);
        }
 public static ushort CellToRow(string value)
 {
     return((ushort)ExcelRowCollection.RowNameToIndex(RefFormulaToken.IsCellRegex.Match(value).Groups["Row"].Value));
 }