Recent

Author Topic: Lazarus and Excel/OpenOffice data sheets.  (Read 14133 times)

The_Marlboro_Man

  • New Member
  • *
  • Posts: 33
Lazarus and Excel/OpenOffice data sheets.
« on: January 09, 2008, 12:56:46 pm »
Hi!.

This is a simple question I've got here but as much as I think and look at it I can't find a solution... When working with Delphi in class we learned how to connect Delphi to a Mysql database running either in the local computer or in a remote computer (all in Windows, using ODBC's and such).

Now I am here, running my Ubuntu computer and trying to make a Lazarus DBGrid display the contents of an OpenOffice data sheet... And I am completely clueless!!.

I would like to make a very simple application to maintain a few things and I would like to be able to manipulate the data sheet from Lazarus like adding new rows, editing existing cells and all that jazz but, again, I am clueless on even starting to work on it.

Is it possible to display the contents of the data sheet?. Is it possible to read and manipulate them?. If possible in Lazarus?. How?.

Thanks a lot in advance :).

PS: Sorry if this is not the correct forum for this kind of question.
PPS: I am aware that I will surely have to install some packages (I did find them under the usr/lib/lazarus/packages directory instead of usr/share/lazarus/packages) but, again, I don't know which.

bee

  • Sr. Member
  • ****
  • Posts: 393
RE: Lazarus and Excel/OpenOffice data sheets.
« Reply #1 on: January 09, 2008, 04:45:32 pm »
AFAIK, there is no ready-to-use Lazarus component to read/write OO's spreadsheet, yet. You must first learn the .ods file format. Actually, it's quite easy because .ods is actually a zip compressed file containing a few xml files. So, you only need to know how to handle zip compressed and xml files using Lazarus. Fortunately, both libraries are already provided by FPC. ;) HTH.
-Bee-

A long time pascal lover.

The_Marlboro_Man

  • New Member
  • *
  • Posts: 33
RE: Lazarus and Excel/OpenOffice data sheets.
« Reply #2 on: January 09, 2008, 11:12:48 pm »
That's some information!. I guess I should start learning about xml files first or just create my own kind of "record"... I would prefer some database sheet so I don't have to re-code everything again in case I want to add something like another field to the data.

Thanks a lot :).

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: Lazarus and Excel/OpenOffice data sheets.
« Reply #3 on: January 11, 2008, 03:50:39 am »
Quote from: "The_Marlboro_Man"
trying to make a Lazarus DBGrid display the contents of an OpenOffice data sheet


Do you mean a spreadsheet? Why not use File | Save As and save the sheet to a .dbf file, then connect to that?

Thanks.

-Phil

The_Marlboro_Man

  • New Member
  • *
  • Posts: 33
RE: Re: Lazarus and Excel/OpenOffice data sheets.
« Reply #4 on: January 11, 2008, 10:43:09 am »
Phil, I read something about that but I still don't know how to connect to a dbf file... My main concern is to be able to connect to a file without having a service like Mysql or Oracle running in the machine, something like a "static" database contained on a file, so to say.... Does the dbf file fullfill my needs?. If yes, is it easy to connect Lazarus to it?. How?.

Thanks a lot :).

Almindor

  • Sr. Member
  • ****
  • Posts: 412
    • http://www.astarot.tk
RE: Re: Lazarus and Excel/OpenOffice data sheets.
« Reply #5 on: January 11, 2008, 12:13:21 pm »
You could use TDbf afaik, which is a non-server style database (no SQL either). As far as I know it works on dbf files, but I never used it myself [yet]. See http://tdbf.sourceforge.net/. Despite what the webpage might suggest at first sight, it's actually 100% lazarus compatible (mady by one of the Lazarus devs no less). You don't need to get it from the page tho, as the component is readily available in lazarus/components/tdbf :) (but the page has some nice info on it)

The_Marlboro_Man

  • New Member
  • *
  • Posts: 33
RE: Re: Lazarus and Excel/OpenOffice data sheets.
« Reply #6 on: January 11, 2008, 03:18:49 pm »
Read the tutorial and got convinced as far as using it as the base for my program... But now that I think about it, I am so used to work with SQL languages and such that I completely ignore if there's anything like it for this other way... How would I go on making queries to these files?.

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: RE: Re: Lazarus and Excel/OpenOffice data sheets.
« Reply #7 on: January 11, 2008, 03:59:37 pm »
Quote from: "The_Marlboro_Man"
Read the tutorial and got convinced as far as using it as the base for my program... But now that I think about it, I am so used to work with SQL languages and such that I completely ignore if there's anything like it for this other way... How would I go on making queries to these files?.


You could probably import .dbf data into one of the SQL databases that Lazarus does support and then use that if you're more comfortable with SQL.

Thanks.

-Phil

The_Marlboro_Man

  • New Member
  • *
  • Posts: 33
RE: Re: RE: Re: Lazarus and Excel/OpenOffice data sheets.
« Reply #8 on: January 11, 2008, 05:41:31 pm »
Thanks Phil. I will read further and try to think of the best way to implement this idea. Reading about xml files has also made me think about new possibilities so now it's all a matter of time :). Again, thanks a lot.

 

TinyPortal © 2005-2018