示例#1
0
        private void HandleCommonPropertiesAttributes(ExcelManager em, object obj, Attribute att, PropertyInfo propInfo)
        {
            UseSheetAttribute useSheet = att as UseSheetAttribute;

            if (useSheet != null)
            {
                if (!String.IsNullOrEmpty(useSheet.SheetName))
                {
                    em.ActivateSheet(useSheet.SheetName);
                }
                else
                {
                    string sheetName = Convert.ToString(propInfo.GetValue(obj, null));
                    em.ActivateSheet(sheetName);
                }
            }
        }
示例#2
0
        private void HandleCommonClassAttributes(ExcelManager em, object obj)
        {
            Type objType = obj.GetType();

            // Check class attributes
            foreach (Attribute att in objType.GetCustomAttributes(true))
            {
                // [DefaultSheet]
                DefaultSheetAttribute defaultSheet = att as DefaultSheetAttribute;
                if (defaultSheet != null)
                {
                    em.ActivateSheet(defaultSheet.SheetName);
                }
            }
        }