Home
Top.Mail.Ru Yandeks.Metrika
Forum: "Main";
Current archive: 2002.01.08;
Download: [xml.tar.bz2];

Down

Transferring data to an Excel worksheet cell Find similar branches


Striker   (2001-12-13 07:59) [0]

Please tell me how to write a variable of type string or real to the specified cell of the EXCEL sheet. (I would like to give an example). Thank you earlier.



perov   (2001-12-13 08:21) [1]

ExcelApplication.Connect; ExcelApplication.Workbooks.Add ("", 0); ExcelWorkbook.ConnectTo (ExcelApplication.ActiveWorkbook); ExcelWorksheet.ConnectTo (ExcelWorkbook.Sheets [1] as _WorkSheet); ExcelWorksheet.Activate; ExcelWorksheet.Cells.Item [j, 1] .Value: = j - i; ExcelApplication.Visible [0]: = True;



KIR   (2001-12-13 08:32) [2]

This is also a question to catch up with, and how after that this XL can be properly closed? And then the transfer once (though from Excel "I) works for me, and if I try again, then Memory Allocation Error ...



perov   (2001-12-13 08:44) [3]

ExcelApplication.Disconnect;



Striker   (2001-12-13 09:00) [4]

Big Thank "s home try.



KIR   (2001-12-13 12:02) [5]

> perov
Already wrote
and ExcelApplication.Disconnect,
and ExcelApplication.Quit,
and FreeAndNil (ExcelApplication) ...
does not help, here is a piece of code:

ExcelApplication1.Connect;
ExcelApplication1.WorkBooks.Add (n, 0); // n is the file name
ExcelWorkBook1.ConnectTo (ExcelApplication1.ActiveWorkBook);

{program body}

ExcelApplication.WorkBook1.Close;
ExcelApplication1.Disconnect;



perov   (2001-12-13 12:33) [6]

ExcelWorksheet.Disconnect; ExcelWorkbook.Close; ExcelApplication.Disconnect;



Олег Лаукарт   (2001-12-13 13:33) [7]

In Delphi Kingdom there are a couple of articles about working with Excel



Ынс   (2001-12-13 14:32) [8]

// add this to the modules
uses ComObj;
/ / ...
was
xlApp: Variant;
DataArray: Variant; // two-dimensional array will be here
rv: real;
begin
rv: = 10.56568;
xlApp: = CreateOleObject ("Excel.Sheet"); // create
xlApp.Application.Visible: = True;

xlApp.Application.Cells [1, 2] .Value: = "23456346"; // you can

xlApp.Application.Range ["RealValue1"]. Value: = rv; {it is possible and so: "RealValue1" - the name of the cell in the "cells"}

xlApp.Application.Range ("A1: B8"). Value: = "Just a string to fill the range"; {filling the range in one line}


DataArray: = VarArrayCreate ([0,2,0,2], varVariant); {create an array of the type variant to store any values}
DataArray [0, 0]: = "array element";
DataArray [1, 0]: = 38754; // also an array element

{assign the entire array to the range by reference at once ... cheap, reliable and practical = -) = especially when you need to transfer an array of thousands of 5 lines in the report ... if you do it through a for loop, the report will be generated deadly for a long time}

xlApp.Application.Range ("A1: C3): = DataArray;

// save this file for descendants = -)
xlApp.SaveAs ("c: \ docs \ reports \ sample1.xls");

DataArray: = Unassigned; // sweep tracks
xlApp: = Unassigned; // bang and it ...
end;



Striker   (2001-12-15 11:06) [9]

I rummaged here and found the site (WWW.afalinasoft.com). There is just the interaction Delphi & Excel.



Pages: 1 whole branch

Forum: "Main";
Current archive: 2002.01.08;
Download: [xml.tar.bz2];

Top









Memory: 0.58 MB
Time: 0.028 c
14-22383
Vadim
2001-11-08 11:01
2002.01.08
Programmer Forums


3-21952
S_King
2001-12-04 10:18
2002.01.08
Determine the first free ID


1-22190
T2
2001-12-14 03:22
2002.01.08
KillSelf


6-22305
Kryptin phreek
2001-10-11 19:43
2002.01.08
Sockets ... Lokka ...


7-22421
Shen
2001-08-28 15:05
2002.01.08
Data upload via com port





afrikaans albanian Arabic armenian azerbaijani basque belarusian bulgarian catalan Chinese (Simplified) Chinese (Traditional) croatian Czech danish Dutch English estonian filipino finnish French
galician georgian German greek haitian Creole hebrew Hindi hungarian icelandic indonesian Irish italian Japanese Korean latvian lithuanian macedonian malay maltese norwegian
persian polish portuguese Romanian russian serbian slovak Slovenian Español swahili Swedish thai turkish Ukrainian urdu vietnamese welsh yiddish bengali bosnian
cebuano Esperanto gujarati hausa hmong igbo javanese kannada khmer lao latin maori marathi mongolian nepali punjabi somali tamil telugu yoruba
zulu
English French German Italian Portuguese Russian Spanish