線上訂房服務-台灣趴趴狗聯合訂房中心
發文 回覆 瀏覽次數:1063
推到 Plurk!
推到 Facebook!

BCB6 讀取EXCEL 資料的問題

尚未結案
wan.chieh
一般會員


發表:2
回覆:0
積分:0
註冊:2004-04-22

發送簡訊給我
#1 引用回覆 回覆 發表時間:2004-08-05 10:02:08 IP:61.31.xxx.xxx 未訂閱
各為大大您好 小弟想要問讀取EXCEL檔案的問題 小弟有找了很多站裡面很多有關於EXCEL檔案的問題 可是有些語法真的看不懂 真的不知道是什麼用途 所以我就想把我的問題說清楚一點 請各位大大指教    以下是我excel的檔案 在紅色框起來的地方是我想要讀取的陣列 以下是我的程式碼
//---------------------------------------------------------------------------    #include 
#include <math.h>
#include 
#include 
#pragma hdrstop    #include "Unit3.h"
#include "Unit2.h"
#include "Unit1.h"    //---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm3 *Form3;      extern double W_xh[10][10],W_hh[10][10][10],W_hy[10][10],
                Theta_h[10][10],delta_y[10];      extern int Nhidden,
             neuron,
             Ndata;      double h[10][10],
         y[10];
  int x[1000][10];      char *file1,*file2,*file3;
  FILE *input_data1,*input_data2,*output_data;
//---------------------------------------------------------------------------
__fastcall TForm3::TForm3(TComponent* Owner)
        : TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm3::Button1Click(TObject *Sender)
{
  OpenDialog1->Execute();
  strcpy(file1,OpenDialog1->FileName.c_str());
  input_data1=fopen(file1,"r");
}
//---------------------------------------------------------------------------    void __fastcall TForm3::Button2Click(TObject *Sender)
{
  OpenDialog2->Execute();
  strcpy(file2,OpenDialog2->FileName.c_str());
  input_data2=fopen(file2,"r");
}
//---------------------------------------------------------------------------    void __fastcall TForm3::Button4Click(TObject *Sender)
{
  OpenDialog3->Execute();
  strcpy(file3,OpenDialog3->FileName.c_str());
  output_data=fopen(file3,"w+");
}
//---------------------------------------------------------------------------
我想要在button2的地方想要讀這個excel的檔案~ 問題一:我的os為xp office_xp BCB6 我一開始是不是要include什麼東西? 問題二:以不改變我自己基本的程式的情況下,要讀取excel檔案,有哪些"必要"的語法及程式碼呢? p.s.x[1000][10] //x[資料比數][一筆資料的item],excel當中一列為一筆資料 煩請各位大大在添加的程式碼後面加註解,請盡量不要利用轉貼的文章,小弟真的看不懂 麻煩各位的回答 謝謝各位~
RaynorPao
版主


發表:139
回覆:3622
積分:7025
註冊:2002-08-12

發送簡訊給我
#2 引用回覆 回覆 發表時間:2004-08-06 10:16:21 IP:203.73.xxx.xxx 未訂閱
引言: 各為大大您好 小弟想要問讀取EXCEL檔案的問題 小弟有找了很多站裡面很多有關於EXCEL檔案的問題 可是有些語法真的看不懂 真的不知道是什麼用途 所以我就想把我的問題說清楚一點 請各位大大指教 以下是我excel的檔案 在紅色框起來的地方是我想要讀取的陣列 以下是我的程式碼
//---------------------------------------------------------------------------    #include 
#include <math.h>
#include 
#include 
#pragma hdrstop    #include "Unit3.h"
#include "Unit2.h"
#include "Unit1.h"    //---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm3 *Form3;      extern double W_xh[10][10],W_hh[10][10][10],W_hy[10][10],
                Theta_h[10][10],delta_y[10];      extern int Nhidden,
             neuron,
             Ndata;      double h[10][10],
         y[10];
  int x[1000][10];      char *file1,*file2,*file3;
  FILE *input_data1,*input_data2,*output_data;
//---------------------------------------------------------------------------
__fastcall TForm3::TForm3(TComponent* Owner)
        : TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm3::Button1Click(TObject *Sender)
{
  OpenDialog1->Execute();
  strcpy(file1,OpenDialog1->FileName.c_str());
  input_data1=fopen(file1,"r");
}
//---------------------------------------------------------------------------    void __fastcall TForm3::Button2Click(TObject *Sender)
{
  OpenDialog2->Execute();
  strcpy(file2,OpenDialog2->FileName.c_str());
  input_data2=fopen(file2,"r");
}
//---------------------------------------------------------------------------    void __fastcall TForm3::Button4Click(TObject *Sender)
{
  OpenDialog3->Execute();
  strcpy(file3,OpenDialog3->FileName.c_str());
  output_data=fopen(file3,"w+");
}
//---------------------------------------------------------------------------
我想要在button2的地方想要讀這個excel的檔案~ 問題一:我的os為xp office_xp BCB6 我一開始是不是要include什麼東西? 問題二:以不改變我自己基本的程式的情況下,要讀取excel檔案,有哪些"必要"的語法及程式碼呢? p.s.x[1000][10] //x[資料比數][一筆資料的item],excel當中一列為一筆資料 煩請各位大大在添加的程式碼後面加註解,請盡量不要利用轉貼的文章,小弟真的看不懂 麻煩各位的回答 謝謝各位~ < face="Verdana, Arial, Helvetica"> wan.chieh 你好: 請參考以下的連結文章,自行修改 src="http://delphi.ktop.com.tw/loadfile.php?TOPICID=10003806&CC=223734"> -- Enjoy Researching & Developing --
------
-- 若您已經得到滿意的答覆,請適時結案!! --
-- 欲知前世因,今生受者是;欲知來世果,今生做者是 --
-- 一切有為法,如夢幻泡影,如露亦如電,應作如是觀 --
系統時間:2024-05-15 21:20:05
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!