Beispiel #1
0
        private void SetSheetSettings(IOneTableExcelReportConfiguration configuration)
        {
            var memberOptions = configuration.MemberConfigurations.GetActiveOrderlyOptions();
            var columnNumber  = 1;

            foreach (var oneTableExcelMemberOptions in memberOptions)
            {
                Column(columnNumber, builder =>
                {
                    if (oneTableExcelMemberOptions.Width > 0)
                    {
                        builder.Width(oneTableExcelMemberOptions.Width);
                    }

                    if (oneTableExcelMemberOptions.IsAutoFitColumn)
                    {
                        builder.AutoFitColumn();
                    }

                    if (string.IsNullOrWhiteSpace(oneTableExcelMemberOptions.Format))
                    {
                        builder.Format(oneTableExcelMemberOptions.Format);
                    }
                });
                columnNumber++;
            }
        }
Beispiel #2
0
        public virtual void DataContent <T>(IEnumerable <T> data, IOneTableExcelReportConfiguration configuration)
            where T : class
        {
            SetSheetSettings(configuration);

            var baseConfiguration = ConvertToExcelReportConfiguration <T>(configuration);

            DataContentInternal(data, baseConfiguration);
        }
Beispiel #3
0
        private static ExcelReportConfiguration.EntityConfig.ExcelReportConfiguration ConvertToExcelReportConfiguration <T>(
            IOneTableExcelReportConfiguration configuration) where T : class
        {
            var members = new MemberConfigurationDictionary <ExcelMemberOptions>();

            foreach (var options in configuration.MemberConfigurations)
            {
                members.Add(options.Key, options.Value);
            }

            var baseConfiguration =
                new ExcelReportConfiguration.EntityConfig.ExcelReportConfiguration(configuration.Options, members);

            return(baseConfiguration);
        }