I want read only excel sheet after creating it using Apache POI HSSF. How can I do that?
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
- Difference between Types.INTEGER and Types.NULL in
A detailed description can be found here: http://systeminetwork.com/article/locking-cells-hssf
Basically you have to assign your cells a custom
CellStyle
withCellStyle.setLocked(true)
Edited
Hi Gaurav, here is the complete and working code:
Here is some tested code that works in making the specific cell readonly. Based on your comment in @Thomas Weber's answer.
This sets an initial value in a cell, then it uses a data constraint to ensure that fixed value cannot be modified by the user in Excel. Try it out.
This code is based on this thread http://osdir.com/ml/user-poi.apache.org/2009-07/msg00056.html