|
일단 데이타가 시간이 많이 걸리는것은 어쩔수 없을것입니다.
그런데 그동안 화면에 버벅거리지 않으려면...
방법1. for문안에 Application->ProcessMessages()를 넣으세요
bFindStop=false;
for(int j=5;j<row;j++){
Form1->edit1->Text = sh.OlePropertyGet("Cells",j,3).OlePropertyGet("Value");
Form1->graph->DigitCh1 = sh.OlePropertyGet("Cells",j,3).OlePropertyGet("Value");
Application->ProcessMessages(); //이부분에서 다른 윈도우 메세지및 화면처리를 합니다.
if(bFindStop)break;// 검색을 중지하려면 for문을 빠져나옴
}
방법2. excel을 open하여 data를 검색하는 부분을 쓰레드로만드세요
검색 결과만을 메인 쓰레드로 주면 되니까...
방법3. excel에도 검색기능이 있습니다.
저도 해보진 않았지만 ole를 이용해서 excel에 자체 검색 기능을 이용하는것이 더욱좋을것 같습니다.
excel(office2003)로 메크로를 저장해 보니까 아래와 같은것이 ...
"BorderStyle"은 제가 검색한 text입니다.
Cells.Find(What:="BorderStyle", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, MatchByte:=False, SearchFormat:=False).Activate
Cells.FindNext(After:=ActiveCell).Activate //다음검색
Cells.FindNext(After:=ActiveCell).Activate //다음검색
방법4. 엑셀에서 각 Cell을 하나하나씩 읽어오는것은 속도가 느립니다.
좀더 빠르게 하는 대안으로 ClipBoard를 많이들 이용하지요
- 엑셀에 내용을 ClipBoard로 copy하고
- ClipBoard의 내요을 다시 가져와서 그런다음.. 검색한다면.. 빠를듯...
방법3을 잘만들어서 방법2와 조합한다면....더욱 좋을듯...
그럼..
네버 님이 쓰신 글 :
: 컴퓨터에 있는 엑셀파일을 열어서 검사하는 부분을 하는데.
: 엑셀에 row데이타가 17000개 정도 됩니다.
: 데이타 양이 많아지니까 검사하는데 속도도 오래 걸리고 17000개 정도되면
: 아예 프로그램이 다운이 되버리더라구요.
:
: Form1->ListView1->Items->BeginUpdate();
: ex.OlePropertyGet("WorkBooks").OleProcedure("Open",File_Open.c_str());
:
: Variant awb=ex.OlePropertyGet("ActiveWorkBook");
: Variant sh=awb.OlePropertyGet("ActiveSheet");//엑티브sheet
:
: int row=sh.OlePropertyGet("UsedRange").OlePropertyGet("Rows").OlePropertyGet("Count"); //row갯수
:
: for(int j=5;j<row;j++){
: Form1->edit1->Text = sh.OlePropertyGet("Cells",j,3).OlePropertyGet("Value");
: Form1->graph->DigitCh1 = sh.OlePropertyGet("Cells",j,3).OlePropertyGet("Value");
:
: }
: Form1->ListView1->Items->EndUpdate();
: awb.OleProcedure("Close");
: ex.OleProcedure("Quit");
:
: awb=Unassigned;
: ex=Unassigned;
:
: 이렇게 하는데 row값이 17000값이 되면 이게 다운이 되고 그래프에 표기도 안되더라구요.
: 또한 실행파일을 꺼도 엑셀파일이 계속 살아있구요~
:
: 찾아봐도 해결방법을 찾지 못해서 질문드립니다.
:
: 해결방법을 찾을수 있는 검색어나 힌트만 주셔도 괜찮습니다. 답변 부탁드려요
|