poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nilesh Naik <nileshravin...@gmail.com>
Subject Re: Adding password protection to excel files
Date Tue, 15 Mar 2011 11:23:33 GMT
The requirement is to open a existing workbook & apply password.
We are using the below  URL for reference>> *
http://www.salesclic.com/le_coin_du_geek/using-apache-poi-with-ruby-to-generate-excel-spreadsheets/
*

and here is the code we have written
   apache_poi_path = 'C:\Users\ABC\Desktop\poi-3.7\poi-3.7-20101029.jar'
Rjb::load("#{apache_poi_path}", ['-Xms256M', '-Xmx512M'])
file_class = Rjb::import('java.io.FileOutputStream')
workbook_class = Rjb::import('jxl.Workbook')
workbook_class = Rjb::import('org.apache.poi.hssf.usermodel.HSSFWorkbook')

book = workbook_class.new

sheet = book.createSheet('Password')

sheet.protectSheet("ruby")

out = file_class.new('C:\Users\..........\nilesh.xls')
book.write(out)
out.close

On Tue, Feb 15, 2011 at 1:41 PM, Mark Beardsley <markbrdsly@tiscali.co.uk>wrote:

>
> It might be. Which file version are you targetting - binary or XML - and
> what
> exactly do you mean by password protection? HSSF can, for example write
> protect the workbook whilst XSSF defines methods that allow you to exercise
> much more granular control over the protection applied to the workbook.
>
> Yours
>
> Mark B
> --
> View this message in context:
> http://apache-poi.1045710.n5.nabble.com/Adding-password-protection-to-excel-files-tp3385589p3385617.html
> Sent from the POI - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message