Пример #1
0
        /// <summary>
        /// Foreach Enumerator
        /// </summary>
        /// <returns></returns>
        public IEnumerator GetEnumerator()
        {
            int iCount = Count;

            XlCommandBar[] res_addins = new XlCommandBar[iCount];

            for (int i = 1; i <= iCount; i++)
            {
                res_addins[i - 1] = this[i];
            }

            for (int i = 0; i < res_addins.Length; i++)
            {
                yield return(res_addins[i]);
            }
        }
Пример #2
0
 /// <summary>
 /// returns an XlCommandBar by Index, not 0 based
 /// </summary>
 /// <param name="i"></param>
 /// <returns></returns>
 public XlCommandBar this[string index]
 {
     get
     {
         object[] paramArray = new object[1];
         paramArray[0] = index;
         object returnValue = InstanceType.InvokeMember("Item", BindingFlags.GetProperty, null, ComReference, paramArray, XlLateBindingApiSettings.XlThreadCulture);
         if (null == returnValue)
         {
             return(null);
         }
         XlCommandBar newClass = new XlCommandBar(this, returnValue);
         ListChildReferences.Add(newClass);
         return(newClass);
     }
 }
Пример #3
0
        public XlCommandBar Add(string name, MsoBarPosition position, object menuBar, object temporary)
        {
            object[] paramArray = new object[4];
            paramArray[0] = name;
            paramArray[1] = position;
            paramArray[2] = menuBar;
            paramArray[3] = temporary;
            object returnValue = InstanceType.InvokeMember("Add", BindingFlags.InvokeMethod, null, ComReference, paramArray, XlLateBindingApiSettings.XlThreadCulture);

            if (null == returnValue)
            {
                return(null);
            }
            XlCommandBar newClass = new XlCommandBar(this, returnValue);

            ListChildReferences.Add(newClass);
            return(newClass);
        }