ActiveX/Office
자동화 - MFC
jjryu
2009. 8. 8. 22:30
* 엑셀
// to automate Microsoft Excel 97, Excel 2000, or Excel 2002
1. 새로운 MFC 어플리케이션 프로젝트를 생성한다.
2. 자동화 서버의 타입 라이브러리로 부터 래퍼 클래스(IDispatch)를 생성한다.
COleDispatchDriver
CXLAutomation
CXLEzAutomation
// to automate Microsoft Excel 97, Excel 2000, or Excel 2002
1. 새로운 MFC 어플리케이션 프로젝트를 생성한다.
2. 자동화 서버의 타입 라이브러리로 부터 래퍼 클래스(IDispatch)를 생성한다.
Microsoft Excel 97
Microsoft Excel 8.0 Object Library // Excel8.olb, excel8.h
Microsoft Excel 2000
Microsoft Excel 9.0 Type Library
C:\Program Files\Microsoft Office\Office\Excel9.olb // excel9.h
Microsoft Excel 2002 // OfficeXP
Microsoft Excel 10.0 Type Library
C:\program Files\Microsoft Office\Office10\Excel.exe // excel.h
Microsoft Excel 2003 // Office 2003
Microsoft Excel 11.0 Object Library
Microsoft Excel 9.0 Type Library
C:\Program Files\Microsoft Office\Office\Excel9.olb // excel9.h
Microsoft Excel 2002 // OfficeXP
Microsoft Excel 10.0 Type Library
C:\program Files\Microsoft Office\Office10\Excel.exe // excel.h
Microsoft Excel 2003 // Office 2003
Microsoft Excel 11.0 Object Library
C:\program Files\Microsoft Office\Office11\Excel.exe
_Application, _Workbook, _Worksheet, Workbooks, Worksheets, Range
COleDispatchDriver
.AttachDispatch()
.ReleaseDispatch()
.ReleaseDispatch()
_Application -> COleDispatchDriver
.CreateDispatch()
.Quit()
.SetVisible()
.GetWorkbooks()
.Quit()
.SetVisible()
.GetWorkbooks()
Workbooks -> COleDispatchDriver
.Open() // _Workbook
_Workbook -> COleDispatchDriver
.GetSheets() // Worksheets
.GetWorksheets() // Worksheets
.SetSaved()
.Close()
.SetSaved()
.Close()
Worksheets -> COleDispatchDriver
.GetCount()
.GetItem() // _Worksheet
_Worksheet -> COleDispatchDriver
.Activate()
.GetRange() // Range
Range -> COleDispatchDriver
.Clear()
.SetValue2()
.SetValue2()
.GetValue2()
참조 사이트:
http://www.devpia.com/MAEUL/Contents/Detail.aspx?BoardID=51&MAEULNO=20&no=8151&page=8
http://support.microsoft.com/kb/178749/
http://support.microsoft.com/kb/178782/en-us/
http://support.microsoft.com/kb/307473/
http://support.microsoft.com/kb/186122/en-us/
http://support.microsoft.com/kb/186120/EN-US/
http://support.microsoft.com/kb/308407/
http://www.codeproject.com/KB/COM/ComExcelImages.aspx
http://support.microsoft.com/kb/178749/
http://support.microsoft.com/kb/178782/en-us/
http://support.microsoft.com/kb/307473/
http://support.microsoft.com/kb/186122/en-us/
http://support.microsoft.com/kb/186120/EN-US/
http://support.microsoft.com/kb/308407/
http://www.codeproject.com/KB/COM/ComExcelImages.aspx
CXLAutomation
CXLEzAutomation
http://whiteat.com/zbxe/17858
http://www.codeguru.com/cpp/data/mfc_database/microsoftexcel/print.php/c11745/
http://support.microsoft.com/kb/141759/en-us/
http://www.codeguru.com/cpp/data/mfc_database/microsoftexcel/print.php/c11745/
http://support.microsoft.com/kb/141759/en-us/