C++Builder Programming Forum
C++Builder  |  Delphi  |  FireMonkey  |  C/C++  |  Free Pascal  |  Firebird
볼랜드포럼 BorlandForum
 경고! 게시물 작성자의 사전 허락없는 메일주소 추출행위 절대 금지
C++빌더 포럼
Q & A
FAQ
팁&트릭
강좌/문서
자료실
컴포넌트/라이브러리
메신저 프로젝트
볼랜드포럼 홈
헤드라인 뉴스
IT 뉴스
공지사항
자유게시판
해피 브레이크
공동 프로젝트
구인/구직
회원 장터
건의사항
운영진 게시판
회원 메뉴
북마크
볼랜드포럼 광고 모집

C++빌더 Q&A
C++Builder Programming Q&A
[61196] Re:스트링 그리드 엑셀 읽고 쓰기
Lyn [tohnokanna] 1500 읽음    2010-05-26 21:58
설비에 엑셀이 설치되어있나요?

Beckham 님이 쓰신 글 :
: 샘플로 짠 프로그램에서는 정상적으로 돌아가나..
: 설비 프로그램에서 실행시키면 에러가 납니다.
:
: <코드>
:     // Grid 초기화
:     strGrid->Cells[0][0] = "No"; // [행, 열]
:     strGrid->Cells[1][0] = "발생시간";
:     strGrid->Cells[2][0] = "에러코드";
:     strGrid->Cells[3][0] = "에러내용";
:     for (int i = 1; i < strGrid->RowCount; i++)
:         strGrid->Cells[0][i] = IntToStr(i);
:     InErrIdx = 0;
:
:     // Alarm Excel File 오늘날짜로 불러오기
:     AnsiString ADate = FormatDateTime("YYYYMMDD", Now());
:     Variant XLApp, XLSheets, XLSheet, XLBooks, XLBook, VCell;
:     //AnsiString ADate = FormatDateTime("YYYYMMDD", Now());
:     AnsiString stFile = gStAppPath + "\\ALARM\\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
:
:        //row갯수
:         int row = XLSheet.OlePropertyGet("UsedRange").OlePropertyGet("Rows").OlePropertyGet("Count"); 
:        //col갯수      
:         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");
:     }
:
:     에러 메시지 내용은 다음과 같습니다.
:     Project 파일명.exe raised exception class EAccessViolation with message 'Access violation at address
:     0053F633 in module '파일명.exe'. Read of address 00000800'. Process ....
:
:     제발 도와주십시요. 부족한 내용 말씀해주시면 바로 수정해서 재업하겠습니다.

+ -

관련 글 리스트
61195 스트링 그리드 엑셀 읽고 쓰기 Beckham 1305 2010/05/26
61196     Re:스트링 그리드 엑셀 읽고 쓰기 Lyn 1500 2010/05/26
61197         Re:Re:스트링 그리드 엑셀 읽고 쓰기 Beckham 2366 2010/05/26
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.