XML for spreadsheets

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

User avatar
sudip
Posts: 1454
Joined: Sat Mar 07, 2009 11:52 am
Location: Kolkata, WB, India

XML for spreadsheets

Post by sudip »

Hello All,

I want to export my data in XML format, so that it can be opened with any modern spreadsheet. Is there any easy way to do this? Or I shall write all the XML codes ...

Is there any utility which can export DBF to XML? Or Grid to XML :)

Thanks in advance :)

(After 15 minutes: IMHO, it is not very complex to write code for DBF2XML, I shall do it :) )
With best regards,
Sudip
User avatar
Rathinagiri
Posts: 5471
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: XML for spreadsheets

Post by Rathinagiri »

IMHO, it is not very complex to write code for DBF2XML, I shall do it
Thanks a lot Sudip.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
gfilatov
Posts: 1068
Joined: Fri Aug 01, 2008 5:42 am
Location: Ukraine
Contact:

Re: XML for spreadsheets

Post by gfilatov »

Hello Sudip,

Please take a look for the following URL:
http://tech.groups.yahoo.com/group/harb ... bf2xml.zip

Description:
Freeware DBF to XML Wizard v.1.01 by Harbour & HMG build 103

Hope that helps. :idea:
Kind Regards,
Grigory Filatov

"Everything should be made as simple as possible, but no simpler." Albert Einstein
User avatar
sudip
Posts: 1454
Joined: Sat Mar 07, 2009 11:52 am
Location: Kolkata, WB, India

Re: XML for spreadsheets

Post by sudip »

Hello All,

I was busy in my work (and you can feel how a programmer feels when an easy code doesn't work ;) )

I can export the header of dbf successfully but found problem with exporting data :(

Here is the sourcecode.
Dbf2Xml.zip
(10.2 KiB) Downloaded 400 times
I used .xml file format from http://en.wikipedia.org/wiki/Microsoft_ ... ML_formats (I got the url from Rathi, a few days ago)

Grigory, Thank you. I downloaded your app, but it can't detect my old VFP .dbf file (showing message - file is corrupted). It works for my harbour/xharbour generated .dbf files. Output is fine and generic. Can we get the output in the way that a spreadsheet program can understand and display data?

As, I started my small app before seeing your post, I gave the same name of your app (dbf2xml). Sorry, I shall change it later.

My request to all to please check my source the code and send your suggestion. May be the bug is for my careless mistakes.

Thanks in advance :)
With best regards,
Sudip
User avatar
Rathinagiri
Posts: 5471
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: XML for spreadsheets

Post by Rathinagiri »

Thanks Sudip. I will check. :)
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
sudip
Posts: 1454
Joined: Sat Mar 07, 2009 11:52 am
Location: Kolkata, WB, India

Re: XML for spreadsheets

Post by sudip »

Hello All,

I just solved the problem. The bug was due to data conversion - date type, "&" character in text field etc.

Please check.
Dbf2Xml.zip
(11.63 KiB) Downloaded 363 times
Warning: Conversion of large dbf files may give problem with Open Calc. I found from Task Manager that Open Office is consuming most of my RAM and about 98% of CPU usage for large dbf files. I guess, .xml files are not supposed to be used in this way, or there may be a bug in my code :roll:
With best regards,
Sudip
User avatar
Rathinagiri
Posts: 5471
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: XML for spreadsheets

Post by Rathinagiri »

Hi Sudip,

I think this can also help:
Main.zip
(1.93 KiB) Downloaded 381 times
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
sudip
Posts: 1454
Joined: Sat Mar 07, 2009 11:52 am
Location: Kolkata, WB, India

Re: XML for spreadsheets

Post by sudip »

Hello Rathi,

Thanks a lot. :)
I changed following line and it works (for small dbf files)

Code: Select all

            case astruct[i,2] == "C" .or. astruct[i,2] == "M"                 
                fwrite(nhandle,'<Cell><Data ss:Index="'+ltrim(str(i))+'" ss:Type="String">'+strtran(alltrim(&fname), "&", "&")+'</Data></Cell> '+chr(10))
             case astruct[i,2] == "L"
But, same problem with medium to large .dbf files.
With best regards,
Sudip
User avatar
Roberto Lopez
HMG Founder
Posts: 4004
Joined: Wed Jul 30, 2008 6:43 pm

Re: XML for spreadsheets

Post by Roberto Lopez »

gfilatov wrote:Hello Sudip,

Please take a look for the following URL:
http://tech.groups.yahoo.com/group/harb ... bf2xml.zip

Description:
Freeware DBF to XML Wizard v.1.01 by Harbour & HMG build 103

Hope that helps. :idea:
Thanks Grigory.

A very useful utility indeed.
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
User avatar
sudip
Posts: 1454
Joined: Sat Mar 07, 2009 11:52 am
Location: Kolkata, WB, India

Re: XML for spreadsheets

Post by sudip »

Hello All,

Should I use libxhb.a for working with xml?

Thanks in advance :)
With best regards,
Sudip
Post Reply