interbase ile office partner kullanımı

Delphi'de kod yazma ile ilgili sorularınızı bu foruma yazabilirsiniz.
Cevapla
Kullanıcı avatarı
Fatih!
Kıdemli Üye
Mesajlar: 1172
Kayıt: 26 Kas 2004 10:46
Konum: Malatya
İletişim:

interbase ile office partner kullanımı

Mesaj gönderen Fatih! »

paradox kullanarak office partner componenti ile excele ve worde tabloyu aktarıyordum. projeyi interbaseye çeviriyorum ama ne hikmetse aynı kodları kullanmama rağmen index out of bounds diye bir hata veriyor.
eskiden table kullanıyordum şimdi ibtable. ne yapacağımı şaşırdım. sadece bir tablo göndercem.
,yardımınızı bekliyorum.
Kullanıcı avatarı
mussimsek
Admin
Mesajlar: 7603
Kayıt: 10 Haz 2003 12:26
Konum: İstanbul
İletişim:

Mesaj gönderen mussimsek »

kodları görmeden biraz havada bir yorum olacak anca IBTable tüm kayıtları çekmez. IBTable1.FetchAll komutu ile tüm kayıtları alıp öyle bir dene.

Kolay gelsin.
Kullanıcı avatarı
Fatih!
Kıdemli Üye
Mesajlar: 1172
Kayıt: 26 Kas 2004 10:46
Konum: Malatya
İletişim:

Mesaj gönderen Fatih! »

Kod: Tümünü seç

procedure TForm1.MicrosftExceleGnder1Click(Sender: TObject);
 var
 Rng : TOpExcelRange;
begin
    DataModule2.tblCustomers.FetchAll;
  if OpExcel.Connected = False then
    OpExcel.Connected := True;
  {Office applications start up hidden by default. To show Excel, all
  we need to do is set its visible property to True.}
  OpExcel.Visible := True;
    DataModule2.tblCustomers.Active:=true;
  {the following 5 properties can be set at design-time.
  They are set here in code for demonstration purposes
  only}
  {add a range to the first worksheet}
  Rng := OpExcel.Workbooks[0].Worksheets[0].Ranges.Add;
  {Give the name a range (simplifies access)}
  Rng.Name := 'CustomerRange';
  {We'll only set the anchor cell since we are
    populating the range through a dataset (unknown
    columns & rows)}
  Rng.Address := 'A1';
  {associate the DataSeodel with the range}
  Rng.OfficeModel := DataModule2.mdlCustomers;
  {associate the DataSeodel with the DataSet}
  DataModule2.mdlCustomers.Dataset :=
    DataModule2.tblCustomers;
  {Fill the first worksheet (starting with the anchor
  cell) with every data column and row in the DataSet}
  OpExcel.RangeByName['CustomerRange'].Populate;
  {Activate the first worksheet}
  OpExcel.Workbooks[0].Worksheets[0].Activate;
  Rng.AsRange.Columns.AutoFit;
  DataModule2.tblCustomers.Active:=false;
 end;
FetchAll da işe yaramadı
Kullanıcı avatarı
Fatih!
Kıdemli Üye
Mesajlar: 1172
Kayıt: 26 Kas 2004 10:46
Konum: Malatya
İletişim:

Mesaj gönderen Fatih! »

arkadaşlar sabahtan beri uğraşıyorum yapmak için hala başaramadım. bde bileşenleriyle yapayım dedim olmadı. sql error diyerek çalıştırmadı. table kullanmama rağmen.
bilen yada kullanan arkadaşlardan ricam bir örnek yada ipucu vermeleri.
eğer bu problemimi halledebilirsem ilk programım olacak.
Kullanıcı avatarı
Fatih!
Kıdemli Üye
Mesajlar: 1172
Kayıt: 26 Kas 2004 10:46
Konum: Malatya
İletişim:

Mesaj gönderen Fatih! »

arkadaşlar sonunda sorunumu hallettim.
başkası çekmesin diyerekten işte kodlar.

Kod: Tümünü seç

procedure TForm1.MicrosftExceleGnder1Click(Sender: TObject);
 var
 Rng : TOpExcelRange;
 newbook:topexcelworkbook;
begin

  if OpExcel.Connected = False then begin
    OpExcel.Connected := True;
  OpExcel.Visible := True;               end;
    DataModule2.tblCustomers.Active:=true;
newbook:=opexcel.Workbooks.Add;
  Rng := OpExcel.Workbooks[0].Worksheets[0].Ranges.Add;
  Rng.Name := 'CustomerRange';
  Rng.Address := 'A1';
  Rng.OfficeModel := DataModule2.mdlCustomers;
  DataModule2.mdlCustomers.Dataset :=
    DataModule2.tblCustomers;
  OpExcel.RangeByName['CustomerRange'].Populate;
  OpExcel.Workbooks[0].Worksheets[0].Activate;
  Rng.AsRange.Columns.AutoFit;
  DataModule2.tblCustomers.Active:=false;
 end;
Cevapla