// Properties
 ///<summary>
 ///Gets the column with the specified name.
 ///</summary>
 ///<param name="name">The name of the column.</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 ExcelColumn this[string name]
 {
     get
     {
         return(this[ExcelColumnCollection.ColumnNameToIndex(name)]);
     }
 }
Example #2
0
        public static void SetAreaColumns(string value, out byte firstColumn, out byte lastColumn)
        {
            firstColumn = 0;
            lastColumn  = 0;
            Match match1 = AreaFormulaToken.IsCellRangeRegex.Match(value);

            firstColumn = (byte)ExcelColumnCollection.ColumnNameToIndex(match1.Groups["Column1"].Value);
            lastColumn  = (byte)ExcelColumnCollection.ColumnNameToIndex(match1.Groups["Column2"].Value);
        }
Example #3
0
 private void SetColumn(string column)
 {
     if (column[0] == RefFormulaToken.AbsoluteCellMark)
     {
         this.IsColumnRelative = false;
         column = column.Substring(1);
     }
     else
     {
         this.IsColumnRelative = true;
     }
     this.column = (byte)ExcelColumnCollection.ColumnNameToIndex(column);
 }
Example #4
0
        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);
        }
Example #5
0
 public static byte CellToColumn(string value)
 {
     return((byte)ExcelColumnCollection.ColumnNameToIndex(RefFormulaToken.IsCellRegex.Match(value).Groups["Column"].Value));
 }