poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gabriel Molina <skip...@gmail.com>
Subject Re: How to set Cell Format to Text?
Date Mon, 22 Nov 2010 16:50:18 GMT
Hi!

This seems to be a problem of configuration of MSExcel, you cannot
lock anything if you are giving the file for manipulation to your
users. I'd suggest another interface to manipulate data and then
export to MSExcel.
Check this page to configure your MSExcel to prevent automatic formatting.

http://support.microsoft.com/kb/214233/en-us

Regards.

On Mon, Nov 22, 2010 at 10:23 AM, sanjeev.x.verma
<sanjeev.x.verma@gmail.com> wrote:
>
> 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: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org
>
>



-- 
ちりも積もれば山となる

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


Mime
View raw message