티스토리 뷰
=====================================================
// Commonly used OLE
variants.
COleVariant
covTrue((short)TRUE),
covFalse((short)FALSE),
covOptional((long)DISP_E_PARAMNOTFOUND,
VT_ERROR);
_Application app;
Workbooks books;
_Workbook
book;
Worksheets sheets;
_Worksheet sheet;
Range
range;
int n = 1;
CString strCurrentCell;
CString
read_value;
VARIANT value;
// Excel
Init.
if(!AfxOleInit())
{
AfxMessageBox("Could not initialize COM
dll");
}
// Start Excel and get Application
object.
if(!app.CreateDispatch("Excel.Application"))
{
AfxMessageBox("Couldn't
start Excel and get Application object.");
}
// Get
Workbooks
books = app.GetWorkbooks();
// File Open
CString
excel_path = "C:\\Test.xls";
COleVariant
VOptional((long)DISP_E_PARAMNOTFOUND, VT_ERROR);
book =
books.Open(excel_path, VOptional, VOptional,
VOptional, VOptional,
VOptional, VOptional,
VOptional, VOptional, VOptional,
VOptional,
VOptional, VOptional, VOptional, VOptional);
// Get the
first sheet.
int sheet_number = 1;
sheets =book.GetSheets();
sheet =
sheets.GetItem(COleVariant((short)sheet_number));
sheet.Activate();
int n_shape_index=1;
Shapes shapes;
Shape shape;
shapes =
sheet.GetShapes();
shape =
shapes.Item(COleVariant((short)1));
shape.Copy();
app.SetVisible(TRUE);
app.ReleaseDispatch();
app.DetachDispatch();
출처 : http://www.devpia.com/MAEUL/Contents/Detail.aspx?BoardID=50&MAEULNO=20&no=831280&ref=831280&page=1
'Study > Application > Windows' 카테고리의 다른 글
[펌] HINSTANCE VS HWND (0) | 2010.08.23 |
---|---|
MFC 리스트 컨트롤에 소팅기능 추가하기 (2) | 2010.08.18 |
MFC - OLE 작업중 차트관련 (0) | 2010.07.15 |
MFC - Excel OLE 작업중 (0) | 2010.07.14 |
MFC에서 EditBox 한글입력문제 (0) | 2010.06.24 |
- Total
- Today
- Yesterday
- 핸즈온머신러닝
- GDG SSU
- 서버개발자
- jaeseokyoon
- google developer group
- 숭실대
- gdgssu
- 소설네트워크3
- AndroidWear
- Jake Yoon
- watchface
- GDG
- 리눅스 커널 2.6
- 리눅스
- 안드로이드웨어
- 안드로이드
- WatchFaceHack
- 소설네트워크2
- 윤재석
- yjaeseok
- Developing on AWS
- jakeyoon
- 리눅스2.6
- 리눅스 커널 2.6 구조와 원리
- 창조경제혁신센터
- gdg watchfacehack
- 안드로이드폰
- 해커톤
- 커널의 기본 기능
- Linux
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |