Пример #1
0
        private ISheet CreateSheet(XSSFWorkbook workbook, string sheetName, IList <object> objects)
        {
            var sheet = workbook.CreateSheet(sheetName);

            var headerProperties = CollectPublicProperties(objects[0]);
            var haeders          = headerProperties.Select(i => DescriptionAttribute.ConstructDescription(i.Key, objects[0])).ToList();

            CreateRow(sheet, 0, haeders);

            for (int rowIndex = 1; rowIndex <= objects.Count; rowIndex++)
            {
                var properties = CollectPublicProperties(objects[rowIndex - 1]);
                CreateRow(sheet, rowIndex, properties.Values.ToList());
            }

            return(sheet);
        }