Hi All:

I am a newbie user of POI. I am creating a spreadsheet programatically that
will be made available to the user. User will make edits to some of the
cells in the spreadsheet, after which they will upload the spreadsheet back
to the server for further processing.

I have the following requirement:

All cells should be formatted as text. This is so that excel does not mess
up the cell contents, which in some cases can be very long numbers (18+
digits). While I am able to setup the cells and write the data as Rich Text
using the below snippet (roughly):

        XSSFCell cell = row.createCell(columnIndex);
        RichTextString str =  
createHelper.createRichTextString("SOME_BIG_NUMBER");
        cell.setCellType(Cell.CELL_TYPE_STRING);
        cell.setCellValue(str);
So the spreadsheet is created ok, and the number displays as string. But the
minute I move the cursor into the cell (focus on the cell and press F2, or
double click on the cell), and move out, even w/o making edits, the cell
format changes, and a big number starts to get truncated. How do i fix this?
I essentially want to set the cell format to text such that it does not
change when user trys to edit the field, and potentially even lock the
format to text of possible.

Thanks in advance for reading and your help. Please let me know if my
question is not clear.
Regards
Sanjeev
-- 
View this message in context: 
http://apache-poi.1045710.n5.nabble.com/How-to-set-Cell-Format-to-Text-tp3275568p3275568.html
Sent from the POI - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to