poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Beardsley <markbrd...@tiscali.co.uk>
Subject Re: How to set Cell Format to Text?
Date Mon, 22 Nov 2010 16:55:38 GMT

You need to circumbent Excel's error checking protocol. There may well be a
better way to do this but if it were me, I would open Excel and create a new
blank workbook. Next, click on the large circular button that appears at the
top left hand of the screen just as if you were trying to save the file, and
select the 'Excel options' Button. On the screen that pops open, look for
the word 'Formulas' in the column on the left hand side and select that.
Now, look down and you should see a series of check boxes under the title
'Error checking rules'. One of these should gave a label that reads
something like the following - 'Numbers formatted as text or preceeded by an
apostrophe'. This is most likely selected currently so click on it to
deslect it - ensure that the check box is not selected - and then OK you way
out of this back to the blank workbook.

Next, save the workbook as a template - it can be an xlsx file you do not
need to save it as an xslt. Finally, open this workbook using POI and
populate it with data. Hopefully, Excel will not try to convert the textual
representations of numbers when the user interacts with the data on the
sheet in future.

There must be some way to accomplish this task using the API and I am
confident someone else will know. For now thought, this may be a useful
dodge because I do seem to remember that simply preceeding the number with a
apostrophe did not work for some reason. Of course, this is another option
you could try - writing "/'123" onto a cell rather than "123".


Mark B
View this message in context: http://apache-poi.1045710.n5.nabble.com/How-to-set-Cell-Format-to-Text-tp3275568p3275613.html
Sent from the POI - User mailing list archive at Nabble.com.

To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org

View raw message