Beispiel #1
0
 public SQADPlanXlsSerializer(ISheetResolver sheetResolver,
                              IColumnResolver columnResolver,
                              IExportHelpersRepository StaticValuesResolver,
                              bool isExportJsonToXls = false)
 {
     _sheetResolver             = sheetResolver;
     _columnResolver            = columnResolver;
     this._staticValuesResolver = StaticValuesResolver;
     _isExportJsonToXls         = isExportJsonToXls;
 }
        /// <summary>
        /// Create a new ExcelMediaTypeFormatter.
        /// </summary>
        /// <param name="autoFit">True if the formatter should autofit columns after writing the data. (Default
        /// true.)</param>
        /// <param name="autoFilter">True if an autofilter should be applied to the worksheet. (Default false.)</param>
        /// <param name="freezeHeader">True if the header row should be frozen. (Default false.)</param>
        /// <param name="headerHeight">Height of the header row.</param>
        /// <param name="cellHeight">Height of each row of data.</param>
        /// <param name="cellStyle">An action method that modifies the worksheet cell style.</param>
        /// <param name="headerStyle">An action method that modifies the cell style of the first (header) row in the
        /// worksheet.</param>
        public XlsxPlanMediaTypeFormatter(IHttpContextAccessor httpContextAccessor,
                                          IModelMetadataProvider modelMetadataProvider,
                                          bool autoFit                    = true,
                                          bool autoFilter                 = false,
                                          bool freezeHeader               = false,
                                          double?headerHeight             = null,
                                          Action <ExcelStyle> cellStyle   = null,
                                          Action <ExcelStyle> headerStyle = null,
                                          SerializerType serializerType   = SerializerType.Default,
                                          bool isExportJsonToXls          = false,
                                          string fileExtension            = null,
                                          string viewLabel                = null,
                                          IExportHelpersRepository staticValuesResolver = null) :
            base(httpContextAccessor, modelMetadataProvider, autoFit, autoFilter, freezeHeader,
                 headerHeight, cellStyle, headerStyle, serializerType, isExportJsonToXls, fileExtension)
        {
            //if (string.IsNullOrEmpty(viewLabel))
            //{
            //   viewLabel = httpContextAccessor.HttpContext?.RequestServices.GetService<MTEntitiesContextWithViews>()
            //     ?.DatabaseSettings.Where(x => x.Key.Equals("ViewLabel")).FirstOrDefault()?.Value;
            //}

            // Initialize serializers.
            Serializers = new List <IXlsxSerializer>
            {
                new SQADPlanXlsSerializer(staticValuesResolver, modelMetadataProvider, isExportJsonToXls: isExportJsonToXls),
                new SqadFormattedViewXlsxSerializer(viewLabel),
                new SqadUnformattedViewXlsxSerializer(viewLabel),
                new SqadSummaryViewXlsxSerializer(),
                new SqadActualXlsSerializer(),
                new SqadCostSourceXlsxSerializer(),
                new SqadDeliverySourceXlsxSerializer(),
                new SQADApprovalReportXlsSerializer(),
                new SqadInternalDatabaseSetupRecordsXlsxSerializer(),
                new FormattedPlanSerializer()
            };
        }
Beispiel #3
0
 public SQADPlanXlsSerializer(IExportHelpersRepository staticValuesResolver, IModelMetadataProvider modelMetadataProvider
                              , bool isExportJsonToXls = false)
     : this(new DefaultSheetResolver(), new DefaultColumnResolver(modelMetadataProvider), staticValuesResolver, isExportJsonToXls)
 {
 }