 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Kevin Pollard Guest
|
Posted: Mon Dec 01, 2003 7:03 am Post subject: How do I write an Excel file from Delphi6 Professional? |
|
|
How do I write an Excel file from Delphi6 Professional? Currently I
write the file out as a Comma Separate Values (CSV) file and ask users
to double click on it so that Excel opens it. But I'd like to write a
proper Excel (XLS) file.
How can i do that in Delphi 6 Professional?
|
|
| Back to top |
|
 |
ralph Guest
|
Posted: Mon Dec 01, 2003 12:53 pm Post subject: Re: How do I write an Excel file from Delphi6 Professional? |
|
|
I don't know how to write an .xls file, but you could write it in .csv
format by simply writing a text file with commas as a delimiter.
"Kevin Pollard" <kpollard (AT) scu (DOT) edu.au> wrote
| Quote: | How do I write an Excel file from Delphi6 Professional? Currently I
write the file out as a Comma Separate Values (CSV) file and ask users
to double click on it so that Excel opens it. But I'd like to write a
proper Excel (XLS) file.
How can i do that in Delphi 6 Professional?
|
|
|
| Back to top |
|
 |
Martijn Saly Guest
|
Posted: Mon Dec 01, 2003 5:37 pm Post subject: Re: How do I write an Excel file from Delphi6 Professional? |
|
|
| Quote: | How do I write an Excel file from Delphi6 Professional? Currently I
write the file out as a Comma Separate Values (CSV) file and ask users
to double click on it so that Excel opens it. But I'd like to write a
proper Excel (XLS) file.
|
Why don't you use the MS Office Server components that come with delphi? In
your case, they use OLE to call on Excel and you could sort "ask Excel to
create a document".
--
Thanks,
Martijn Saly
|
|
| Back to top |
|
 |
Charles LaCour Guest
|
Posted: Wed Dec 10, 2003 7:31 pm Post subject: Re: How do I write an Excel file from Delphi6 Professional? |
|
|
"ralph" <machio (AT) karatekid (DOT) com> wrote
| Quote: | I don't know how to write an .xls file, but you could write it in .csv
format by simply writing a text file with commas as a delimiter.
|
What part of the original poster's messege did you not understand?
| Quote: |
"Kevin Pollard" <kpollard (AT) scu (DOT) edu.au> wrote in message
news:c88c808c.0311302303.4999ba18 (AT) posting (DOT) google.com...
How do I write an Excel file from Delphi6 Professional? Currently I
write the file out as a Comma Separate Values (CSV) file and ask users
to double click on it so that Excel opens it. But I'd like to write a
proper Excel (XLS) file.
How can i do that in Delphi 6 Professional?
|
|
|
| Back to top |
|
 |
Frits v/d Laan Guest
|
Posted: Sat Dec 27, 2003 12:45 am Post subject: Re: How do I write an Excel file from Delphi6 Professional? |
|
|
I got this from an example and it works well
(uses SHELLAPI)
excelapplication - component
( D5)
procedure Tselform.BitBtn2Click(Sender: TObject);
var RangeE: Excel97.Range;
I, Row,fc: Integer;
Bookmark: TBookmarkStr;
begin
// create and show
ExcelApplication1.Visible [0] := True;
ExcelApplication1.Workbooks.Add (NULL, 0);
// fill is the first row with field titles
RangeE := ExcelApplication1.ActiveCell;
for I := 0 to seltable.Fields.Count - 1 do
begin
RangeE.Value := seltable.Fields [I].DisplayLabel;
RangeE := RangeE.Next;
end;
// add field data in following rows
seltable.DisableControls;
try
Bookmark := seltable.Bookmark;
try
seltable.First;
Row := 2;
while not seltable.EOF do
begin
RangeE := ExcelApplication1.Range ['A' + IntToStr (Row),
'A' + IntToStr (Row)];
for I := 0 to seltable.Fields.Count - 1 do
begin
RangeE.Value := seltable.Fields [I].AsString;
RangeE := RangeE.Next;
end;
seltable.Next;
Inc (Row);
end;
finally
seltable.Bookmark := Bookmark;
end;
finally
seltable.EnableControls;
end;
// format the section
RangeE := ExcelApplication1.Range ['A1', 'K' + IntToStr (Row - 1)];
RangeE.AutoFormat (3, NULL, NULL, NULL, NULL, NULL, NULL);
end;
On Mon, 1 Dec 2003 18:37:58 +0100, "Martijn Saly" <martijn (AT) thany (DOT) org>
wrote:
| Quote: | How do I write an Excel file from Delphi6 Professional? Currently I
write the file out as a Comma Separate Values (CSV) file and ask users
to double click on it so that Excel opens it. But I'd like to write a
proper Excel (XLS) file.
Why don't you use the MS Office Server components that come with delphi? In
your case, they use OLE to call on Excel and you could sort "ask Excel to
create a document".
|
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|