Пример #1
0
        private void SpellFieldSetScript(string axisType, FieldSet fieldSet, StringBuilder builder)
        {
            builder.Append(string.Format("		{0}.ActiveView.{1}.InsertFieldSet({0}.ActiveView.Fieldsets(\"{2}\"))\n",
                                         "Document.Forms(0)." + this.PivotTableName,
                                         axisType,
                                         fieldSet.FieldName));

            foreach (string key in fieldSet.Attributes.Keys)
            {
                builder.Append(string.Format("		{0}.ActiveView.Fieldsets(\"{1}\").Fields(0).{2} = \"{3}\"\n",
                                             "Document.Forms(0)." + this.PivotTableName,
                                             fieldSet.FieldName,
                                             key,
                                             fieldSet.Attributes[key].ToString()));
            }

            builder.Append("\n");
        }
Пример #2
0
        public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
        {
            if (value is string)
            {
                string[] attrs = ((string)value).Split(new char[] { ',' });
                string[] v     = null;

                FieldSet fieldSet = new FieldSet(attrs[0]);

                for (int i = 1; i < attrs.Length; i++)
                {
                    v = attrs[i].Split('=');
                    fieldSet.Attributes.Add(v[0], v[1]);
                }

                return(fieldSet);
            }
            return(base.ConvertFrom(context, culture, value));
        }