Ejemplo n.º 1
0
 public ClassFactory(Type type)
 {
     _comClass = new ExcelComClassType
     {
         Type        = type,
         IsRtdServer = false
     };
 }
Ejemplo n.º 2
0
 public ClassFactory(Type type)
 {
     _comClass = new ExcelComClassType 
     {
         Type = type,
         IsRtdServer = false
     };
 }
Ejemplo n.º 3
0
        // DOCUMENT: We register ComVisible types that
        //           (implement IRtdServer OR are in ExternalLibraries marked ComServer='true'
        static public void GetComClassTypes(ExportedAssembly assembly, Type type, object[] attributes, bool isRtdServer, List <ExcelComClassType> comClassTypes)
        {
            if (!Marshal.IsTypeVisibleFromCom(type))
            {
                return;
            }

            if (isRtdServer || assembly.ComServer)
            {
                string progId;
                Guid   clsId;

                // Check for public default constructor
                if (type.GetConstructor(BindingFlags.Public | BindingFlags.Instance, null, Type.EmptyTypes, null) == null)
                {
                    // No use to us here - won't be able to construct.
                    return;
                }

                if (assembly.IsDynamic)
                {
                    // Check that we have an explicit Guid attribute
                    object[] attrs = type.GetCustomAttributes(typeof(GuidAttribute), false);
                    if (attrs.Length == 0)
                    {
                        // No Guid attribute - skip this type.
                        return;
                    }
                    else
                    {
                        GuidAttribute guidAtt = (GuidAttribute)attrs[0];
                        clsId = new Guid(guidAtt.Value);
                    }
                }
                else
                {
                    clsId = Marshal.GenerateGuidForType(type);
                }

                progId = Marshal.GenerateProgIdForType(type);

                ExcelComClassType comClassType = new ExcelComClassType
                {
                    Type        = type,
                    ClsId       = clsId,
                    ProgId      = progId,
                    IsRtdServer = isRtdServer,
                    TypeLibPath = assembly.TypeLibPath
                };
                comClassTypes.Add(comClassType);
                Logger.Initialization.Verbose("GetComClassTypes - Found type {0}, with ProgId {1}", type.FullName, progId);
            }
        }
Ejemplo n.º 4
0
 public ClassFactory(ExcelComClassType excelComClassType)
 {
     _comClass = excelComClassType;
 }
Ejemplo n.º 5
0
 public ClassFactory(ExcelComClassType excelComClassType)
 {
     _comClass = excelComClassType;
 }