This week's book giveaway is in the General Computing forum.
We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line!
See this thread for details.
The moose likes Other Open Source Projects and the fly likes Generating protected excel sheets Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Products » Other Open Source Projects
Reply Bookmark "Generating protected excel sheets" Watch "Generating protected excel sheets" New topic
Author

Generating protected excel sheets

Faras Dewal
Greenhorn

Joined: Oct 07, 2011
Posts: 2

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!!


The world is an OBJECT and we define it by CLASS
Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2407
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.
Faras Dewal
Greenhorn

Joined: Oct 07, 2011
Posts: 2

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???
Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2407
I'd start by finding out if Excel even supports this functionality; as I said, I'm not sure it does.
Ove Lindström
Ranch Hand

Joined: Mar 10, 2008
Posts: 326

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Generating protected excel sheets
 
Similar Threads
Change color dynamically
error in request.addCookie(c)
how to extract data to an xl sheet
JSP - cookie not processing as it should
how to extract data from html page to excel sheet