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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to