|
일자별 엑셀로그파일을 스트링 그리드로 불러오는 프로그램 입니다.
Variant XLApp, XLSheets, XLSheet, XLBooks, XLBook, VCell;
AnsiString stCur = GetCurrentDir();
AnsiString ADate = FormatDateTime("YYYYMMDD", dtpAlarm->Date);
AnsiString stFile = stCur + "\\ERROR_" + ADate + ".xls";
if (FileExists(stFile)) {
XLApp = CreateOleObject("Excel.Application");
XLApp.OlePropertyGet("Workbooks").OleProcedure("Open", stFile.c_str());
XLBook = XLApp.OlePropertyGet("ActiveWorkBook");
XLSheet = XLBook.OlePropertyGet("ActiveSheet");//엑티브sheet
int row = XLSheet.OlePropertyGet("UsedRange").OlePropertyGet("Rows").OlePropertyGet("Count");
int col = XLSheet.OlePropertyGet("UsedRange").OlePropertyGet("Columns").OlePropertyGet("Count
strGrid->RowCount = row + 1;
strGrid->ColCount = col;
for(int j = 1; j < row; j++){
for(int i = 1; i < col; i++){
strGrid->Cells[i][j] = XLSheet.OlePropertyGet("Cells", j + 1, i + 1).OlePropertyGet("Value");
strGrid->Cells[0][j] = IntToStr(j);
}
}
XLBook.OleFunction("Close", (Variant)false);
XLApp.OleProcedure("Quit");
}
정상적으로 로딩이 되다가 'DateTimePicker' 컴포넌트를 추가하면 헤더파일에
'#include <ComCtrls.hpp>'이 추가 되면서 16개의 에러가 발생합니다.
예를 들면
[C++Error]ComCtrls.hpp:E2015 Ambiguity between 'Windows' and 'Excel_2k::Windows'
이런 에러가 뜨네요..
고수님들 조언좀 부탁합니다.
|