poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Glen Stampoultzis <gst...@iinet.net.au>
Subject Re: Unlock cells become locked after writing
Date Fri, 07 Mar 2003 06:14:54 GMT

Protected is not supported (it's in the FAQ I think).



At 05:21 PM 6/03/2003, you wrote:
>Hi,
>I have a template pre-created....
>There are some cells in the sheet that are locked and the sheet is
>protected.
>
>
>After reading the template, I add the some data and write to a file.
>The generated Excel File now have some cells (Which I wrote data onto using
>POI are oso locked)!
>
>Here is the code which I will call to write data into the cell :-
>     private static void writeCell(int datatype, String data, HSSFCell cell)
>     {
>         try {
>             switch(datatype)
>             {
>                 case 2 : //Boolean
>                     cell.setCellType(HSSFCell.CELL_TYPE_BOOLEAN);
>                     cell.setCellValue(Boolean.valueOf(data).booleanValue());
>                     return;
>                 case 3 : //Number
>                     cell.setCellType(HSSFCell.CELL_TYPE_NUMERIC);
>                     cell.setCellValue(Double.parseDouble(data));
>                     return;
>                 case 4 : //Date
>                     cell.setCellType(HSSFCell.CELL_TYPE_NUMERIC);
>                     cell.setCellValue(new java.util.Date(data));
>                     return;
>                 case 1 : //String
>             }
>         }
>         catch (Exception e) { } //catch error above datatype...will set
>normal string
>         //others datatype created will be returned before this...
>         cell.setCellType(HSSFCell.CELL_TYPE_STRING);
>         cell.setCellValue(data);
>     }
>
>Wonder wat's wrong here....
>
>"I know that the world is always unfair.
>  But I don't understand why it is never  unfair to my advantage."
>
>
>@harry
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: poi-user-help@jakarta.apache.org



Mime
View raw message