File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Generating protected excel sheets

 
Faras Dewal
Greenhorn
Posts: 2
Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!!
 
Tim Moores
Bartender
Pie
Posts: 2496
9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2
Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Bartender
Pie
Posts: 2496
9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 326
Android Firefox Browser Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic