Forums Register Login

Generating protected excel sheets

+Pie Number of slices to send: Send
I am using a servlet to generate an excel sheet.
The code is given below:




I want to make the first column of the excel sheet readonly.
Please help!!
+Pie Number of slices to send: Send
You're not generating an Excel document, you're generating HTML, which some spreadsheet applications (like Excel) happen to be able to read. If you want to use actual spreadsheet-like functionality, you'll need to generate actual XLS or XLSX documents, possibly using a library like Apache POI.

I'm not sure it's possible to protect individual columns, though; I seem to recall that being a per-sheet (or even per-file) setting.
+Pie Number of slices to send: Send
thanks tim.
is there some other way of generating an excel sheet from a jsp sheet wherein we can have a column as write protected???
+Pie Number of slices to send: Send
I'd start by finding out if Excel even supports this functionality; as I said, I'm not sure it does.
+Pie Number of slices to send: Send
 

Tim Moores wrote:I'd start by finding out if Excel even supports this functionality; as I said, I'm not sure it does.



It does.

The functionality that TS is looking for is specified in the CellStyle interface. (http://poi.apache.org/apidocs/org/apache/poi/ss/usermodel/CellStyle.html).

The implementation of it is done in http://poi.apache.org/apidocs/org/apache/poi/hssf/usermodel/HSSFCellStyle.html and there you can define a style and use the setLock(true) on the column by setting the columnStyle on the sheet.
You got style baby! More than this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1242 times.
Similar Threads
Change color dynamically
how to extract data from html page to excel sheet
how to extract data to an xl sheet
error in request.addCookie(c)
JSP - cookie not processing as it should
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 06:51:22.