Recent

Author Topic: StringGrid to XML Output  (Read 3074 times)

Gizmo

  • Hero Member
  • *****
  • Posts: 831
StringGrid to XML Output
« on: January 17, 2014, 01:57:11 pm »
I have a series of StringGrids. At the end of execution, my program saves their content to a series of csv files, like so :

MyStringGrid.SaveToCSVFile(Output.csv);

Is there an equally straight forward way using a built-in method in Freepascal Lazarus to achieve an XML compliant output, e.g:

MyStringGrid.SaveToXMLFile(Output.xml);

http://wiki.freepascal.org/XML_Tutorial seems to suggest it is not at all as straight forward as that but I wanted to ask in case there was a solution?

jesusr

  • Sr. Member
  • ****
  • Posts: 499
Re: StringGrid to XML Output
« Reply #1 on: January 17, 2014, 09:56:16 pm »
What is wrong with Grid.SaveToFile? it produces a XML compliant output.

mirce.vladimirov

  • Sr. Member
  • ****
  • Posts: 269
Re: StringGrid to XML Output
« Reply #2 on: January 29, 2014, 10:13:12 am »
I didn't know about this feature, so i tried it immediately , but the generated file had no data.
This is what i did in my program :
Code: [Select]
DBGrid1.SaveToFile('myfile.txt');
And there's the complete output:
Code: [Select]
<?xml version="1.0" encoding="utf-8"?>
<CONFIG>
  <grid version="3">
    <saveoptions create="False" position="False"/>
  </grid>
</CONFIG>
I used a DBGrid, and the dbgrid was populated with lots of records and columns.
« Last Edit: January 29, 2014, 10:42:00 am by mirce.vladimirov »

 

TinyPortal © 2005-2018