Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class DataArtist
- {
- public static List<Izvodjac> RegistarIzvodjaca;
- public static void ucitajRegistarIzvodjaca(string filePath) {
- if (!File.Exists(filePath))
- {
- throw new FileNotFoundException();
- }
- RegistarIzvodjaca = new List<Izvodjac>();
- Microsoft.Office.Interop.Excel.Application ExcelApp = new Microsoft.Office.Interop.Excel.Application();
- ExcelApp.Visible = false;
- Workbook wb = null;
- try
- {
- wb = ExcelApp.Workbooks.Open(filePath, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);
- Sheets sheets = wb.Worksheets;
- Worksheet ws = (Worksheet)sheets.get_Item("artists-21k");
- Console.WriteLine("sheetName: " + ws.Name);
- Range excelRange = (Range)ws.get_Range("A", "H");
- string zellwert = excelRange.Value2;
- Console.WriteLine(zellwert);
- }
- catch (Exception e)
- {
- Console.WriteLine(e.Message);
- }
- finally
- {
- wb.Close(false, null, null);
- ExcelApp.Quit();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement