Exemple #1
0
 /// <summary>
 /// Try get a named range by specified name
 /// </summary>
 /// <param name="name">name for range to be get</param>
 /// <param name="namedRange">output argument, range assoicated with specified name will be returned</param>
 /// <returns>true if specified name exists and the instance of range has been returned from spreadsheet, otherwise false</returns>
 public bool TryGetNamedRange(string name, out NamedRange namedRange)
 {
     if (!RGUtility.IsValidName(name))
     {
         namedRange = null;
         return(false);
     }
     else
     {
         return(registeredNamedRanges.TryGetValue(name, out namedRange));
     }
 }
Exemple #2
0
 internal bool TryGetNamedRangePosition(string name, out RangePosition range)
 {
     if (!RGUtility.IsValidName(name))
     {
         range = RangePosition.Empty;
         return(false);
     }
     else
     {
         NamedRange namedRange;
         registeredNamedRanges.TryGetValue(name, out namedRange);
         range = namedRange.Position;
         return(true);
     }
 }
Exemple #3
0
        /// <summary>
        /// Remove a highlighted range from specified address
        /// </summary>
        /// <param name="address">address to remove highlighted range</param>
        /// <returns>true if range removed successfully</returns>
        public bool RemoveHighlightRange(string address)
        {
            if (RangePosition.IsValidAddress(address))
            {
                return(RemoveHighlightRange(new RangePosition(address)));
            }
            else if (RGUtility.IsValidName(address))
            {
                if (registeredNamedRanges.TryGetValue(address, out var refRange))
                {
                    return(RemoveHighlightRange(refRange));
                }
            }

            return(false);
        }
Exemple #4
0
 /// <summary>
 /// Select speicifed range on spreadsheet
 /// </summary>
 /// <param name="address">address or name of specified range to be selected</param>
 public void SelectRange(string address)
 {
     // range address
     if (RangePosition.IsValidAddress(address))
     {
         SelectRange(new RangePosition(address));
     }
     // named range
     else if (RGUtility.IsValidName(address))
     {
         NamedRange refRange;
         if (registeredNamedRanges.TryGetValue(address, out refRange))
         {
             SelectRange(refRange);
         }
     }
 }
Exemple #5
0
        /// <summary>
        /// Crearte and display a highlighted range at specified position on worksheet
        /// </summary>
        /// <param name="address">Address or name to locate a range on worksheet</param>
        /// <returns>Instance of highlight range on worksheet</returns>
        public HighlightRange AddHighlightRange(string address)
        {
            if (RangePosition.IsValidAddress(address))
            {
                return(AddHighlightRange(new RangePosition(address)));
            }
            else if (RGUtility.IsValidName(address))
            {
                NamedRange refRange;

                if (registeredNamedRanges.TryGetValue(address, out refRange))
                {
                    return(AddHighlightRange(refRange));
                }
            }

            return(null);
        }
Exemple #6
0
 /// <summary>
 /// Check whether or not the specified name is valid name
 /// </summary>
 /// <param name="name">Name to be checked</param>
 /// <returns>True if specified name is valid; otherwise return false</returns>
 public static bool IsValidName(string name)
 {
     return(RGUtility.IsValidName(name));
 }