Example #1
0
 private void Button_Click_MiniInfo(object sender, RoutedEventArgs e)
 {
     try
     {
         var vivod = MiniTabl.MiniEnumerateTabl("thrlist.xlsx").ToList();
         ExcelGrid.ItemsSource = vivod;
         MessageBox.Show($"Выведена основная информация по {vivod.Count} угрозам (УИБ)");
         // i = 2;
         Str.Content = $"Cтраница 1 из 1";
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Что-то не так!");
     }
 }
Example #2
0
 public static IEnumerable <MiniTabl> MiniEnumerateTabl(string path)
 {
     //int i = 0;
     using (var workbook = new XLWorkbook(path))
     {
         for (int row = 3; row <= 1000000; row++)
         {
             if (workbook.Worksheets.Worksheet(1).Cell(row, 1).GetValue <string>() == "")
             {
                 break;
             }
             else
             {
                 var tablica = new MiniTabl
                 {
                     Id   = "УБИ." + workbook.Worksheets.Worksheet(1).Cell(row, 1).GetValue <string>(),
                     Name = workbook.Worksheets.Worksheet(1).Cell(row, 2).GetValue <string>(),
                 };
                 // i++;
                 yield return(tablica);
             }
         }
     }
 }