Ejemplo n.º 1
0
        public static void SaveXLS(string filename, ViewModel.MainWindow data)
        {
            Uri uri = new Uri("/Resources/hetvegekezelo.xlsm", UriKind.Relative);

            using (var stream = System.Windows.Application.GetResourceStream(uri).Stream)
                using (var f = File.Create(filename))
                {
                    stream.CopyTo(f);
                }
            var excel = new Microsoft.Office.Interop.Excel.Application {
                Visible = true
            };
            Workbook file = excel.Workbooks.Open(filename);

            try
            {
                Worksheet sheet = file.Worksheets[0];
                Range     c     = sheet.Cells;
                int       i     = 2;
                foreach (Person p in data.Students)
                {
                    c[i, 1].Activate();
                    string[] nev = p.Name.Split(new char[] { ' ' }, 2);
                    c[i, 1] = nev[0];
                    c[i, 2] = nev[1];
                    i++;
                }
            }
            finally
            {
                file.Save();
            }
        }
Ejemplo n.º 2
0
        public Algorithms(ViewModel.MainWindow data, object _lock)
        {
            this._lock = _lock;
            d          = data;
            Beosztando = d.Groups.ToList();

            foreach (var schedule in d.Schedule)
            {
                BindingOperations.EnableCollectionSynchronization(schedule, _lock);
            }
        }