Ejemplo n.º 1
0
        public XlVBComponent Import(string fileName)
        {
            object[] parameter = new object[1];
            parameter[0] = fileName;
            object returnValue = InstanceType.InvokeMember("Import", BindingFlags.InvokeMethod, null, ComReference, parameter, XlLateBindingApiSettings.XlThreadCulture);

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

            ListChildReferences.Add(newClass);
            return(newClass);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Foreach Enumerator
        /// </summary>
        /// <returns></returns>
        public IEnumerator GetEnumerator()
        {
            int iCount = Count;

            XlVBComponent[] res_addins = new XlVBComponent[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]);
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 /// returns a XlVBComponent by Index, not 0 based
 /// </summary>
 /// <param name="i"></param>
 /// <returns></returns>
 public XlVBComponent this[int index]
 {
     get
     {
         object[] paramArray = new object[1];
         paramArray[0] = index;
         object returnValue = InstanceType.InvokeMember("Item", BindingFlags.InvokeMethod, null, ComReference, paramArray, XlLateBindingApiSettings.XlThreadCulture);
         if (null == returnValue)
         {
             return(null);
         }
         XlVBComponent newClass = new XlVBComponent(this, returnValue);
         ListChildReferences.Add(newClass);
         return(newClass);
     }
 }
Ejemplo n.º 4
0
 public void Remove(XlVBComponent vbComponent)
 {
     object[] parameter = new object[1];
     parameter[0] = vbComponent;
     InstanceType.InvokeMember("Remove", BindingFlags.InvokeMethod, null, ComReference, parameter, XlLateBindingApiSettings.XlThreadCulture);
 }