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
[62571] Re:Re:StringGrid ->.csv -> 엑셀로 열기
로즈마일런 [mylgw] 2292 읽음    2010-10-04 11:12
착한아빠 님이 쓰신 글 :
: 이건우 님이 쓰신 글 :
: : 스트링그리드 데이타를 .csv로 저장해서 엑셀로 여는 방법좀 알려주세요 ㅠㅠ
: : 고수님들 부탁 드립니다
:
: 대단히 간단한데요
: (Col구분은 ','로 하고 Row는 "\r\n")
:
:
: #include <vcl.h>
: #pragma hdrstop
:
: #include "Unit1.h"
: //---------------------------------------------------------------------------
: #pragma package(smart_init)
: #pragma resource "*.dfm"
: TForm1 *Form1;
: //---------------------------------------------------------------------------
: __fastcall TForm1::TForm1(TComponent* Owner)
:     : TForm(Owner)
: {
: }
: //---------------------------------------------------------------------------
:
: void __fastcall TForm1::BitBtn1Click(TObject *Sender)
: {
:         AnsiString sContents;
:         for(int iRow=0;iRow<StringGrid1->RowCount;iRow++){
:             for(int iCol=0;iCol<StringGrid1->ColCount;iCol++){
:                 sContents= sContents+ StringGrid1->Cells[iCol][iRow]+AnsiString(",");
:             }
:             sContents= sContents+AnsiString("\r\n");
:         }
:
:         AnsiString sFileName ="C:\\Test.csv";
:         if(FileExists(sFileName)) {
:             DeleteFile(sFileName);
:         }
:         int iFileHandle=FileCreate(sFileName);
:         FileWrite(iFileHandle,sContents.c_str(),sContents.Length());
:         FileClose(iFileHandle);
:
: }
: //---------------------------------------------------------------------------

다른방법으로 했었는데 간단하게 할수 있었네요^^;;
감사합니다(__)

+ -

관련 글 리스트
62468 StringGrid ->.csv -> 엑셀로 열기 이건우 1115 2010/09/16
62536     Re:StringGrid ->.csv -> 엑셀로 열기 착한아빠 1776 2010/09/29
62571         Re:Re:StringGrid ->.csv -> 엑셀로 열기 로즈마일런 2292 2010/10/04
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.