//public static void Create()
 //{
 //    ////create new xls file
 //    //string file = "C:\\newdoc.xls";
 //    ////Workbook workbook = new Workbook();
 //    ////Worksheet worksheet = new Worksheet("First Sheet");
 //    ////worksheet.Cells[0, 1] = new Cell((short)1);
 //    ////worksheet.Cells[2, 0] = new Cell(9999999);
 //    ////worksheet.Cells[3, 3] = new Cell((decimal)3.45);
 //    ////worksheet.Cells[2, 2] = new Cell("Text string");
 //    ////worksheet.Cells[2, 4] = new Cell("Second string");
 //    ////worksheet.Cells[4, 0] = new Cell(32764.5, "#,##0.00");
 //    ////worksheet.Cells[5, 1] = new Cell(DateTime.Now, @"YYYY\-MM\-DD");
 //    ////worksheet.Cells.ColumnWidth[0, 1] = 3000;
 //    ////workbook.Worksheets.Add(worksheet);
 //    ////workbook.Save(file);
 //    ////// open xls file
 //    ////Workbook book = Workbook.Load(file);
 //    ////Worksheet sheet = book.Worksheets[0];
 //    //var wb = new XLWorkbook();
 //    //var ws = wb.Worksheets.Add("Contacts");
 //    //// Title
 //    //ws.Cell("B2").Value = "Contacts";
 //    //// First Names
 //    //ws.Cell("B3").Value = "FName";
 //    //ws.Cell("B4").Value = "John";
 //    //ws.Cell("B5").Value = "Hank";
 //    //ws.Cell("B6").Value = "Dagny";
 //    //// Last Names
 //    //ws.Cell("C3").Value = "LName";
 //    //ws.Cell("C4").Value = "Galt";
 //    //ws.Cell("C5").Value = "Rearden";
 //    //ws.Cell("C6").Value = "Taggart";
 //    //// Boolean
 //    //ws.Cell("D3").Value = "Outcast";
 //    //ws.Cell("D4").Value = true;
 //    //ws.Cell("D5").Value = false;
 //    //ws.Cell("D6").Value = false;
 //    //// DateTime
 //    //ws.Cell("E3").Value = "DOB";
 //    //ws.Cell("E4").Value = new DateTime(1919, 1, 21);
 //    //ws.Cell("E5").Value = new DateTime(1907, 3, 4);
 //    //ws.Cell("E6").Value = new DateTime(1921, 12, 15);
 //    //// Numeric
 //    //ws.Cell("F3").Value = "Income";
 //    //ws.Cell("F4").Value = 2000;
 //    //ws.Cell("F5").Value = 40000;
 //    //ws.Cell("F6").Value = 10000;
 //    //// From worksheet
 //    //var rngTable = ws.Range("B2:F6");
 //    //// From another range
 //    //var rngDates = rngTable.Range("D3:D5"); // The address is relative to rngTable (NOT the worksheet)
 //    //var rngNumbers = rngTable.Range("E3:E5"); // The address is relative to rngTable (NOT the worksheet)
 //    //// Using OpenXML's predefined formats
 //    //rngDates.Style.NumberFormat.NumberFormatId = 15;
 //    //// Using a custom format
 //    //rngNumbers.Style.NumberFormat.Format = "$ #,##0";
 //    //var rngHeaders = rngTable.Range("A2:E2"); // The address is relative to rngTable (NOT the worksheet)
 //    //rngHeaders.Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
 //    //rngHeaders.Style.Font.Bold = true;
 //    //rngHeaders.Style.Fill.BackgroundColor = XLColor.Aqua;
 //    //rngTable.Style.Border.BottomBorder = XLBorderStyleValues.Thin;
 //    //rngTable.Cell(1, 1).Style.Font.Bold = true;
 //    //rngTable.Cell(1, 1).Style.Fill.BackgroundColor = XLColor.CornflowerBlue;
 //    //rngTable.Cell(1, 1).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
 //    //rngTable.Row(1).Merge(); // We could've also used: rngTable.Range("A1:E1").Merge()
 //    ////Add a thick outside border
 //    //rngTable.Style.Border.OutsideBorder = XLBorderStyleValues.Thick;
 //    //// You can also specify the border for each side with:
 //    //// rngTable.FirstColumn().Style.Border.LeftBorder = XLBorderStyleValues.Thick;
 //    //// rngTable.LastColumn().Style.Border.RightBorder = XLBorderStyleValues.Thick;
 //    //// rngTable.FirstRow().Style.Border.TopBorder = XLBorderStyleValues.Thick;
 //    //// rngTable.LastRow().Style.Border.BottomBorder = XLBorderStyleValues.Thick;
 //    //ws.Columns(2, 6).AdjustToContents();
 //    //wb.SaveAs("BasicTable.xlsx");
 //    //CreateResult();
 //}
 public static void CreateResult(ExcelModel model, bool needToSave = true)
 {
     model.SetMeltsOxides();
     Model = model;
     var disk = AppDomain.CurrentDomain.BaseDirectory.ToCharArray().First();
     string fileName = string.Format(@"{1}:\result{0}.xlsx", DateTime.Now.ToString("dd-MM-yy_hhmm"), disk);
     string template = "template.xlsx";
     var wb = new XLWorkbook(template);
     var ws = wb.Worksheet("result");
     CreateHeader(ws);
     SetRows(ws);
     SetData(ws);
     wb.SaveAs(fileName);
     if (needToSave)
     {
         Sqlite.SaveProject(Model);
     }
     Model = null;
 }
 public static void SaveProject(ExcelModel model)
 {
     IDbConnection db = dbFactory.OpenDbConnection();
     db.Save(new Project() { Model = model });
 }
 private void SaveExcelResult()
 {
     var excelModel = new ExcelModel(
         "New material",
         this.FirstSystem.Formula,
         this.SecondSystem.Formula,
         this.firstOxide.Formula,
         this.secondOxide.Formula,
         this.TemperaturesModels.Select(x => x.Temperature).ToList(),
         this.Oxides.ToList(),
         this.TemperaturesModels.ToList(),
         this.resTemperaturesModels,
         this.firstModule,
         this.secondModule,
         this.oxidesResultModels,
         this.FirstSystem,
         this.SecondSystem,
         this.sumR2O);
     ExcelCreator.CreateResult(excelModel);
 }