예제 #1
0
 ///// <summary>
 /////
 ///// </summary>
 ///// <param name="row">从1开始的整数</param>
 ///// <param name="col">只能是字母</param>
 ///// <param name="r1C1">譬如A2 等</param>
 //public ExcelCellPoint(int row, string col, string r1C1)
 //{
 //    Row = row;
 //    Col = R1C1Formulas(col);
 //    R1C1 = r1C1;
 //}
 public ExcelCellPoint(string r1C1)
 {
     //K3 = row:3, col:11
     r1C1   = r1C1.Split(':')[0].Trim();                        //防止传入 "A1:B3" 这种的配置格式的
     Row    = Convert.ToInt32(RegexHelper.GetLastNumber(r1C1)); //3
     ColStr = RegexHelper.GetFirstStringByReg(r1C1, "[A-Za-z]+");
     Col    = ExcelCellPoint.R1C1Formulas(ColStr);              //K -> 11
     R1C1   = r1C1;
 }
예제 #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="excelAddress"></param>
        public ExcelCellPoint(OfficeOpenXml.ExcelAddress excelAddress)
        {
            //ExcelCellPoint(excelAddress.Address);
            var r1C1 = excelAddress.Address;

            r1C1   = r1C1.Split(':')[0].Trim();                        //防止传入 "A1:B3" 这种的配置格式的
            Row    = Convert.ToInt32(RegexHelper.GetLastNumber(r1C1)); //3
            ColStr = RegexHelper.GetFirstStringByReg(r1C1, "[A-Za-z]+");
            Col    = ExcelCellPoint.R1C1Formulas(ColStr);              //K -> 11
            R1C1   = r1C1;
        }