[vox-tech] Preserving carriage returns in OpenOffice.ort Calc cells when referring to them

Jeff Newmiller jdnewmil at dcn.davis.ca.us
Thu Sep 27 13:45:20 PDT 2007


Bill Kendrick wrote:
> On Wed, Sep 26, 2007 at 06:32:04PM -0700, Henry House wrote:
>> AFAIK the standard model of spreadsheets does not allow linebreaks
>> within cells, so undefined and inconsistent behavior such as you are
>> encountering is to be expected.
> 
> Tell that to MS Excel and OOo Calc. Both allow entry of linebreaks. OOo even
> has a help page explaining how to do multiline text.
 >
>> What is the underlying motivation here?
> 
> Storing text in a resource file w/in a mobile app JAR file.
> Our build system uses CSV files to determine which assets to use depending
> on the attributes of the tsarget handset (feature capabilities, screen size,
> language, etc.)

Excel and OO's support of multi-line text in cells is not related to
the possibility of support for multi-line text in CSV, or their mapping
of their internal representations to CSV.

>> Perhaps there is a better solution that gets around the limitations of
>> spreadsheets.
> 
> Too late for that. :^/

Encode the string (e.g. "first\nsecond", or use a format (e.g. XML) that
supports multi-line text strings. Although some spreadsheets do support
multi-line text strings in cells, such support is not standardized, and CSV
format cannot include newlines within a field.  If you attempt to do so, the
range of applications that support your kludge will be by limited to those
that understand your chosen method of encoding such embedded newlines.
In other words, manually encoding the string may be your only compatible
option.

BTW: Excel's method of quoting strings in "CSV" is a law unto itself... it
distinguishes newlines inside strings using LF instead of the usual
DOS CRLF end-of-line marker... making Excel's version of CSV effectively
a binary format, which greatly reduces any value it had as a portable
data format.

-- 
---------------------------------------------------------------------------
Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<jdnewmil at dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
                                       Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
---------------------------------------------------------------------------


More information about the vox-tech mailing list