Ejemplo n.º 1
0
        public override string ToString()
        {
            string firstCell  = ExcelHelperClass.ConvertR1C1ToA1(string.Format("R{0}C{1}", rwFirst + 1, (colFirst + 1) & 0xFF));
            string secondCell = ExcelHelperClass.ConvertR1C1ToA1(string.Format("R{0}C{1}", rwLast + 1, (colLast + 1) & 0xFF));

            return(string.Format("{0}:{1}", firstCell, secondCell));
        }
Ejemplo n.º 2
0
        public override string ToString()
        {
            string firstCell  = ExcelHelperClass.ConvertR1C1ToA1(string.Format("R{0}C{1}", rwFirst + 1, (colFirst + 1) & 0xFF));
            string secondCell = ExcelHelperClass.ConvertR1C1ToA1(string.Format("R{0}C{1}", rwLast + 1, (colLast + 1) & 0xFF));

            //TODO: Map the ixti offset to the appropriate sheet name
            return(string.Format("[ixti{0}]{1}:{2}", ixti, firstCell, secondCell));
        }
Ejemplo n.º 3
0
        public string GetCellName(bool r1c1style = false)
        {
            string r1c1 = string.Format("R{0}C{1}", this.rw + 1, this.col + 1);

            if (r1c1style)
            {
                return(r1c1);
            }
            return(ExcelHelperClass.ConvertR1C1ToA1(r1c1));
        }
Ejemplo n.º 4
0
        public override string ToString()
        {
            string cellString = ExcelHelperClass.ConvertR1C1ToA1(string.Format("R{0}C{1}", rw + 1, (col + 1) & 0xFF));

            if (string.IsNullOrEmpty(SheetName))
            {
                string refString = string.Format("Sheet[ixti={0}]!{1}", ixti, cellString);
                return(refString);
            }
            else
            {
                return(string.Format("{0}!{1}", SheetName, cellString));
            }
        }
Ejemplo n.º 5
0
        public override string ToString()
        {
            //Special case where the area is the ENTIRE row or the ENTIRE column
            if (colFirst == 0 && colLast == 0xFF && rwFirst == rwLast)
            {
                return(string.Format("{0}:{0}", rwFirst + 1));
            }
            else if (rwFirst == 0 && rwLast == 0xFFFF && colFirst == colLast)
            {
                return(string.Format("{0}:{0}", ExcelHelperClass.GetExcelA1ColNameFromColNumber(colFirst + 1)));
            }

            string firstCell  = ExcelHelperClass.ConvertR1C1ToA1(string.Format("R{0}C{1}", rwFirst + 1, (colFirst + 1) & 0xFF));
            string secondCell = ExcelHelperClass.ConvertR1C1ToA1(string.Format("R{0}C{1}", rwLast + 1, (colLast + 1) & 0xFF));

            return(string.Format("{0}:{1}", firstCell, secondCell));
        }
Ejemplo n.º 6
0
        public void TestA1R1C1Conversion()
        {
            string a1cell   = "A1";
            string r1c1cell = "R1C1";

            Assert.AreEqual(a1cell, ExcelHelperClass.ConvertR1C1ToA1(r1c1cell));
            Assert.AreEqual(r1c1cell, ExcelHelperClass.ConvertA1ToR1C1(a1cell));

            a1cell   = "C5";
            r1c1cell = "R5C3";

            Assert.AreEqual(a1cell, ExcelHelperClass.ConvertR1C1ToA1(r1c1cell));
            Assert.AreEqual(r1c1cell, ExcelHelperClass.ConvertA1ToR1C1(a1cell));

            a1cell   = "FE100";
            r1c1cell = "R100C161";
            Assert.AreEqual(a1cell, ExcelHelperClass.ConvertR1C1ToA1(r1c1cell));
            Assert.AreEqual(r1c1cell, ExcelHelperClass.ConvertA1ToR1C1(a1cell));
        }
Ejemplo n.º 7
0
        public void TestA1R1C1Conversion()
        {
            string a1cell   = "A1";
            string r1c1cell = "R1C1";

            Assert.AreEqual(a1cell, ExcelHelperClass.ConvertR1C1ToA1(r1c1cell));
            Assert.AreEqual(r1c1cell, ExcelHelperClass.ConvertA1ToR1C1(a1cell));

            a1cell   = "C5";
            r1c1cell = "R5C3";

            Assert.AreEqual(a1cell, ExcelHelperClass.ConvertR1C1ToA1(r1c1cell));
            Assert.AreEqual(r1c1cell, ExcelHelperClass.ConvertA1ToR1C1(a1cell));

            a1cell   = "FE100";
            r1c1cell = "R100C161";
            Assert.AreEqual(a1cell, ExcelHelperClass.ConvertR1C1ToA1(r1c1cell));
            Assert.AreEqual(r1c1cell, ExcelHelperClass.ConvertA1ToR1C1(a1cell));

            a1cell   = "HZ46";
            r1c1cell = "R46C234";
            Assert.AreEqual(a1cell, ExcelHelperClass.ConvertR1C1ToA1(r1c1cell));
            Assert.AreEqual(r1c1cell, ExcelHelperClass.ConvertA1ToR1C1(a1cell));

            a1cell   = "IU255";
            r1c1cell = "R255C255";
            Assert.AreEqual(a1cell, ExcelHelperClass.ConvertR1C1ToA1(r1c1cell));
            Assert.AreEqual(r1c1cell, ExcelHelperClass.ConvertA1ToR1C1(a1cell));

            a1cell   = "AA1";
            r1c1cell = "R1C27";
            Assert.AreEqual(a1cell, ExcelHelperClass.ConvertR1C1ToA1(r1c1cell));
            Assert.AreEqual(r1c1cell, ExcelHelperClass.ConvertA1ToR1C1(a1cell));

            a1cell   = "AZ1";
            r1c1cell = "R1C52";
            Assert.AreEqual(a1cell, ExcelHelperClass.ConvertR1C1ToA1(r1c1cell));
            Assert.AreEqual(r1c1cell, ExcelHelperClass.ConvertA1ToR1C1(a1cell));
        }
Ejemplo n.º 8
0
 public override string ToString()
 {
     //Make sure to truncate column values that use any value > 255
     return(ExcelHelperClass.ConvertR1C1ToA1(string.Format("R{0}C{1}", rw + 1, (col + 1) & 0xFF)));
 }