[fpc-pascal] Spreadsheet library/unit?

Frank Peelo f26p at eircom.net
Mon Oct 6 17:54:25 CEST 2008


Tomas Hajny wrote:
> On Mon, October 6, 2008 05:33, Antal wrote:
> 
>>> It is a plain text file, each row is separated with CRLF (#13#10), each
>>>
>>>>cell separated with tab (#9)
>>>>
>>>
>>>errm, surely that should be a comma, not a tab!
>>
>>
>>The Tab as separator is just a good way to avoid using the double quote :P
>>It just comes from the good old Lotus123.
>>Anyway, just try to copy/paste to a notepad from an Excel and you will see
>>how it works.
>>And then, saved as .CSV reopen it with Office and it might work. Or it
>>might
>>not :P
>>I am currently using this, since it is easier to manage as the double
>>quotes.
> 
> 
> An additional issue with delimiters in this case is the fact, that "C" in
> "CSV" may not always be a comma (or that spreadsheet applications may
> expect different characters depending on locale - e.g. semicolons, etc.).

CSV is occasionally referred to as something other than "Comma Separated 
Values". I'm not sure why. If you're using CSV, stick to what most 
applications understand by csv and benefit from some level of 
compatibility. Why make hassle for yourself? Excel (for example) can 
save tab delimited .txt files easily, but when you open them again you 
have to tell it what's used as a delimiter. If you save some data 
tab-delimited, but call it csv, then it's just /wrong/ when you open it 
again. Save it comma-delimited, and you can have any sort of text value 
in a cell, and it just opens.

Lack of a formal specification is a problem, but you could do worse than
http://tools.ietf.org/html/rfc4180
or even
http://en.wikipedia.org/wiki/Comma-separated_values

Oh, and since it's a text file, you'll want to be careful about whether 
to use CR, LF or CRLF as a line delimiter, they're all valid somewhere :)

Which is all getting very off-topic so I'll shut up now.

Frank






More information about the fpc-pascal mailing list