예제 #1
0
        private void RemoveEventBinding()
        {
            // in case of this is a type with event support we remove the binding to COM event point
            IXlEventBinding typeEvent = this as IXlEventBinding;

            if (typeEvent != null)
            {
                typeEvent.RemoveEventBinding();
            }
        }
예제 #2
0
        /// <summary>
        /// IXlNonCreatable Constructor
        /// </summary>
        /// <param name="parentReference"></param>
        /// <param name="comReference"></param>
        internal XlNonCreatable(IXlObject parentReference, object comReference)
        {
            _ParentReference = parentReference;
            _ComReference    = comReference;
            _InstanceType    = _ComReference.GetType();

            // in case of this is a type with event support we enable the binding to COM event point
            IXlEventBinding typeEvent = this as IXlEventBinding;

            if (typeEvent != null)
            {
                typeEvent.SetupEventBinding();
            }
        }
        public void CreateCOMReference(string progId)
        {
            _InstanceType = System.Type.GetTypeFromProgID(progId);
            if (null == _InstanceType)
            {
                throw (new ArgumentException("progId not found."));
            }

            _ComReference = Activator.CreateInstance(_InstanceType);

            // in case of this is a type with event support we enable the binding to COM event point
            IXlEventBinding typeEvent = this as IXlEventBinding;

            if (typeEvent != null)
            {
                typeEvent.SetupEventBinding();
            }
        }