Ejemplo n.º 1
0
 public ScenarioInfo(IFeatureInfo parent, INameInfo name, string[] labels, string[] categories)
 {
     Parent     = parent;
     Name       = name;
     Labels     = labels;
     Categories = categories;
 }
Ejemplo n.º 2
0
 public ICoreScenarioBuilder WithName(string name)
 {
     if (string.IsNullOrWhiteSpace(name))
     {
         throw new ArgumentException("Unable to create scenario without name", nameof(name));
     }
     _name = new NameInfo(name, Array.Empty <INameParameterInfo>());
     return(this);
 }
Ejemplo n.º 3
0
 private IScenarioRunner WithName(INameInfo name)
 {
     if (name == null)
     {
         throw new ArgumentNullException(nameof(name));
     }
     _name = name;
     return(this);
 }
Ejemplo n.º 4
0
        private static XElement ToXElement(INameInfo name)
        {
            var objects = new List <object>();

            objects.Add(new XAttribute("Format", name.NameFormat));
            objects.Add(name.Parameters.Select(ToXElement).Cast <object>().ToArray());

            return(new XElement("Name", objects));
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 获取重定义名称实体集合
        /// </summary>
        /// <param name="workBook"></param>
        /// <returns></returns>
        public static IEnumerable <INameInfo> GetAllINameInfo(this IWorkbook workBook)
        {
            List <INameInfo> list = new List <INameInfo>();

            for (int index = 0; index < workBook.NumberOfNames; index++)
            {
                IName iname = workBook.GetNameAt(index);
                if (iname.IsDeleted || iname.IsFunctionName)
                {
                    continue;
                }
                INameInfo info = DealIName(iname);
                if (info == null)
                {
                    continue;
                }
                list.Add(info);
            }

            return(list);
        }
Ejemplo n.º 6
0
 private ICoreScenarioBuilder WithName(INameInfo name)
 {
     _name = name ?? throw new ArgumentNullException(nameof(name));
     return(this);
 }
Ejemplo n.º 7
0
 public ScenarioInfo(INameInfo name, string[] labels, string[] categories)
 {
     Name       = name;
     Labels     = labels;
     Categories = categories;
 }
Ejemplo n.º 8
0
 public FeatureInfo(INameInfo name, string[] labels, string description)
 {
     Name        = name;
     Labels      = labels;
     Description = description;
 }
Ejemplo n.º 9
0
        /// <summary>
        /// 处理位置
        /// 当前只处理单个单元格、或连续单元格
        /// 例如:Sheet2!$G$11 或 Sheet2!$D$5:$E$14 这两种情况
        /// </summary>
        /// <param name="iName"></param>
        /// <returns></returns>
        private static INameInfo DealIName(this IName iname)
        {
            if (string.IsNullOrEmpty(iname.RefersToFormula))
            {
                return(null);
            }
            // 如果是跨区域则返回空; 例如:Sheet2!$D$5:$E$14,Sheet2!$G$11,Sheet2!$G$10
            string[] regions = iname.RefersToFormula.Split(',');
            if (regions.Length > 1)
            {
                return(null);
            }
            INameInfo info = new INameInfo(iname);
            // 先替换不需要字符
            string region = iname.RefersToFormula.Replace(iname.SheetName, "").Replace("!", "").Replace("$", "");

            string[] postions = region.Split(':');

            int rowBegin = 0;
            int rowEnd   = 0;
            int colBegin = 0;
            int colEnd   = 0;

            if (postions.Length == 1) //单个单元格
            {
                // 处理位置
                DealPostion(postions[0], ref rowBegin, ref colBegin);
                // 位置
                info.FirstRow = info.LastRow = rowBegin;
                info.FirstCol = info.LastCol = colBegin;
            }
            else if (postions.Length == 2)//区域单元格
            {
                // 处理位置
                DealPostion(postions[0], ref rowBegin, ref colBegin);
                DealPostion(postions[1], ref rowEnd, ref colEnd);
                //位置赋值
                info.FirstRow = rowBegin;
                info.LastRow  = rowEnd;
                info.FirstCol = colBegin;
                info.LastCol  = colEnd;
            }
            if (info.FirstRow == info.LastRow)
            {
                info.EqualRow = true;
            }
            else
            {
                info.EqualRow = false;
            }

            if (info.FirstCol == info.LastCol)
            {
                info.EqualCol = true;
            }
            else
            {
                info.EqualCol = false;
            }
            return(info);
        }