|
시빌더 님이 쓰신 글 :
: 한꼬맹이 님이 쓰신 글 :
: : 시빌더 님이 쓰신 글 :
: : : 답변고맙습니다..
: : : 그코드는 자동생성코드가 맞아요..
: : : 근데
: : : ActiveForm이 아닐경우에는 문제가 없는데..
: : : ActiveForm에만 Excel을 연결만 하면 그코드에서 break 가 걸리거든요?
: : : 에러메세지를 보니 뭐.. Excel_Tlb와 애매모호한 코드이다..(대충 해석) 이런것 같은데..
: : : 다른코드는 손덴게 없어요..
: : : 갑갑하군요..
: : : 읽어주셔서 대단히 감사합니다..
: :
: : 안녕하십니까?
: :
: : 한꼬맹이 입니다.
: :
: : 엑셀을 불러오는 코드를 저한테 한번 보여주시고 정확한 에러코드도 보여주시면
: :
: : 고맙겠네요...
: :
: : 지금은 소스를 보지않은 이상 뭐라고 말씀드릴수가 없네요
: :
: : 그럼 참고하시길...
: :
: :
:
: 답변고맙습니다..
:
: ***** excel 연결및 query data를 엑셀로...(cpp파일)
:
: #include <vcl.h>
: #pragma hdrstop
: #include <atl\atlvcl.h>
: #include "Serv_TLB.h"
: #include "L1_cliImpl1.h"
: #include "Excel_TLB.h"
: #include <UtilCls.h>
:
:
: void __fastcall TL1_cli::BitBtn5Click(TObject *Sender)
: {
: Variant xlApp, xlBooks, xlBook, xlSheets, xlSheet,VCell;
: try
: {
: xlApp = CreateOleObject("Excel.Application.9");
: }
: catch (Exception &exception)
: {
: ShowMessage("Excel이 설치되어 있지 않습니다.");
: return;
: }
:
: if ( SaveDialog->Execute() == false )
: return;
:
: if ( FileExists(SaveDialog->FileName) )
: {
: ShowMessage("파일이 존재함.");
: return;
: }
:
: xlApp.OlePropertySet("DisplayAlerts", false);
: xlApp.OlePropertySet("Visible", false);
: xlBooks = xlApp.OlePropertyGet("Workbooks");
: xlBooks.OleProcedure("Add");
: xlBook = xlBooks.OlePropertyGet("Item", 1);
: xlSheets = xlBook.OlePropertyGet("Worksheets");
: xlSheet = xlSheets.OlePropertyGet("Item", 1);
:
: xlSheet.OlePropertySet("Name", String("자료1") );
:
: Integer i;
:
: LPum01->First();
: AnsiString str1,str2;
:
: for (i = 1;i<=LPum01->RecordCount;i++){
:
: VCell = xlSheet.OlePropertyGet("Cells", i, 1);
: VCell.OlePropertySet("Value",LPum01->FieldByName("PumCode")->AsString);
:
: VCell = xlSheet.OlePropertyGet("Cells", i, 2);
: VCell.OlePropertySet("Value",LPum01->FieldByName("PumName")->AsString);
: LPum01->Next();
:
: }
:
: xlBook.OleProcedure("SaveAs", SaveDialog->FileName);
: xlBook.OleProcedure("Close");
: xlApp.OleProcedure("Quit");
: }
:
: 그리고.. 에러가 나는 코드입니다..(자동생성코드입니다.. ActivexForm)
:
: STDMETHODIMP TL1_cliImpl::_set_Font(IFontDisp** Value) ****>이부분
: {
: try
: {
: const DISPID dispid = -512;
: if (FireOnRequestEdit(dispid) == S_FALSE)
: return S_FALSE;
: SetVclCtlProp(m_VclCtl->Font, Value);
: FireOnChanged(dispid);
: }
: catch(Exception &e)
: {
: return Error(e.Message.c_str(), IID_IL1_cli);
: }
: return S_OK;
: };
:
: ***에러메세지 : E2105 Ambiguity between 'IFontDisp' and 'Excel_tlb::IFontDisp'.
:
: 이상입니다..
: 바쁘실텐데 많은 도움 주셔서 대단히 감사합니다..
:
안녕하십니까?
한꼬맹이 입니다.
에러내용은 엑티브폼의 IFontDisp 하고 임포트한 엑셀의 'Excel_tlb::IFontDisp'
하고 이름이 똑같아서 생기는 에러입니다. 그러면 어디껀지 명시해주면 되겠죠...
만약 엑셀꺼라면 'Excel_tlb::IFontDisp' 이런식으로 표현해주고 엑티브폼꺼면
'::IFontDisp' 앞에다 scope 연산자(::)만 붙혀주면 됩니다.
그럼 참고하시길....
|