Exemple #1
0
        public XlReference AddFromFile(string fileName)
        {
            object[] paramArray = new object[1];
            paramArray[0] = fileName;
            object returnValue = InstanceType.InvokeMember("AddFromFile", BindingFlags.InvokeMethod, null, ComReference, paramArray, XlLateBindingApiSettings.XlThreadCulture);

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

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

            XlReference[] res_addins = new XlReference[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]);
            }
        }
Exemple #3
0
 /// <summary>
 /// returns an XlReference by Index, not 0 based
 /// </summary>
 /// <param name="i"></param>
 /// <returns></returns>
 public XlReference 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);
         }
         XlReference newClass = new XlReference(this, returnValue);
         ListChildReferences.Add(newClass);
         return(newClass);
     }
 }
Exemple #4
0
        public XlReference AddFromGuid(string guid, int major, int minor)
        {
            object[] paramArray = new object[3];
            paramArray[0] = guid;
            paramArray[1] = major;
            paramArray[2] = minor;
            object returnValue = InstanceType.InvokeMember("AddFromGuid", BindingFlags.InvokeMethod, null, ComReference, paramArray, XlLateBindingApiSettings.XlThreadCulture);

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

            ListChildReferences.Add(newClass);
            return(newClass);
        }
Exemple #5
0
 public void Remove(XlReference reference)
 {
     object[] paramArray = new object[1];
     paramArray[0] = reference.COMReference;
     InstanceType.InvokeMember("Remove", BindingFlags.InvokeMethod, null, ComReference, paramArray, XlLateBindingApiSettings.XlThreadCulture);
 }