public XlOLEObject Add(string classType, string fileName, double left, double top, double width, double height)
        {
            object[] parameter = new object[11];
            parameter[0]  = classType;
            parameter[1]  = fileName;
            parameter[2]  = Missing.Value;
            parameter[3]  = Missing.Value;
            parameter[4]  = Missing.Value;
            parameter[5]  = Missing.Value;
            parameter[6]  = Missing.Value;
            parameter[7]  = left;
            parameter[8]  = top;
            parameter[9]  = width;
            parameter[10] = height;
            object returnValue = InstanceType.InvokeMember("Add", BindingFlags.InvokeMethod | BindingFlags.OptionalParamBinding, null, ComReference, parameter, XlLateBindingApiSettings.XlThreadCulture);

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

            ListChildReferences.Add(newClass);
            return(newClass);
        }
Exemplo n.º 2
0
        public XlOLEObject Duplicate()
        {
            object returnValue = InstanceType.InvokeMember("Duplicate", BindingFlags.InvokeMethod | BindingFlags.OptionalParamBinding, null, ComReference, null, XlLateBindingApiSettings.XlThreadCulture);

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

            ListChildReferences.Add(newClass);
            return(newClass);
        }
Exemplo n.º 3
0
        public XlOLEObject OLEObjects(int index)
        {
            object[] parameter = new object[1];
            parameter[0] = index;
            object returnValue = InstanceType.InvokeMember("OLEObjects", BindingFlags.GetProperty, null, ComReference, parameter, XlLateBindingApiSettings.XlThreadCulture);

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

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

            XlOLEObject[] res_addins = new XlOLEObject[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]);
            }
        }
 /// <summary>
 /// returns an XlOLEObject by Index, not 0 based
 /// </summary>
 /// <param name="i"></param>
 /// <returns></returns>
 public XlOLEObject 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);
         }
         XlOLEObject newClass = new XlOLEObject(this, returnValue);
         ListChildReferences.Add(newClass);
         return(newClass);
     }
 }