Saving and loading Grid data to/from a file

TeeGrid VCL / FMX for Embarcadero RAD Studio, Delphi, C++ Builder and Lazarus Free Pascal.
Post Reply
emwamin
Newbie
Newbie
Posts: 2
Joined: Tue Jan 09, 2018 12:00 am

Saving and loading Grid data to/from a file

Post by emwamin » Wed Jan 10, 2018 12:22 am

Hi
How I can I save/load data to/from a TAB separated text file or a CSV file?

Is there an easy way to transpose the grid so that rows become columns and columns become rows?
BR
emwamin

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Saving and loading Grid data to/from a file

Post by Yeray » Wed Jan 10, 2018 9:03 am

Hello,

To Save you can:
- Call TeeGrid1.Grid.Copy method to copy the data into the Clipboard. Paste it into a new text file. Save it as a .csv. Note this method gives comma-separated output.
- Use TCSVData.From from Tee.Grid.CSV unit to generate a string from the data in the grid. Note the TCSVData.From method allows you to modify the separator being used. Then, you can save that string into a .csv file.

To Load you can:
- Manually read the .csv file and create the Data from it.

Alternatively, you can Import and Export using TeeBI.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply