private uint MaximumExport(SimulationResult result, SheetData sheetData, uint last_row_index)
        {
            Row max_senate_row = new Row()
            {
                RowIndex = last_row_index, Spans = new ListValue <StringValue>()
            };
            Cell title_cell = new Cell()
            {
                CellReference = "A" + last_row_index,
                DataType      = CellValues.String,
                StyleIndex    = (UInt32Value)1U,
                CellValue     = new CellValue("MAXIMUM")
            };

            max_senate_row.Append(title_cell);
            uint senate_column_index = 2;

            foreach (var item in GetMaximum(result.Data))
            {
                string cellname  = GetExcelColumnName(senate_column_index);
                var    data_cell = new Cell()
                {
                    CellReference = cellname + last_row_index, //zacne od B
                    DataType      = CellValues.Number,
                    StyleIndex    = (UInt32Value)5U,
                    CellValue     = new CellValue(Convert.ToString(item))
                };
                max_senate_row.Append(data_cell);
                senate_column_index++;
            }
            sheetData.Append(max_senate_row);
            return(last_row_index);
        }
        /* Ostatní metody jsou pouze metody pro generování výsledků do souboru.
         * Každá z metod zapisuje příslušné části reportu.
         * Zápis se  provádí na úrovni buněk a řádků
         *
         */
        private uint StdevExport(SimulationResult result, SheetData sheetData, uint last_row_index)
        {
            Row avg_senate_row = new Row()
            {
                RowIndex = last_row_index, Spans = new ListValue <StringValue>()
            };
            Cell title_cell = new Cell()
            {
                CellReference = "A" + last_row_index,
                DataType      = CellValues.String,
                StyleIndex    = (UInt32Value)1U,
                CellValue     = new CellValue("STDEV")
            };

            avg_senate_row.Append(title_cell);
            uint senate_column_index = 2;

            foreach (var item in GetStdev(result.Data))
            {
                string cellname  = GetExcelColumnName(senate_column_index);
                var    data_cell = new Cell()
                {
                    CellReference = cellname + last_row_index, //zacne od B
                    DataType      = CellValues.Number,
                    StyleIndex    = (UInt32Value)7U,           //dve des mista-styl7
                    CellValue     = new CellValue(Convert.ToString(item, CultureInfo.InvariantCulture))
                };
                avg_senate_row.Append(data_cell);
                senate_column_index++;
            }
            sheetData.Append(avg_senate_row);
            return(last_row_index);
        }
        private void SimulationParamsExport(List <AlgorithmInfo> ainfo, SimulationParams spar, SimulationResult result, SheetData sheetData)
        {
            Row title_row = new Row()
            {
                RowIndex = 1U, Spans = new ListValue <StringValue>()
            };
            // opravena chyba 2.3. KUB
            var alg_name = ConvertAlgorithmName((from a in alginfo where a.AlgorithmID == result.UsedAlgorithm.ToString() select a.AlgorithmName).First());

            Cell cell = new Cell()
            {
                CellReference = "A1",
                DataType      = CellValues.String,
                StyleIndex    = (UInt32Value)1U,
                CellValue     = new CellValue(alg_name /*ainfo[result.UsedAlgorithm].AlgorithmName.Replace(":", " ") //KUB 2.3*/)
            };

            title_row.Append(cell);

            cell = new Cell()
            {
                CellReference = "C1",
                DataType      = CellValues.String,
                StyleIndex    = (UInt32Value)5U,
                CellValue     = new CellValue("Uživatel:" + spar.User.ID)
            };
            title_row.Append(cell);

            cell = new Cell()
            {
                CellReference = "D1",
                DataType      = CellValues.String,
                StyleIndex    = (UInt32Value)5U,
                CellValue     = new CellValue(DateTime.Now.ToString())
            };
            title_row.Append(cell);


            sheetData.Append(title_row);

            Row param_row = new Row()
            {
                RowIndex = 3U, Spans = new ListValue <StringValue>()
            };

            cell = new Cell()
            {
                CellReference = "A3",
                DataType      = CellValues.String,
                StyleIndex    = (UInt32Value)1U,
                CellValue     = new CellValue("Parametry simulace:")
            };
            param_row.Append(cell);
            cell = new Cell()
            {
                CellReference = "C3",
                DataType      = CellValues.String,
                StyleIndex    = (UInt32Value)5U,
                CellValue     = new CellValue("Počet senátů: " + spar.Senates.Count)
            };
            param_row.Append(cell);

            cell = new Cell()
            {
                CellReference = "E3",
                DataType      = CellValues.String,
                StyleIndex    = (UInt32Value)5U,
                CellValue     = new CellValue("Počet případů: " + spar.CasesToDistribution)
            };
            param_row.Append(cell);

            cell = new Cell()
            {
                CellReference = "G3",
                DataType      = CellValues.String,
                StyleIndex    = (UInt32Value)5U,
                CellValue     = new CellValue("Počet iterací: " + spar.IterationsCount)
            };
            param_row.Append(cell);

            sheetData.Append(param_row);
        }
        private uint SimulationResultsExport(SimulationParams spar, SimulationResult result, SheetData sheetData, uint last_row_index)
        {
            Row title_senate_row = new Row()
            {
                RowIndex = last_row_index, Spans = new ListValue <StringValue>()
            };

            Cell title_cell = new Cell()
            {
                CellReference = "A" + last_row_index,
                DataType      = CellValues.String,
                StyleIndex    = (UInt32Value)4U,
                CellValue     = new CellValue("Iterace")
            };

            title_senate_row.Append(title_cell);
            uint senate_column_index = 2;

            foreach (var s in spar.Senates)
            {
                string cellname = GetExcelColumnName(senate_column_index);
                title_cell = new Cell()
                {
                    CellReference = cellname + last_row_index, //zacne od B
                    DataType      = CellValues.String,
                    StyleIndex    = (UInt32Value)4U,
                    CellValue     = new CellValue(s.ID)
                };

                senate_column_index++;
                title_senate_row.Append(title_cell);
            }
            sheetData.Append(title_senate_row);
            last_row_index++;//posun se na dalsi radek
            int iter_counter = 1;

            foreach (var iter_data in result.Data)//pro kazdou iteraci
            {
                Row data_senate_row = new Row()
                {
                    RowIndex = last_row_index, Spans = new ListValue <StringValue>()
                };

                Cell data_cell = new Cell()
                {
                    CellReference = "A" + last_row_index,
                    DataType      = CellValues.Number,
                    StyleIndex    = (UInt32Value)6U,
                    CellValue     = new CellValue(Convert.ToString(iter_counter++))
                };
                data_senate_row.Append(data_cell);
                senate_column_index = 2;

                foreach (var item in iter_data)
                {
                    string cellname = GetExcelColumnName(senate_column_index);
                    data_cell = new Cell()
                    {
                        CellReference = cellname + last_row_index, //zacne od B
                        DataType      = CellValues.Number,
                        StyleIndex    = (UInt32Value)6U,
                        CellValue     = new CellValue(Convert.ToString(item))
                    };

                    senate_column_index++;
                    data_senate_row.Append(data_cell);
                }

                sheetData.Append(data_senate_row);
                last_row_index++;
            }

            return(last_row_index);
        }