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
[70752] Re:Re:Re:Re:엑셀파일 저장시 문제
[] 966 읽음    2014-01-21 22:05

아래와 같이 사용해 보세요.
awb.OleProcedure("Save");
==> awb.OleProcedure("Save", (OleVariant)xl_fname);
==> awb.OleProcedure("SaveAs", (OleVariant)xl_fname);



smleelms 님이 쓰신 글 :
: // Excel's Application Object
: xlApp = Variant::CreateObject("Excel.Application");
: xlApp.OlePropertySet("DisplayAlerts", false);
: xlApp.OlePropertySet("Visible", false);
:
: 이렇게 처리해 보시기 바랍니다.
: 명령어대로 DisplayAlerts은 메시지를 관련사항이구요..
: Visible은 우리님이 원하시는데로 처리하시면 됩니다.
:
: 그럼, 좋은 결과있으시기를..
:
: 우리 님이 쓰신 글 :
: : 답변 진심으로 감사합니다.
: :
: : 그런데 문제는 여전히 발생하는 군요 ㅜ.ㅜ
: :
: : awb.OleProcedure("Save");
: : awb.OleProcedure("Close");
: : ex.OleProcedure("Quit");
: :
: : 이 부분에서 "alex"님께서 알려주신데로 하면 여전히 문제가 발생하구요
: :
: : awb.OleProcedure("Save");
: : awb.OleProcedure("Close",(Variant)false );
: : ex.OleProcedure("Quit");
: :
: : 위에서 Save 를 빼면 팝업창은 안뜨는데 저장은 안되는군요 ㅜㅡ;;;;;;
: :
: : //awb.OleProcedure("Save");
: : awb.OleProcedure("Close",(Variant)false );
: : ex.OleProcedure("Quit");
: :
: : 잉~~ ㅜ.ㅜ 어떻게 방법이 없을까요?
: :
: : 화면 켑춰하여 올립니다.
: :
: :
: : alex 님이 쓰신 글 :
: : : Chane to this..
: : :
: : : awb.OleProcedure("Close",(Variant)false );
: : :
: : :
: : : 우리 님이 쓰신 글 :
: : : : 엑셀파일을 열어서 읽고 셀 하나에 값을 넣고
: : : :
: : : : 저장하고 나오는 간단한 소스입니다.
: : : :
: : : : 그런데 실행하면 팝업창이 뜨면서 "이미 기존파알이 있으니 교체하겠냐" 는 메시지가 뜹니다.
: : : :
: : : : 이거 안뜨게 하고 바로 저장하게 할수는 없나요?
: : : :
: : : : 고수님들 알려주세요 ~ ^^;;
: : : :
: : : : //---------------------------------------------------------------------------
: : : : #include <vcl.h>
: : : : #pragma hdrstop
: : : :
: : : : #include "utilcls.h"
: : : : #include <graphics.hpp>
: : : : #include "Unit1.h"
: : : : //---------------------------------------------------------------------------
: : : : #pragma package(smart_init)
: : : : #pragma resource "*.dfm"
: : : : TForm1 *Form1;
: : : : //---------------------------------------------------------------------------
: : : : __fastcall TForm1::TForm1(TComponent* Owner)
: : : :     : TForm(Owner)
: : : : {
: : : : }
: : : : //---------------------------------------------------------------------------
: : : :
: : : : void __fastcall TForm1::Button1Click(TObject *Sender)
: : : : {
: : : :   Variant ex=Variant::CreateObject("Excel.Application");
: : : :   ex.OlePropertyGet("WorkBooks").OleProcedure("Open","c:\\test.xls");
: : : :   Variant awb=ex.OlePropertyGet("ActiveWorkBook");
: : : :   Variant sh=awb.OlePropertyGet("ActiveSheet");//엑티브sheet
: : : : //  Variant sh=awb.OlePropertyGet("Sheets").OlePropertyGet("item",1);//sheet1
: : : : //  Variant sh=awb.OlePropertyGet("Sheets").OlePropertyGet("item",2);//sheet2
: : : :
: : : :   int row=sh.OlePropertyGet("UsedRange").OlePropertyGet("Rows").OlePropertyGet("Count"); //row갯수
: : : :   int col=sh.OlePropertyGet("UsedRange").OlePropertyGet("Columns").OlePropertyGet("Count");//col갯수
: : : :
: : : :   StringGrid1->RowCount=row+1;
: : : :   StringGrid1->ColCount=col+1;
: : : :
: : : :   for(int j=0;j<row;j++){
: : : :     for(int i=0;i<col;i++){
: : : :       StringGrid1->Cells[i+1][j+1]=sh.OlePropertyGet("Cells",j+1,i+1).OlePropertyGet("Value");
: : : :     }
: : : :   }
: : : :
: : : :   sh.OlePropertyGet("Cells").OlePropertySet("_Default", 1, 1, "test");
: : : :
: : : :   awb.OleProcedure("Save");
: : : :   awb.OleProcedure("Close");
: : : :   ex.OleProcedure("Quit");
: : : :
: : : :   awb=Unassigned;
: : : :   ex=Unassigned;
: : : :
: : : : }

+ -

관련 글 리스트
44037 엑셀파일 저장시 문제 우리 1254 2006/03/10
44039     Re:엑셀파일 저장시 문제 alex 1382 2006/03/10
44040         Re:Re:엑셀파일 저장시 문제 우리 1704 2006/03/10
44043             Re:Re:Re:엑셀파일 저장시 문제 smleelms 1670 2006/03/10
70752                 Re:Re:Re:Re:엑셀파일 저장시 문제 966 2014/01/21
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.