■ 엑셀(EXCEL.exe) 실행 프로그램을 제거하는 방법을 보여준다.
▶ 예제 코드 (C#)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
using System.Runtime.InteropServices; using Excel = Microsoft.Office.Interop.Excel; ... Excel.Application excelApplication = new Excel.Application(); Excel.Workbooks excelWorkbooks = excelApplication.Workbooks; Excel.Workbook excelWorkbook = excelWorkbooks.Add(""); Excel.Sheets excelSheets = excelWorkbook.Worksheets; Excel.Worksheet excelSheet = excelSheets["Sheet1"] as Excel.Worksheet; Excel.Range excelRange = excelSheet.Cells as Excel.Range; Excel.Range excelA1Range = excelRange.get_Item("1", "A") as Excel.Range; excelA1Range.Value2 = "Hello EXCEL Interop"; ... excelApplication.DisplayAlerts = false; excelApplication.Quit(); Marshal.ReleaseComObject(excelA1Range ); Marshal.ReleaseComObject(excelRange ); Marshal.ReleaseComObject(excelSheet ); Marshal.ReleaseComObject(excelSheets ); Marshal.ReleaseComObject(excelWorkbook ); Marshal.ReleaseComObject(excelWorkbooks ); Marshal.ReleaseComObject(excelApplication); |