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.
interbase ile office partner kullanımı
Forum kuralları
Forum kurallarını okuyup, uyunuz!
Forum kurallarını okuyup, uyunuz!
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;
arkadaşlar sonunda sorunumu hallettim.
başkası çekmesin diyerekten işte kodlar.
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;