Esempio n. 1
0
        public void readExcel()
        {
            try
            {
                excelApp = new Excel.Application();

                string desktopPath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
                string path        = System.IO.Path.Combine(desktopPath, "강의자료.xlsx");
                workBook  = excelApp.Workbooks.Open(path);
                workSheet = workBook.Worksheets.get_Item(1) as Excel.Worksheet;
                Excel.Range rng = workSheet.Range[workSheet.Cells[1, 1], workSheet.Cells[7, 7]];
                //Range 데이타를 배열 (One-based array)로
                object[,] data = rng.Value;

                //excelData에 기록.
                for (int r = 2; r <= data.GetLength(1); r++)
                {
                    ExcelData.GetE_Data().Add(new ExcelData()
                    {
                        ELmsSubject = data[r, 1].ToString(), ELmsTitle = data[r, 2].ToString(), ELmsRdata = data[r, 3].ToString()
                    });
                }

                workBook.Close(true);
                excelApp.Quit();
            }
            finally
            {
                ReleaseObject(workSheet);
                ReleaseObject(workBook);
                ReleaseObject(excelApp);
            }
        }
Esempio n. 2
0
        public void compareData()
        {
            for (int i = 0; i < VM.getCount1(); i++)
            {
                var lmsData1_Title  = VM.getList1().ElementAt(i).LmsTitle;
                var excelData_Title = ExcelData.GetE_Data().ElementAt(i).ELmsTitle;

                if (lmsData1_Title != excelData_Title)
                {
                    MessageBox.Show(VM.getList1().ElementAt(i).LmsSubject + "의 내용이 다릅니다.(업로드 되었습니다.)");
                }
                else
                {
                    MessageBox.Show(VM.getList1().ElementAt(i).LmsSubject + "의 내용이 같습니다.(업로드 되지 않았습니다.)");
                }
            }
        }