comp.lang.ada
 help / color / mirror / Atom feed
* excel files
@ 2004-10-04 19:16 Alexandre Devaure
  2004-10-04 19:42 ` stephane richard
                   ` (3 more replies)
  0 siblings, 4 replies; 25+ messages in thread
From: Alexandre Devaure @ 2004-10-04 19:16 UTC (permalink / raw)


Hello,
Does a library exist in Ada to read MS Excel files ?
I find nothing with google.

TIA
Alex



^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: excel files
  2004-10-04 19:16 Alexandre Devaure
@ 2004-10-04 19:42 ` stephane richard
  2004-10-04 20:02   ` Chris Humphries
                     ` (2 more replies)
  2004-10-04 20:42 ` Martin Dowie
                   ` (2 subsequent siblings)
  3 siblings, 3 replies; 25+ messages in thread
From: stephane richard @ 2004-10-04 19:42 UTC (permalink / raw)



"Alexandre Devaure" <adevaure@free.fr> wrote in message 
news:4161a1b5$0$22589$636a15ce@news.free.fr...
> Hello,
> Does a library exist in Ada to read MS Excel files ?
> I find nothing with google.
>
> TIA
> Alex

I haven't found anything either.  I'd be curious to see if anyone else might 
possibly have that answer.  What I did find is a VB Class (no flaming please 
;-)  that writes it in a binary/native format as in without using any office 
references...Perhaps I could convert that to Ada.  As far as structures go I 
think it's pretty straight forward.

Which brings me to my quest of the day.   What can I use in the Ada 
hierarchy that will open a file in binary mode and not in sequential text 
mode?  seems there's a difference at least in VB ..if there's such an open 
mode in Ada then the translation from vb to Ada should be pretty 
straightforward I think 





^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: excel files
  2004-10-04 19:42 ` stephane richard
@ 2004-10-04 20:02   ` Chris Humphries
  2004-10-05  0:29   ` Jeffrey Carter
  2004-10-05  1:20   ` Stephen Leake
  2 siblings, 0 replies; 25+ messages in thread
From: Chris Humphries @ 2004-10-04 20:02 UTC (permalink / raw)


Hello

stephane richard wrote:
> "Alexandre Devaure" <adevaure@free.fr> wrote in message 
> news:4161a1b5$0$22589$636a15ce@news.free.fr...
> 
>>Hello,
>>Does a library exist in Ada to read MS Excel files ?
>>I find nothing with google.
>>

How often do the excel files get changed where you will
need to process them? Could use a perl module to parse
the file and output the data into some delimited format.
Then you can use Ada to do it.

An example may be some web cgi to allow users to post
excel files, then the perl can parse it and store it
later to be processed by Ada.

Seems better to use Perl if able to do it to something
Ada can understand and work with, as excel files generally
do not change that much. If they do, then whoever is
using the excel for a database should just use a database :)

People's lives are not on the line, so using perl or
some other preparser for excel files doesn't seem all
that bad in my opinion. :)

Perl module options:
http://search.cpan.org/search?query=Parse+Spreadsheet&mode=all

Good luck!


>>TIA
>>Alex
> 
> 
> I haven't found anything either.  I'd be curious to see if anyone else might 
> possibly have that answer.  What I did find is a VB Class (no flaming please 
> ;-)  that writes it in a binary/native format as in without using any office 
> references...Perhaps I could convert that to Ada.  As far as structures go I 
> think it's pretty straight forward.
> 
> Which brings me to my quest of the day.   What can I use in the Ada 
> hierarchy that will open a file in binary mode and not in sequential text 
> mode?  seems there's a difference at least in VB ..if there's such an open 
> mode in Ada then the translation from vb to Ada should be pretty 
> straightforward I think 
> 
> 



^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: excel files
  2004-10-04 19:16 Alexandre Devaure
  2004-10-04 19:42 ` stephane richard
@ 2004-10-04 20:42 ` Martin Dowie
  2004-10-04 22:20   ` Jeff C r e e.m
  2004-10-05  7:45   ` Georg Bauhaus
  2004-10-04 21:40 ` tmoran
  2004-10-05  0:55 ` David Botton
  3 siblings, 2 replies; 25+ messages in thread
From: Martin Dowie @ 2004-10-04 20:42 UTC (permalink / raw)


"Alexandre Devaure" <adevaure@free.fr> wrote in message 
news:4161a1b5$0$22589$636a15ce@news.free.fr...
> Hello,
> Does a library exist in Ada to read MS Excel files ?
> I find nothing with google.

You should check out "GNATCOM" (under "COM/DCOM") @ www.adapower.com





^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: excel files
  2004-10-04 19:16 Alexandre Devaure
  2004-10-04 19:42 ` stephane richard
  2004-10-04 20:42 ` Martin Dowie
@ 2004-10-04 21:40 ` tmoran
  2004-10-05  6:30   ` Pascal Obry
  2004-10-05  0:55 ` David Botton
  3 siblings, 1 reply; 25+ messages in thread
From: tmoran @ 2004-10-04 21:40 UTC (permalink / raw)


>Does a library exist in Ada to read MS Excel files ?
>I find nothing with google.
  Please post if you find such a thing.  The only way I've found is to
save as SYLK and read that (text file).



^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: excel files
  2004-10-04 20:42 ` Martin Dowie
@ 2004-10-04 22:20   ` Jeff C r e e.m
  2004-10-05  7:45   ` Georg Bauhaus
  1 sibling, 0 replies; 25+ messages in thread
From: Jeff C r e e.m @ 2004-10-04 22:20 UTC (permalink / raw)



"Martin Dowie" <martin.dowie@btopenworld.com> wrote in message 
news:cjscj4$8av$1@titan.btinternet.com...
> "Alexandre Devaure" <adevaure@free.fr> wrote in message 
> news:4161a1b5$0$22589$636a15ce@news.free.fr...
>> Hello,
>> Does a library exist in Ada to read MS Excel files ?
>> I find nothing with google.
>
> You should check out "GNATCOM" (under "COM/DCOM") @ www.adapower.com


This is correct.. I have not done this with a recent version of Excel but 
with office 97 I used GNATCOM and it did indeed create an automatic
binding to Excel..I never used it for anything real..Just sort of played 
with it a little.





^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: excel files
  2004-10-04 19:42 ` stephane richard
  2004-10-04 20:02   ` Chris Humphries
@ 2004-10-05  0:29   ` Jeffrey Carter
  2004-10-05  1:20   ` Stephen Leake
  2 siblings, 0 replies; 25+ messages in thread
From: Jeffrey Carter @ 2004-10-05  0:29 UTC (permalink / raw)


stephane richard wrote:
> 
> Which brings me to my quest of the day.   What can I use in the Ada 
> hierarchy that will open a file in binary mode and not in sequential
> text mode?  seems there's a difference at least in VB ..if there's
> such an open mode in Ada then the translation from vb to Ada should
> be pretty straightforward I think

You can use Ada.Sequential_IO or streams for binary IO.

-- 
Jeff Carter
"You tiny-brained wipers of other people's bottoms!"
Monty Python & the Holy Grail
18




^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: excel files
  2004-10-04 19:16 Alexandre Devaure
                   ` (2 preceding siblings ...)
  2004-10-04 21:40 ` tmoran
@ 2004-10-05  0:55 ` David Botton
  3 siblings, 0 replies; 25+ messages in thread
From: David Botton @ 2004-10-05  0:55 UTC (permalink / raw)


You can use GNATCOM to to access the files via OLE.

David Botton

On 2004-10-04 15:16:43 -0400, Alexandre Devaure <adevaure@free.fr> said:

> Hello,
> Does a library exist in Ada to read MS Excel files ?
> I find nothing with google.
> 
> TIA
> Alex





^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: excel files
  2004-10-04 19:42 ` stephane richard
  2004-10-04 20:02   ` Chris Humphries
  2004-10-05  0:29   ` Jeffrey Carter
@ 2004-10-05  1:20   ` Stephen Leake
  2 siblings, 0 replies; 25+ messages in thread
From: Stephen Leake @ 2004-10-05  1:20 UTC (permalink / raw)
  To: comp.lang.ada

"stephane richard" <stephane.richard@verizon.net> writes:

> Which brings me to my quest of the day.   What can I use in the Ada 
> hierarchy that will open a file in binary mode and not in sequential text 
> mode?  

Ada.Streams.Stream_IO should do that. But you may need a "form" parameter.

-- 
-- Stephe




^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: excel files
  2004-10-04 21:40 ` tmoran
@ 2004-10-05  6:30   ` Pascal Obry
  2004-10-05 17:31     ` tmoran
  0 siblings, 1 reply; 25+ messages in thread
From: Pascal Obry @ 2004-10-05  6:30 UTC (permalink / raw)



> Does a library exist in Ada to read MS Excel files ?

Depending on what you have in your Excel file, but you can use it as a DB and
use ODBC to access data.

Pascal.

-- 

--|------------------------------------------------------
--| Pascal Obry                           Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--|              http://www.obry.org
--| "The best way to travel is by means of imagination"
--|
--| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595



^ permalink raw reply	[flat|nested] 25+ messages in thread

* excel files
       [not found] <20041005034017.9E75B4C4137@lovelace.ada-france.org>
@ 2004-10-05  6:49 ` Andrew
  2004-10-05 21:37   ` David Botton
  0 siblings, 1 reply; 25+ messages in thread
From: Andrew @ 2004-10-05  6:49 UTC (permalink / raw)
  To: comp.lang.ada

Or, if there is a way to use ODBC with Ada you can connect to the Excel
file via ODBC. ;-)

Andrew Carroll
Carroll-Tech
720-273-6814
andrew@carroll-tech.net





^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: excel files
  2004-10-04 20:42 ` Martin Dowie
  2004-10-04 22:20   ` Jeff C r e e.m
@ 2004-10-05  7:45   ` Georg Bauhaus
  2004-10-05 12:32     ` Chris Humphries
  2004-10-05 14:16     ` David Botton
  1 sibling, 2 replies; 25+ messages in thread
From: Georg Bauhaus @ 2004-10-05  7:45 UTC (permalink / raw)


Martin Dowie <martin.dowie@btopenworld.com> wrote:
: "Alexandre Devaure" <adevaure@free.fr> wrote in message 
: news:4161a1b5$0$22589$636a15ce@news.free.fr...
:> Hello,
:> Does a library exist in Ada to read MS Excel files ?
:> I find nothing with google.
: 
: You should check out "GNATCOM" (under "COM/DCOM") @ www.adapower.com

If there is a way to use Microsoft formatted files from .NET,
you could use that as well, using GNAT for .NET.


--  georg



^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: excel files
  2004-10-05  7:45   ` Georg Bauhaus
@ 2004-10-05 12:32     ` Chris Humphries
  2004-10-05 14:16     ` David Botton
  1 sibling, 0 replies; 25+ messages in thread
From: Chris Humphries @ 2004-10-05 12:32 UTC (permalink / raw)


Georg Bauhaus wrote:
> Martin Dowie <martin.dowie@btopenworld.com> wrote:
> : "Alexandre Devaure" <adevaure@free.fr> wrote in message 
> : news:4161a1b5$0$22589$636a15ce@news.free.fr...
> :> Hello,
> :> Does a library exist in Ada to read MS Excel files ?
> :> I find nothing with google.
> : 
> : You should check out "GNATCOM" (under "COM/DCOM") @ www.adapower.com
> 
> If there is a way to use Microsoft formatted files from .NET,
> you could use that as well, using GNAT for .NET.
> 
> 
> --  georg

Now that would be cool ;)

.NET isn't that bad of an idea, and the mono project is really
making huge progress with their open source .NET implementation
and c# development suite. Even think there is VB too, yet it is
not as complete :) http://mono-project.com (novell backed now).



^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: excel files
  2004-10-05  7:45   ` Georg Bauhaus
  2004-10-05 12:32     ` Chris Humphries
@ 2004-10-05 14:16     ` David Botton
  1 sibling, 0 replies; 25+ messages in thread
From: David Botton @ 2004-10-05 14:16 UTC (permalink / raw)


You can use GNATCOM to access .NET components if you don't wish to have 
you APP be a .NET app also.

DB

On 2004-10-05 03:45:23 -0400, Georg Bauhaus 
<sb463ba@l1-hrz.uni-duisburg.de> said:

> Martin Dowie <martin.dowie@btopenworld.com> wrote:
> : "Alexandre Devaure" <adevaure@free.fr> wrote in message : 
> news:4161a1b5$0$22589$636a15ce@news.free.fr...
> :> Hello,
> :> Does a library exist in Ada to read MS Excel files ?
> :> I find nothing with google.
> : : You should check out "GNATCOM" (under "COM/DCOM") @ www.adapower.com
> 
> If there is a way to use Microsoft formatted files from .NET,
> you could use that as well, using GNAT for .NET.
> 
> 
> --  georg





^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: excel files
  2004-10-05  6:30   ` Pascal Obry
@ 2004-10-05 17:31     ` tmoran
  2004-10-05 19:00       ` Alexandre Devaure
  2004-10-05 19:02       ` Pascal Obry
  0 siblings, 2 replies; 25+ messages in thread
From: tmoran @ 2004-10-05 17:31 UTC (permalink / raw)


>Depending on what you have in your Excel file, but you can use it as a DB and
>use ODBC to access data.
  Can you access formulas and formatting via ODBC, or just values in cells?



^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: excel files
  2004-10-05 17:31     ` tmoran
@ 2004-10-05 19:00       ` Alexandre Devaure
  2004-10-05 19:02       ` Pascal Obry
  1 sibling, 0 replies; 25+ messages in thread
From: Alexandre Devaure @ 2004-10-05 19:00 UTC (permalink / raw)


tmoran@acm.org wrote:
>>Depending on what you have in your Excel file, but you can use it as a DB and
>>use ODBC to access data.
> 
>   Can you access formulas and formatting via ODBC, or just values in cells?

What I want is just to read values in cells.



^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: excel files
  2004-10-05 17:31     ` tmoran
  2004-10-05 19:00       ` Alexandre Devaure
@ 2004-10-05 19:02       ` Pascal Obry
  1 sibling, 0 replies; 25+ messages in thread
From: Pascal Obry @ 2004-10-05 19:02 UTC (permalink / raw)



tmoran@acm.org writes:

>   Can you access formulas and formatting via ODBC, or just values in cells?

Don't know. I would bet only values.

Pascal.

-- 

--|------------------------------------------------------
--| Pascal Obry                           Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--|              http://www.obry.org
--| "The best way to travel is by means of imagination"
--|
--| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595



^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: excel files
  2004-10-05  6:49 ` Andrew
@ 2004-10-05 21:37   ` David Botton
  0 siblings, 0 replies; 25+ messages in thread
From: David Botton @ 2004-10-05 21:37 UTC (permalink / raw)


Win 32:

http://www.adapower.com/os/odbc.html

and Pascal's ODBC binding

http://perso.wanadoo.fr/pascal.obry/contrib.html

using GNATCOM using ADO through to ODBC

http://www.adapower.com/gnatcom

David Botton



On 2004-10-05 02:49:53 -0400, "Andrew" <andrew@carroll-tech.net> said:

> Or, if there is a way to use ODBC with Ada you can connect to the Excel
> file via ODBC. ;-)
> 
> Andrew Carroll
> Carroll-Tech
> 720-273-6814
> andrew@carroll-tech.net





^ permalink raw reply	[flat|nested] 25+ messages in thread

* excel files
       [not found] <20041005193515.6C38A4C409F@lovelace.ada-france.org>
@ 2004-10-06  9:52 ` Andrew
  2004-10-06 10:24   ` stephane richard
  0 siblings, 1 reply; 25+ messages in thread
From: Andrew @ 2004-10-06  9:52 UTC (permalink / raw)
  To: comp.lang.ada

> ------------------------------
> Message: 6
> Date: Tue, 05 Oct 2004 21:00:28 +0200
> From: Alexandre Devaure <adevaure@free.fr>
> Subject: Re: excel files
> tmoran@acm.org wrote:
> >>Depending on what you have in your Excel file, but you can use it as
a DB and
> >>use ODBC to access data.
> >
> >   Can you access formulas and formatting via ODBC, or just values in
cells?
>
> What I want is just to read values in cells.
> ------------------------------

Then ODBC should work great!  I think formulas are returned as the
contents of the cell.  I speculate that formatting is stored in some
hidden property object of the sheet or even worksheet.  If you knew
which property object then most likely you could create a recordset of
the contents of the property object and navigate to alter a cell's
formatting.  I do know that named regions in a sheet can be accessed via
ODBC as a table where the name corresponds to the table name that is
specified in the SQL statement.

I wonder if there is a way to create a binding to the libraries in
Visual Basic.  In Visual Basic, and please excuse my "vocabulary" here,
you specify which libraries are associated with the project.  There is a
list and you put little check marks next to the ones you want.  Then you
can use the object browser to view what features that library adds.
Ahhhh, I can't remember all the menu's and menu labels and stuff, darn
it.  I think I have early onset "old timers" disease.

Anyway...
Those libraries are dll files (correct me if I am wrong).  Isn't there a
way to import those into an Ada specification?  If you could do that
then you could use the object browser in VB as your guide and write in
Ada!  This way, you could "import" the Excel libraries and use them with
the same "robustness" as VB does instead of ODBC.

I think someone mentioned something similar to importing dll files with
A#.  Now if I could just remember who that was...

Andrew Carroll
Carroll-Tech
720-273-6814
andrew@carroll-tech.net





^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: excel files
  2004-10-06  9:52 ` excel files Andrew
@ 2004-10-06 10:24   ` stephane richard
  2004-10-06 11:58     ` Chris Humphries
  0 siblings, 1 reply; 25+ messages in thread
From: stephane richard @ 2004-10-06 10:24 UTC (permalink / raw)



"Andrew" <andrew@carroll-tech.net> wrote in message 
news:mailman.208.1097055129.390.comp.lang.ada@ada-france.org...
>> ------------------------------
>> Message: 6
>> Date: Tue, 05 Oct 2004 21:00:28 +0200
>> From: Alexandre Devaure <adevaure@free.fr>
>> Subject: Re: excel files
>> tmoran@acm.org wrote:
>> >>Depending on what you have in your Excel file, but you can use it as
> a DB and
>> >>use ODBC to access data.
>> >
>> >   Can you access formulas and formatting via ODBC, or just values in
> cells?
>>
>> What I want is just to read values in cells.
>> ------------------------------
> I wonder if there is a way to create a binding to the libraries in
> Visual Basic.  In Visual Basic, and please excuse my "vocabulary" here,
> you specify which libraries are associated with the project.  There is a
> list and you put little check marks next to the ones you want.  Then you
> can use the object browser to view what features that library adds.
> Ahhhh, I can't remember all the menu's and menu labels and stuff, darn
> it.  I think I have early onset "old timers" disease.
>
> Anyway...
> Those libraries are dll files (correct me if I am wrong).  Isn't there a
> way to import those into an Ada specification?  If you could do that
> then you could use the object browser in VB as your guide and write in
> Ada!  This way, you could "import" the Excel libraries and use them with
> the same "robustness" as VB does instead of ODBC.
>
Well the real question is how robust is VB ? ;-).  But seriously, most are 
ActiveX DLL's however VB's Excel library won't work unless you have Office 
Installed (with the option of installing the Development part of OFfice, 
hence VBA as well. The best way to describe these Office Objects is wrappers 
around an instance of the application.  I'd rather work with something that 
doesn't need Excel at all but can still read the contents.  But I don't 
matter in this thread since I'm not the original poster of the topic ;-).

If you don't mind need excel installed, then you could use GWindows (from 
the adapower website) and probably importing the Excel classes.




> Andrew Carroll
> Carroll-Tech
> 720-273-6814
> andrew@carroll-tech.net
>
> 





^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: excel files
  2004-10-06 10:24   ` stephane richard
@ 2004-10-06 11:58     ` Chris Humphries
  2004-10-06 16:27       ` Warren W. Gay VE3WWG
  0 siblings, 1 reply; 25+ messages in thread
From: Chris Humphries @ 2004-10-06 11:58 UTC (permalink / raw)


stephane richard wrote:
> "Andrew" <andrew@carroll-tech.net> wrote in message 
> news:mailman.208.1097055129.390.comp.lang.ada@ada-france.org...
> 
>>>------------------------------
>>>Message: 6
>>>Date: Tue, 05 Oct 2004 21:00:28 +0200
>>>From: Alexandre Devaure <adevaure@free.fr>
>>>Subject: Re: excel files
>>>tmoran@acm.org wrote:
>>>
>>>>>Depending on what you have in your Excel file, but you can use it as
>>
>>a DB and
>>
>>>>>use ODBC to access data.
>>>>
>>>>  Can you access formulas and formatting via ODBC, or just values in
>>
>>cells?
>>
>>>What I want is just to read values in cells.
>>>------------------------------
>>
>>I wonder if there is a way to create a binding to the libraries in
>>Visual Basic.  In Visual Basic, and please excuse my "vocabulary" here,
>>you specify which libraries are associated with the project.  There is a
>>list and you put little check marks next to the ones you want.  Then you
>>can use the object browser to view what features that library adds.
>>Ahhhh, I can't remember all the menu's and menu labels and stuff, darn
>>it.  I think I have early onset "old timers" disease.
>>
>>Anyway...
>>Those libraries are dll files (correct me if I am wrong).  Isn't there a
>>way to import those into an Ada specification?  If you could do that
>>then you could use the object browser in VB as your guide and write in
>>Ada!  This way, you could "import" the Excel libraries and use them with
>>the same "robustness" as VB does instead of ODBC.
>>
> 
> Well the real question is how robust is VB ? ;-).  But seriously, most are 
> ActiveX DLL's however VB's Excel library won't work unless you have Office 
> Installed (with the option of installing the Development part of OFfice, 
> hence VBA as well. The best way to describe these Office Objects is wrappers 
> around an instance of the application.  I'd rather work with something that 
> doesn't need Excel at all but can still read the contents.  But I don't 
> matter in this thread since I'm not the original poster of the topic ;-).
> 
> If you don't mind need excel installed, then you could use GWindows (from 
> the adapower website) and probably importing the Excel classes.
> 
> 

Does anyone have any portable Ada code to offer for parsing excel files?
I am a newbie to COM and MFC (well knew it about 6 years ago), and
do not understand how to go about using ODBC or GNATCOM to do the
suggested solutions to this problem. Can someone post some code showing
how to do this, please :)

> 
> 
> 
>>Andrew Carroll
>>Carroll-Tech
>>720-273-6814
>>andrew@carroll-tech.net
>>
>>
> 
> 
> 



^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: excel files
  2004-10-06 11:58     ` Chris Humphries
@ 2004-10-06 16:27       ` Warren W. Gay VE3WWG
  2004-10-06 17:17         ` Chris Humphries
  0 siblings, 1 reply; 25+ messages in thread
From: Warren W. Gay VE3WWG @ 2004-10-06 16:27 UTC (permalink / raw)


Chris Humphries wrote:
> stephane richard wrote:
>> "Andrew" <andrew@carroll-tech.net> wrote in message 
>> news:mailman.208.1097055129.390.comp.lang.ada@ada-france.org...
>>>> From: Alexandre Devaure <adevaure@free.fr>
>>>> Subject: Re: excel files
>>>> tmoran@acm.org wrote:
...
> Does anyone have any portable Ada code to offer for parsing excel files?
> I am a newbie to COM and MFC (well knew it about 6 years ago), and
> do not understand how to go about using ODBC or GNATCOM to do the
> suggested solutions to this problem. Can someone post some code showing
> how to do this, please :)
>>> Andrew Carroll
>>> Carroll-Tech
>>> 720-273-6814
>>> andrew@carroll-tech.net

I don't know if this works for you, but the easiest way to do
this is to have Excel produce *.CSV file (comma delimited).
while paying attention to any quoted fields (which may have
commas as part of the data).

Warren.
-- 
Warren W. Gay VE3WWG
http://home.cogeco.ca/~ve3wwg



^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: excel files
  2004-10-06 16:27       ` Warren W. Gay VE3WWG
@ 2004-10-06 17:17         ` Chris Humphries
  0 siblings, 0 replies; 25+ messages in thread
From: Chris Humphries @ 2004-10-06 17:17 UTC (permalink / raw)


Warren W. Gay VE3WWG wrote:
> Chris Humphries wrote:
> 
>> stephane richard wrote:
>>
>>> "Andrew" <andrew@carroll-tech.net> wrote in message 
>>> news:mailman.208.1097055129.390.comp.lang.ada@ada-france.org...
>>>
>>>>> From: Alexandre Devaure <adevaure@free.fr>
>>>>> Subject: Re: excel files
>>>>> tmoran@acm.org wrote:
> 
> ...
> 
>> Does anyone have any portable Ada code to offer for parsing excel files?
>> I am a newbie to COM and MFC (well knew it about 6 years ago), and
>> do not understand how to go about using ODBC or GNATCOM to do the
>> suggested solutions to this problem. Can someone post some code showing
>> how to do this, please :)
>>
>>>> Andrew Carroll
>>>> Carroll-Tech
>>>> 720-273-6814
>>>> andrew@carroll-tech.net
> 
> 
> I don't know if this works for you, but the easiest way to do
> this is to have Excel produce *.CSV file (comma delimited).
> while paying attention to any quoted fields (which may have
> commas as part of the data).
> 
> Warren.

yeah i am well aware of exporting to csv files, the discussion is
about doing it on the excel files themselves which is what i was
talking about.

earlier in this thread i also recommended that, as well as using
perl with perl modules that can read excel files and get data
from it :)



^ permalink raw reply	[flat|nested] 25+ messages in thread

* excel files
       [not found] <20041006132018.833134C40CC@lovelace.ada-france.org>
@ 2004-10-06 19:56 ` Andrew
  0 siblings, 0 replies; 25+ messages in thread
From: Andrew @ 2004-10-06 19:56 UTC (permalink / raw)
  To: comp.lang.ada

> ------------------------------
> From: Chris Humphries <chris@unixfu.net>
> Subject: Re: excel files
[snip]
> Does anyone have any portable Ada code to offer for parsing excel
files?
> I am a newbie to COM and MFC (well knew it about 6 years ago), and
> do not understand how to go about using ODBC or GNATCOM to do the
> suggested solutions to this problem. Can someone post some code
showing
> how to do this, please :)
[snip]
> ------------------------------

Well, it's not in Ada but this might give you an idea of how to connect
via ODBC.
This is an Active Server Page.

============ code below ===============
<!-- METADATA TYPE="typelib" FILE="C:\Program Files\Common
Files\system\ado\msado15.dll" -->
<html>
<head>
</head>
<body>

<% @Language = "JavaScript" %>
<%

/*
 * The provider is the path to the excel file.  The path provided here
is a relative path.
 * It is later combined with a call to Server.MapPath to generate the
absolute path.
 */
var provider = "\data\\NameOfExcelFile.xls";

/*
 * Our connection information.
 */
var cn = "Driver={Microsoft Excel Driver (*.xls)}; DBQ=" +
Server.MapPath(provider);

/*
 * Our recordset object to manipulate contents of the provider.
 * We are using ADODB, the connection is an ODBC connection.
 */
var objRecordSet = Server.CreateObject("ADODB.Recordset");

/*
 * Gives me the columns from the database.
 * Cheese is a named region in the spreadsheet.  To get a whole sheet
 * we would have to use $Sheet# instead of Cheese.
 */
SQL = "SELECT * FROM Cheese";
objRecordSet.Open(SQL, cn);

/*
 * Just output name=value pairs within the recordset.  one per line.
 */
while(!objRecordSet.EOF){
    objFields = objRecordSet.Fields;

    for(i=0; i < objFields.Count; i++){
        Response.write(objFields.Item(i).Name+ " = "
+objFields.Item(i).Value+"<br>");
    }
    Response.write("<br>");
    objRecordSet.MoveNext();
}

/*
 * Don't forget to close the objects
 */
if(objRecordSet.State != adStateClosed){
    objRecordSet.close();
}
%>
</body>
============ end code ================


Andrew Carroll
Carroll-Tech
720-273-6814
andrew@carroll-tech.net





^ permalink raw reply	[flat|nested] 25+ messages in thread

* excel files
       [not found] <20041006203015.B3B864C40D1@lovelace.ada-france.org>
@ 2004-10-06 21:58 ` Andrew
  0 siblings, 0 replies; 25+ messages in thread
From: Andrew @ 2004-10-06 21:58 UTC (permalink / raw)
  To: comp.lang.ada

Ooops,

I have a correction to the code I posted.

============ code below ===============
<!-- METADATA TYPE="typelib" FILE="C:\Program Files\Common
Files\system\ado\msado15.dll" -->
<html>
<head>
</head>
<body>

<% @Language = "JavaScript" %>
<%

/*
 * The provider is the path to the excel file.  The path provided here
is a relative path.
 * It is later combined with a call to Server.MapPath to generate the
absolute path.
 */
var provider = "\data\\NameOfExcelFile.xls";

/*
 * Our connection information.
 */
var cn = "Driver={Microsoft Excel Driver (*.xls)}; DBQ=" +
Server.MapPath(provider);

/*
 * Our recordset object to manipulate contents of the provider.
 * We are using ADODB, the connection is an ODBC connection.
 */
var objRecordSet = Server.CreateObject("ADODB.Recordset");

/*
 * Gives me the columns from the database.
 * Cheese is a named region in the spreadsheet.  To get a whole sheet
 * we would have to use $Sheet# instead of Cheese.
 */
SQL = "SELECT * FROM Cheese";
objRecordSet.Open(SQL, cn);

/*
 * Just output name=value pairs within the recordset.  one per line.
 */
objFields = objRecordSet.Fields;
while(!objRecordSet.EOF){

    for(i=0; i < objFields.Count; i++){
        Response.write(objFields.Item(i).Name+ " = "
+objFields.Item(i).Value+"<br>");
    }
    Response.write("<br>");
    objRecordSet.MoveNext();
}

/*
 * Don't forget to close the objects
 */
if(objRecordSet.State != adStateClosed){
    objRecordSet.close();
}
%>
</body>
============ end code ================





^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2004-10-06 21:58 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20041005193515.6C38A4C409F@lovelace.ada-france.org>
2004-10-06  9:52 ` excel files Andrew
2004-10-06 10:24   ` stephane richard
2004-10-06 11:58     ` Chris Humphries
2004-10-06 16:27       ` Warren W. Gay VE3WWG
2004-10-06 17:17         ` Chris Humphries
     [not found] <20041006203015.B3B864C40D1@lovelace.ada-france.org>
2004-10-06 21:58 ` Andrew
     [not found] <20041006132018.833134C40CC@lovelace.ada-france.org>
2004-10-06 19:56 ` Andrew
     [not found] <20041005034017.9E75B4C4137@lovelace.ada-france.org>
2004-10-05  6:49 ` Andrew
2004-10-05 21:37   ` David Botton
2004-10-04 19:16 Alexandre Devaure
2004-10-04 19:42 ` stephane richard
2004-10-04 20:02   ` Chris Humphries
2004-10-05  0:29   ` Jeffrey Carter
2004-10-05  1:20   ` Stephen Leake
2004-10-04 20:42 ` Martin Dowie
2004-10-04 22:20   ` Jeff C r e e.m
2004-10-05  7:45   ` Georg Bauhaus
2004-10-05 12:32     ` Chris Humphries
2004-10-05 14:16     ` David Botton
2004-10-04 21:40 ` tmoran
2004-10-05  6:30   ` Pascal Obry
2004-10-05 17:31     ` tmoran
2004-10-05 19:00       ` Alexandre Devaure
2004-10-05 19:02       ` Pascal Obry
2004-10-05  0:55 ` David Botton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox