• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

Generating protected excel sheets

 
Greenhorn
Posts: 2
Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!!
 
Bartender
Posts: 7645
178
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 7645
178
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 326
Android Mac OS X Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic