public void ApplyAnalysisToDataset(IExcelSheet sheet)
        {
            sheet[ExcelColumnIndex.J, 1].SetValue(ExcelStringsPhaseOnePartOne.NormalDistributionSolutionColumnName);
            sheet.GetOrCreateCenterizedCell(ExcelColumnIndex.K, 1);

            sheet.AddMergedRegion(ExcelColumnIndex.J, 1, ExcelColumnIndex.K, 1);

            sheet[ExcelColumnIndex.J, 2].SetValue(ExcelStringsPhaseOnePartOne.PreliminarySampleSize);
            sheet[ExcelColumnIndex.J, 3].SetValue(ExcelStringsPhaseOnePartOne.SampleMean);
            sheet[ExcelColumnIndex.J, 4].SetValue(ExcelStringsPhaseOnePartOne.SampleVariance);
            sheet[ExcelColumnIndex.J, 5].SetValue(ExcelStringsPhaseOnePartOne.SampleDeviation);
            sheet[ExcelColumnIndex.J, 6].SetValue(ExcelStringsPhaseOnePartOne.VariationCoefficient);
            sheet[ExcelColumnIndex.J, 7].SetValue(ExcelStringsPhaseOnePartOne.CalculatedSampleSize);

            string lastValueRowIndex = _args.LaunchesNumber.SkipHeader().ToString();

            sheet[ExcelColumnIndex.K, 2].SetFormula("$F$6");
            sheet[ExcelColumnIndex.K, 3].SetFormula(sheet.FormulaProvider.Average($"$A$2:$A${lastValueRowIndex}"));
            sheet[ExcelColumnIndex.K, 4].SetFormula(sheet.FormulaProvider.Var($"$A$2:$A${lastValueRowIndex}"));
            sheet[ExcelColumnIndex.K, 5].SetFormula(sheet.FormulaProvider.StdDev($"$A$2:$A${lastValueRowIndex}"));
            sheet[ExcelColumnIndex.K, 6].SetFormula(ManualFormulaProvider.VariationCoefficient("$K$3", "$K$5"));
            sheet[ExcelColumnIndex.K, 7].SetFormula(sheet.FormulaProvider.RoundUp("3.8416 * $K$6^2 / $F$9^2", "0"));

            sheet.AutoSizeColumn(ExcelColumnIndex.J);
            sheet.AutoSizeColumn(ExcelColumnIndex.K, useMergedCells: true);
        }
        public static IExcelCellHolder GetCellHolder(IExcelSheet sheet,
                                                     ExcelColumnIndex columnIndex, int rowIndex, ReportOptions excelOptions)
        {
            sheet.ThrowIfNull(nameof(sheet));
            excelOptions.ThrowIfNull(nameof(excelOptions));

            return(excelOptions.CellCreationMode switch
            {
                ExcelCellCreationMode.Default =>
                sheet.GetOrCreateCell(columnIndex, rowIndex),

                ExcelCellCreationMode.Centerized =>
                sheet.GetOrCreateCenterizedCell(columnIndex, rowIndex),

                _ => throw new ArgumentOutOfRangeException(
                    nameof(excelOptions), excelOptions.CellCreationMode,
                    $"Unknown cell creation mode: '{excelOptions.CellCreationMode.ToString()}'."
                    )
            });
示例#3
0
        public void ApplyAnalysisToDataset(IExcelSheet sheet)
        {
            sheet[ExcelColumnIndex.B, 1].SetValue(ExcelStringsPhaseOnePartTwo.NormalizedColumnName);
            sheet[ExcelColumnIndex.L, 1].SetValue(ExcelStringsPhaseOnePartTwo.NormalDistributionSolutionColumnName);
            sheet.GetOrCreateCenterizedCell(ExcelColumnIndex.M, 1);

            sheet.AddMergedRegion(ExcelColumnIndex.L, 1, ExcelColumnIndex.M, 1);

            sheet[ExcelColumnIndex.L, 2].SetValue(ExcelStringsPhaseOnePartTwo.SampleMean);
            sheet[ExcelColumnIndex.L, 3].SetValue(ExcelStringsPhaseOnePartTwo.SampleVariance);
            sheet[ExcelColumnIndex.L, 4].SetValue(ExcelStringsPhaseOnePartTwo.SampleDeviation);
            sheet[ExcelColumnIndex.L, 5].SetValue(ExcelStringsPhaseOnePartTwo.VariationCoefficient);
            sheet[ExcelColumnIndex.L, 6].SetValue(ExcelStringsPhaseOnePartTwo.TheoreticalMin);
            sheet[ExcelColumnIndex.L, 7].SetValue(ExcelStringsPhaseOnePartTwo.TheoreticalMax);
            sheet[ExcelColumnIndex.L, 8].SetValue(ExcelStringsPhaseOnePartTwo.Span);
            sheet[ExcelColumnIndex.L, 9].SetValue(ExcelStringsPhaseOnePartTwo.NormalizedMean);
            sheet[ExcelColumnIndex.L, 10].SetValue(ExcelStringsPhaseOnePartTwo.NormalizedVarience);
            sheet[ExcelColumnIndex.L, 11].SetValue(ExcelStringsPhaseOnePartTwo.Alpha);
            sheet[ExcelColumnIndex.L, 12].SetValue(ExcelStringsPhaseOnePartTwo.Beta);

            string lastValueRowIndex = _args.LaunchesNumber.SkipHeader().ToString();

            sheet[ExcelColumnIndex.M, 2].SetFormula(sheet.FormulaProvider.Average($"$A$2:$A${lastValueRowIndex}"));
            sheet[ExcelColumnIndex.M, 3].SetFormula(sheet.FormulaProvider.Var($"$A$2:$A${lastValueRowIndex}"));
            sheet[ExcelColumnIndex.M, 4].SetFormula(sheet.FormulaProvider.StdDev($"$A$2:$A${lastValueRowIndex}"));
            sheet[ExcelColumnIndex.M, 5].SetFormula(ManualFormulaProvider.VariationCoefficient("$M$2", "$M$4"));
            sheet[ExcelColumnIndex.M, 6].SetFormula("$J$3");
            sheet[ExcelColumnIndex.M, 7].SetFormula("$J$5");
            sheet[ExcelColumnIndex.M, 8].SetFormula(ManualFormulaProvider.Span("$M$6", "$M$7"));
            sheet[ExcelColumnIndex.M, 9].SetFormula(sheet.FormulaProvider.Average($"$B$2:$B${lastValueRowIndex}"));
            sheet[ExcelColumnIndex.M, 10].SetFormula(sheet.FormulaProvider.Var($"$B$2:$B${lastValueRowIndex}"));
            sheet[ExcelColumnIndex.M, 11].SetFormula(ManualFormulaProvider.Alpha("$M$9", "$M$10"));
            sheet[ExcelColumnIndex.M, 12].SetFormula(ManualFormulaProvider.Beta("$M$9", "$M$10"));

            sheet.AutoSizeColumn(ExcelColumnIndex.B);
            sheet.AutoSizeColumn(ExcelColumnIndex.L);
            sheet.AutoSizeColumn(ExcelColumnIndex.M, useMergedCells: true);

            _histogramBuilder.CreateHistogramData(sheet);
        }