comp.lang.ada
 help / color / mirror / Atom feed
* Ada Spreadsheet output
@ 2013-11-17  4:45 Serge Mosin
  2013-11-17  5:44 ` Jeffrey Carter
  2013-11-19 11:09 ` Maxim Reznik
  0 siblings, 2 replies; 8+ messages in thread
From: Serge Mosin @ 2013-11-17  4:45 UTC (permalink / raw)


Hello, guys.
I wish to know, if there are some Ada libraries for spreadsheet output, preferably OpenOffice. I mean the ability to create a spreadsheet file and write there/read it from the Ada program. The method should be fast enough, because big amount of data is supposed to be transferred, so launching OpenOffice and controlling output through it is not the solution.

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

* Re: Ada Spreadsheet output
  2013-11-17  4:45 Ada Spreadsheet output Serge Mosin
@ 2013-11-17  5:44 ` Jeffrey Carter
  2013-11-17  6:43   ` Serge Mosin
  2013-11-19 11:09 ` Maxim Reznik
  1 sibling, 1 reply; 8+ messages in thread
From: Jeffrey Carter @ 2013-11-17  5:44 UTC (permalink / raw)


On 11/16/2013 09:45 PM, Serge Mosin wrote:
> Hello, guys.
> I wish to know, if there are some Ada libraries for spreadsheet output, preferably OpenOffice. I mean the ability to create a spreadsheet file and write there/read it from the Ada program. The method should be fast enough, because big amount of data is supposed to be transferred, so launching OpenOffice and controlling output through it is not the solution.

There's Excel Writer for output:

http://excel-writer.sourceforge.net/

I'm not aware of anything for OpenOffice, nor for reading Excel files. This 
thread from 2004

http://coding.derkeiler.com/Archive/Ada/comp.lang.ada/2004-10/0299.html

suggests using ODBC to read Excel files.

-- 
Jeff Carter
"Death awaits you all, with nasty, big, pointy teeth!"
Monty Python & the Holy Grail
20

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

* Re: Ada Spreadsheet output
  2013-11-17  5:44 ` Jeffrey Carter
@ 2013-11-17  6:43   ` Serge Mosin
  2013-11-17 11:17     ` Sebastian Doht
  2013-11-18 14:55     ` Stephen Leake
  0 siblings, 2 replies; 8+ messages in thread
From: Serge Mosin @ 2013-11-17  6:43 UTC (permalink / raw)


On Sunday, November 17, 2013 12:44:14 PM UTC+7, Jeffrey Carter wrote:
> On 11/16/2013 09:45 PM, Serge Mosin wrote:
> 
> > Hello, guys.
> 
> > I wish to know, if there are some Ada libraries for spreadsheet output, preferably OpenOffice. I mean the ability to create a spreadsheet file and write there/read it from the Ada program. The method should be fast enough, because big amount of data is supposed to be transferred, so launching OpenOffice and controlling output through it is not the solution.
> 
> 
> 
> There's Excel Writer for output:
> 
> 
> 
> http://excel-writer.sourceforge.net/
> 
> 
> 
> I'm not aware of anything for OpenOffice, nor for reading Excel files. This 
> 
> thread from 2004
> 
> 
> 
> http://coding.derkeiler.com/Archive/Ada/comp.lang.ada/2004-10/0299.html
> 
> 
> 
> suggests using ODBC to read Excel files.
> 
> 
> 
> -- 
> 
> Jeff Carter
> 
> "Death awaits you all, with nasty, big, pointy teeth!"
> 
> Monty Python & the Holy Grail
> 
> 20

Thanks for the reply, Jeffrey. MS Excel is not preferred and ODBC usage is probably possible only with simple structured spreadsheet tables (key-value ones), but I have a very complex type of structure, so it seems that I need to find a solution by myself.
Thanks anyways!

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

* Re: Ada Spreadsheet output
  2013-11-17  6:43   ` Serge Mosin
@ 2013-11-17 11:17     ` Sebastian Doht
  2013-11-18 14:55     ` Stephen Leake
  1 sibling, 0 replies; 8+ messages in thread
From: Sebastian Doht @ 2013-11-17 11:17 UTC (permalink / raw)


Am 17.11.2013 07:43, schrieb Serge Mosin:
> On Sunday, November 17, 2013 12:44:14 PM UTC+7, Jeffrey Carter wrote:
>> On 11/16/2013 09:45 PM, Serge Mosin wrote:
>>
>>> Hello, guys.
>>
>>> I wish to know, if there are some Ada libraries for spreadsheet output, preferably OpenOffice. I mean the ability to create a spreadsheet file and write there/read it from the Ada program. The method should be fast enough, because big amount of data is supposed to be transferred, so launching OpenOffice and controlling output through it is not the solution.
>>
>>
>>
>> There's Excel Writer for output:
>>
>>
>>
>> http://excel-writer.sourceforge.net/
>>
>>
>>
>> I'm not aware of anything for OpenOffice, nor for reading Excel files. This
>>
>> thread from 2004
>>
>>
>>
>> http://coding.derkeiler.com/Archive/Ada/comp.lang.ada/2004-10/0299.html
>>
>>
>>
>> suggests using ODBC to read Excel files.
>>
>>
>>
>> --
>>
>> Jeff Carter
>>
>> "Death awaits you all, with nasty, big, pointy teeth!"
>>
>> Monty Python & the Holy Grail
>>
>> 20
>
> Thanks for the reply, Jeffrey. MS Excel is not preferred and ODBC usage is probably possible only with simple structured spreadsheet tables (key-value ones), but I have a very complex type of structure, so it seems that I need to find a solution by myself.
> Thanks anyways!
>


OpenOffice has an API which might be used for that. Unfortunately it is 
focused on Java and C++, there is no plain C interface which could be 
imported to Ada. If you use Windows the OLE interface might be an 
option. This is how I am creating OpenOffice documents from a Delphi 
application. Should be possible from Ada too but limits portability.

Greetz,

Sebastian

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

* Re: Ada Spreadsheet output
  2013-11-17  6:43   ` Serge Mosin
  2013-11-17 11:17     ` Sebastian Doht
@ 2013-11-18 14:55     ` Stephen Leake
  2013-11-19 11:14       ` Serge Mosin
  1 sibling, 1 reply; 8+ messages in thread
From: Stephen Leake @ 2013-11-18 14:55 UTC (permalink / raw)


Serge Mosin <svmosin@gmail.com> writes:

> Thanks for the reply, Jeffrey. MS Excel is not preferred and ODBC
> usage is probably possible only with simple structured spreadsheet
> tables (key-value ones), but I have a very complex type of structure,
> so it seems that I need to find a solution by myself.

Do you need to output equations, or just data?

Data can be handled by comma separated values, which are trivial to
write.

When entering data, if you start with "=", it becomes an equation; does
that work for csv import as well? I haven't tried it.

-- 
-- Stephe

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

* Re: Ada Spreadsheet output
  2013-11-17  4:45 Ada Spreadsheet output Serge Mosin
  2013-11-17  5:44 ` Jeffrey Carter
@ 2013-11-19 11:09 ` Maxim Reznik
  1 sibling, 0 replies; 8+ messages in thread
From: Maxim Reznik @ 2013-11-19 11:09 UTC (permalink / raw)


I saw some support of Open Document Format (aka OpenOffice files) in Matreshka project.

http://forge.ada-ru.org/matreshka/wiki/ODF

I don't know actual status however. You can try download or contact author if you are interested.

-- 
Maxim Reznik


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

* Re: Ada Spreadsheet output
  2013-11-18 14:55     ` Stephen Leake
@ 2013-11-19 11:14       ` Serge Mosin
  2013-11-20  9:03         ` Stephen Leake
  0 siblings, 1 reply; 8+ messages in thread
From: Serge Mosin @ 2013-11-19 11:14 UTC (permalink / raw)


On Monday, November 18, 2013 9:55:49 PM UTC+7, Stephen Leake wrote:
> Serge Mosin <svm...@gmail.com> writes:
> 
> 
> 
> > Thanks for the reply, Jeffrey. MS Excel is not preferred and ODBC
> 
> > usage is probably possible only with simple structured spreadsheet
> 
> > tables (key-value ones), but I have a very complex type of structure,
> 
> > so it seems that I need to find a solution by myself.
> 
> 
> 
> Do you need to output equations, or just data?
> 
> 
> 
> Data can be handled by comma separated values, which are trivial to
> 
> write.
> 
> 
> 
> When entering data, if you start with "=", it becomes an equation; does
> 
> that work for csv import as well? I haven't tried it.
> 
> 
> 
> -- 
> 
> -- Stephe

I need to output simple data, but it has a complex cell structure. I beleive, CSV files are similar to using ODBC interface, where I only can have simple key-valued files, which is not enough in my situation.


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

* Re: Ada Spreadsheet output
  2013-11-19 11:14       ` Serge Mosin
@ 2013-11-20  9:03         ` Stephen Leake
  0 siblings, 0 replies; 8+ messages in thread
From: Stephen Leake @ 2013-11-20  9:03 UTC (permalink / raw)


Serge Mosin <svmosin@gmail.com> writes:

> I need to output simple data, but it has a complex cell structure. 

This sounds like a contradiction to me; can you give an example?

> I beleive, CSV files are similar to using ODBC interface, where I only
> can have simple key-valued files, which is not enough in my situation.

No, CSV files are even simpler; there is no notion of "keys" inherent in
the format.

A CSV file has characters in cells. Each row of cells is separated by a
newline, and within each row, each cell is separated by a comma (or any
other delimiting character).
http://en.wikipedia.org/wiki/Comma-separated_values

The interpretation of the characters in each cell is up to the
spreadsheet program, so the structure can be as complex as needed. In
particular, if you want commas in a cell, the spreadsheet has to define
a quoting syntax. Usually it's easier to use a different delimiter, such
as tab, that is not needed in the cell data.

For example, I just wrote a CSV file in Emacs, by typing the characters:

1,0
2,=A1-B1
3,=A2-B2

Then I opened that file in OpenOffice Calc; the cells starting with "="
were interpreted as formulas, and the spreadsheet display is:

1   0
2   1
3   1

When I examine cell B2, it has the formula =A1-B1. I can then save it in
any format OpenOffice supports. However, if I save it as a CSV, the file
has numbers, not the formulas. That makes sense, because you might be
exporting the results to a plotting program. But it would also make
sense to have an option to export the formulas.

So as far as I can see, any formula in an OpenOffice spreadsheet can be
imported into OpenOffice via a CSV file. 

What else do you need?


The standard OpenOffice file format of ODS supports metadata; cell
formatting styles, color, everything else you can set via the toolbars.
That data is not representable in the CSV. So if you need to import that
data, you'd have to write the ODS format directly. That's a zip of xml
files, and there are Ada libraries that do both, so there is code you
could build on.

The representation of the single cell B3 in the ODS content.xml file
looks like this:

<table:table-cell table:formula="of:=[.A2]-[.B2]"
office:value-type="float" office:value="1">

That should be easy to generate with the GNAT XML/Ada library.

-- 
-- Stephe

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

end of thread, other threads:[~2013-11-20  9:03 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-17  4:45 Ada Spreadsheet output Serge Mosin
2013-11-17  5:44 ` Jeffrey Carter
2013-11-17  6:43   ` Serge Mosin
2013-11-17 11:17     ` Sebastian Doht
2013-11-18 14:55     ` Stephen Leake
2013-11-19 11:14       ` Serge Mosin
2013-11-20  9:03         ` Stephen Leake
2013-11-19 11:09 ` Maxim Reznik

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