It’s text when it’s quoted, stupid!

Warning: WP_Syntax::substituteToken(): Argument #1 ($match) must be passed by reference, value given in /homepages/7/d105059906/htdocs/ on line 383

Ok. This is another one I just checked into ooo-build trunk. It’s actually a very minor enhancement, but some people may find this useful.

What I did is to modify Calc’s csv import filter to provide the users an option to always import quoted fields (or cells) as text. Here is a screenshot of the dialog with this new option:

Hopefully what it does is self-evident. If not, here is an example.

Let’s say you have a csv file of the following content:

"0-0" "1-0" "2-0" "3-0" "4-0" "5-0"
"0-1" "1-1" "2-1" "3-1" "4-1" "5-1"

When you import this file into Calc, here is what you get with the current version:

As you can see, most of the fields got converted to dates. You get the same results even if those individual cells are not quoted, because Calc’s current csv import filter doesn’t make any distinction between quoted and unquoted fields in terms of data types.

When you import this file using the new option, you get this instead:

Now, all quoted fields are imported as text, with no surprise conversion. Plain and simple. :-)

4 thoughts on “It’s text when it’s quoted, stupid!”

  1. This is really a very nice feature and i think it will solve many problems of our csv imports. Is there a chance that we can set this option as a default in the openoffice config. Because it will be difficult to train all of our staff to select this option on every import. Thanks in advance for your great featurs like the solver and this little gem.

  2. Hi Ralf,

    >Is there a chance that we can set this option as a default in the openoffice config.

    Sure that would make sense. I was just thinking about making it on by default. :-)

    I will work on that shortly.

  3. Dear Kohei,

    If I think I’ve found a bug with Calc’s Solver, how should I report this?

    Sean H.

Comments are closed.