Example #1
0
        public void ParseForEntireColumnSelections_ShouldAddMaxRowsOnColumnsWithMultipleLetters()
        {
            // Arrange
            var address = "AB:AC";

            // Act
            var result = AddressUtility.ParseEntireColumnSelections(address);

            // Assert
            Assert.AreEqual("AB1:AC" + ExcelPackage.MaxRows, result);
        }
Example #2
0
        public void ParseForEntireColumnSelections_ShouldAddMaxRows()
        {
            // Arrange
            var address = "A:A";

            // Act
            var result = AddressUtility.ParseEntireColumnSelections(address);

            // Assert
            Assert.AreEqual("A1:A" + ExcelPackage.MaxRows, result);
        }
Example #3
0
        public void ParseForEntireColumnSelections_ShouldHandleMultipleRanges()
        {
            // Arrange
            var address  = "A:A B:B";
            var expected = string.Format("A1:A{0} B1:B{0}", ExcelPackage.MaxRows);

            // Act
            var result = AddressUtility.ParseEntireColumnSelections(address);

            // Assert
            Assert.AreEqual(expected, result);
        }
 private string CheckAndFixRangeAddress(string address)
 {
     if (address.Contains(','))
     {
         throw new FormatException("Multiple addresses may not be commaseparated, use space instead");
     }
     address = ConvertUtil._invariantTextInfo.ToUpper(address);
     if (Regex.IsMatch(address, @"[A-Z]+:[A-Z]+"))
     {
         address = AddressUtility.ParseEntireColumnSelections(address);
     }
     return(address);
 }
Example #5
0
        /// <summary>
        /// Check and fix an address (string address)
        /// </summary>
        /// <param name="address"></param>
        /// <returns></returns>
        public static string CheckAndFixRangeAddress(
            string address)
        {
            if (address.Contains(','))
            {
                throw new FormatException(
                          ExcelConditionalFormattingConstants.Errors.CommaSeparatedAddresses);
            }

            address = ConvertUtil._invariantTextInfo.ToUpper(address);

            if (Regex.IsMatch(address, @"[A-Z]+:[A-Z]+"))
            {
                address = AddressUtility.ParseEntireColumnSelections(address);
            }

            return(address);
        }
        internal void SetAddress(string address)
        {
            var dvAddress = AddressUtility.ParseEntireColumnSelections(address);

            SetXmlNodeString(_sqrefPath, dvAddress);
        }
Example #7
0
        internal void SetAddress(string address)
        {
            var dvAddress = AddressUtility.ParseEntireColumnSelections(address);

            SetXmlNodeString(GetSqRefPath(), dvAddress.Replace(",", " "));
        }