コード例 #1
0
 /// <summary>
 /// Convert to Excel address format, e.g. Row=5, Col=3 --> C5
 /// </summary>
 /// <returns></returns>
 public string ToAddress()
 {
     if (this.Row < 1 || this.Row > ExcelConstraints.MaxRows)
     {
         throw new ArgumentException("Invalid row value");
     }
     if (this.Column < 1 || this.Column > ExcelConstraints.MaxColumns)
     {
         throw new ArgumentException("Invalid column value");
     }
     return(ExcelAddress.ColumnIndexToName(this.Column) + (this.Row));
 }
コード例 #2
0
 /// <summary>
 /// Convert to Excel address format, e.g. Row=5, Col=3 --> C5
 /// </summary>
 /// <param name="row"></param>
 /// <param name="col"></param>
 /// <returns></returns>
 public static string ToAddress(uint row, uint col)
 {
     if (row < 1 || row > ExcelConstraints.MaxRows)
     {
         throw new ArgumentException("Invalid row value");
     }
     if (col < 1 || col > ExcelConstraints.MaxColumns)
     {
         throw new ArgumentException("Invalid column value");
     }
     return(ExcelAddress.ColumnIndexToName(col) + (row));
 }
コード例 #3
0
        private static string TranslateInternal(string rowDollar, uint rowIdx, string colDollar, uint colIdx, uint rowStart, uint colStart, int rowDelta, int colDelta, bool followAbsoluteRefs, out bool exceededBounds)
        {
            int num  = (int)rowIdx;
            int num2 = (int)colIdx;

            if ((num >= rowStart) && ((rowDollar != "$") || !followAbsoluteRefs))
            {
                num += rowDelta;
            }
            if ((num2 >= colStart) && ((colDollar != "$") || !followAbsoluteRefs))
            {
                num2 += colDelta;
            }
            exceededBounds = false;
            if (((num < 1) || (num > ExcelConstraints.MaxRows)) || ((num2 < 1) || (num2 > ExcelConstraints.MaxColumns)))
            {
                exceededBounds = true;
            }
            num  = Math.Max(1, Math.Min(num, ExcelConstraints.MaxRows));
            num2 = Math.Max(1, Math.Min(num2, ExcelConstraints.MaxColumns));
            return(string.Concat(new object[] { rowDollar, ExcelAddress.ColumnIndexToName((uint)num2), colDollar, num }));
        }