Spreadsheet editors often interpret data input by the users in ways they are not supposed to. This can be prevented by setting the cell's data format to "text", or, as it is usually called, "@". For my use case, I'd really like to set this data format in the sheets written by SODS.
On the XML side, this is easy to do. Just define the following number:text-style element, and then reference it from cell styles:
Implementation-wise, I'd suggest always writing the new textstyle style into the spreadsheet like you are already doing with <number:date-style style:name="datestyle"> at the moment. Then add an API like Style::setRawText(boolean) or, if you want a more forward compatible API, Style::setDataStyle(String) which only accepts "@" at this point. If this option is set by the user, the style:data-style-name="textstyle" attribute is added to the style's XML element.
Spreadsheet editors often interpret data input by the users in ways they are not supposed to. This can be prevented by setting the cell's data format to "text", or, as it is usually called, "@". For my use case, I'd really like to set this data format in the sheets written by SODS.
On the XML side, this is easy to do. Just define the following
number:text-style
element, and then reference it from cell styles:Implementation-wise, I'd suggest always writing the new
textstyle
style into the spreadsheet like you are already doing with<number:date-style style:name="datestyle">
at the moment. Then add an API likeStyle::setRawText(boolean)
or, if you want a more forward compatible API,Style::setDataStyle(String)
which only accepts"@"
at this point. If this option is set by the user, thestyle:data-style-name="textstyle"
attribute is added to the style's XML element.I'd be very happy to hear your thoughts on this.