Force all quotes on CSV export, which Filter Option?

asked 2017-03-09 16:09:58 +0200

Andy gravatar image

updated 2017-03-09 16:17:18 +0200

I want to programmatically (Libre Office Basic) export a sheet to csv, while having all cells wrapped in quotes, also numbers.

According to Open Office's Documentation on Filter Options the 8th parameter will achieve that:

If false, the numbers are stored as text, with text delimiters.

Right now I tried the following:

Dim FilterOptions(1 to 9) as String
FilterOptions(1) = Asc(",") ' Field Separator
FilterOptions(2) = Asc("""") ' Text Delimiter
FilterOptions(3) = "0" ' Character Set
FilterOptions(4) = "1" ' Number of First Line
FilterOptions(5) = "1" ' Cell Format
FilterOptions(6) = "" ' Language
FilterOptions(7) = "true" ' Quote all texts
FilterOptions(8) = "false" ' Store numbers as such (or text)
FilterOptions(9) = "true" ' Save cell contents as shown

document.StoreToURL(FileURL, Join(FilterOptions(), ","))

This doesn't seem to work. Somehow the 8th option controls whether the numbers are stored as number or as shown.

I also have the feeling that these Filter Options should actually influence each other: _Save cell contents as shown_ should contradict _Store numbers as such_.

Is there any documentation on the actual behaviour of these filters? I tried to find the corresponding code on Github, but so far I wasn't lucky.

edit retag flag offensive close merge delete

Comments

After some more testing it seems that with 8=false the numbers will be written to CSV as they are formatted in Libre Office, but without text delimiters – maybe it's a bug?

Andy gravatar imageAndy ( 2017-03-09 16:27:59 +0200 )edit