-----Original Message----- From: Donahue, Michael [mailto:[EMAIL PROTECTED] Sent: 08 January 2007 16:30 To: Bassi Gurpiar Subject: RE: Problem Storing numeric field with leading zeros
I saw this exact same thing. Maybe if you asked this question to the list we might find our a fix for this. I'm fairly sure that you need to prefix it with "'" to make it happy when you put a number in a string field, but I don't know how to tell it to suppress the "'" on the excel screen. -----Original Message----- From: Bassi Gurpiar [mailto:[EMAIL PROTECTED] Sent: Monday, January 08, 2007 9:54 AM To: Donahue, Michael Subject: RE: Problem Storing numeric field with leading zeros I tried that through the java code by doing: cell.setCellValue("'" + "00000004578"); the result was '00000004578 I don't want to see the single quote in the cell. However, if you use excel without Java, you can enter '00000004578 in one of the cells and it will hide the quote for you. Still puzzled! -----Original Message----- From: Donahue, Michael [mailto:[EMAIL PROTECTED] Sent: 08 January 2007 15:01 To: Bassi Gurpiar Subject: RE: Problem Storing numeric field with leading zeros Don't you have to prefix the number string with a single quote "'" if you want a number to be stored as a string? -----Original Message----- From: Bassi Gurpiar [mailto:[EMAIL PROTECTED] Sent: Monday, January 08, 2007 6:20 AM To: [email protected] Subject: Problem Storing numeric field with leading zeros I am having trouble storing a text value field with leading zeros when using HSSF to write cells in an Excel 2002 sheet. For example, I am trying to store 00000004578 in the cell using: cell = row.createCell((short)0); cell.setCellType(HSSFCell.CELL_TYPE_STRING); cell.setCellValue("00000004578"); The value gets stored correctly when I open up the excel sheet. But the problem is, it has a error message next to it saying "Number stored As Text". If I try editing this cell, i.e. just by clicking on and off the edit panel on the tool bar, the leading zeros are lost. Please can someone tell me how to get around this. Gurps ************************************************************************ DISCLAIMER The information contained in this e-mail is confidential and is intended for the recipient only. If you have received it in error, please notify us immediately by reply e-mail and then delete it from your system. Please do not copy it or use it for any other purposes, or disclose the content of the e-mail to any other person or store or copy the information in any medium. The views contained in this e-mail are those of the author and not necessarily those of Admenta UK Group. Admenta UK plc is a company incorporated in England and Wales under company number 3011757 and whose registered office is at Sapphire Court, Walsgrave Triangle, Coventry CV2 2TX ************************************************************************ --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/ ************************************************************************ **** This email may contain confidential material. If you were not an intended recipient, Please notify the sender and delete all copies. We may monitor email to and from our network. ************************************************************************ **** ************************************************************************ **** This email may contain confidential material. If you were not an intended recipient, Please notify the sender and delete all copies. We may monitor email to and from our network. ************************************************************************ **** --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
