Esempio n. 1
0
        internal static XLTableTheme ExtractTableStyle <T>() where T : new()
        {
            var attributes = ExtractClassAttributes <T>();

            if (attributes.ConstructorArguments.Count > 1)
            {
                var name = (string)attributes.ConstructorArguments[1].Value;
                return(XLTableTheme.FromName(name));
            }

            return(null);
        }
        public static void AddSheetToWorkbook(
            IXLWorkbook workbook,
            string sheetName,
            IEnumerable <object>?dataObjects,
            XLTableTheme tableTheme
            )
        {
            var sheet = workbook.Worksheets.Add(sheetName);
            var table = sheet.Cell(1, 1).InsertTable(dataObjects);

            table.Theme = tableTheme;
            sheet.Columns().AdjustToContents();
        }