private ExcelBindingDefinitionNamedRange(ExcelNamedRangeDefinition definition, string rootName, IBindingDefinition nestedBindingDefinition, IBindingDefinition nameBindingDefinition)
 {
     NestedBindingDefinition    = nestedBindingDefinition;
     this.definition            = definition;
     this.rootName              = rootName;
     this.nameBindingDefinition = nameBindingDefinition;
     if (nameBindingDefinition == null)
     {
         if (definition.Name.Contains(POS_KEYWORD))
         {
             usePos = true;
         }
         if (definition.Name.Contains(ALL_POS_KEYWORD))
         {
             useAllPos = true;
         }
     }
 }
        public static ExcelNamedRangeDefinition RetrieveNamedRangeDefinition(string definition)
        {
            ExcelNamedRangeDefinition ret = null;

            try
            {
                ret = definition.Deserialize <ExcelNamedRangeDefinition>();
                if (string.IsNullOrWhiteSpace(ret.Name))
                {
                    throw new ArgumentException("The 'Name' attribute is mandatory");
                }
            }
            catch (Exception ex)
            {
                string message = $"Cannot retrieve the named caller dataAccessor '{definition.EmptyIfNull()}'. {ex.Message}";
                throw new EtkException(message);
            }
            return(ret);
        }
 public static ExcelBindingDefinitionNamedRange CreateInstance(ExcelTemplateDefinitionPart templateDefinition, ExcelNamedRangeDefinition definition, IBindingDefinition nestedBindingDefinition)
 {
     try
     {
         string             trimmedName           = definition.Name.Trim();
         IBindingDefinition nameBindingDefinition = null;
         string             rootName = null;
         int pos = trimmedName.IndexOf('{');
         if (pos != -1)
         {
             rootName = trimmedName.Remove(pos);
             string expression = trimmedName.Substring(pos);
             BindingDefinitionDescription bindingDefinitionDescription = BindingDefinitionDescription.CreateBindingDescription(templateDefinition.Parent, expression, expression);
             if (bindingDefinitionDescription != null && !string.IsNullOrEmpty(bindingDefinitionDescription.BindingExpression))
             {
                 if (bindingDefinitionDescription.BindingExpression.Contains(ALL_POS_KEYWORD) || bindingDefinitionDescription.BindingExpression.Contains(POS_KEYWORD))
                 {
                     throw new ArgumentException($"Cannot mixte the keywords '{POS_KEYWORD}' and '{ALL_POS_KEYWORD}' with binding dataAccessor");
                 }
                 nameBindingDefinition = BindingDefinitionFactory.CreateInstances(templateDefinition.Parent as ExcelTemplateDefinition, bindingDefinitionDescription);
             }
         }
         return(new ExcelBindingDefinitionNamedRange(definition, rootName, nestedBindingDefinition, nameBindingDefinition));
     }
     catch (Exception ex)
     {
         string message = $"Cannot create create the named caller binding dataAccessor '{definition.Name}'. {ex.Message}";
         throw new EtkException(message);
     }
 }