I've been using Scott Klement's HSSFR4 service program, great stuff.

Article reference here -
http://archive.iprodeveloper.com/content1?topic=new-poi-release-brings-excels-xlsx-support-to-rpg-64940&catpath=java
or here -
http://www.easy400.net/hssfcgi/documentation/20100225.htm

The hssfr4 version I'm using does not have any protect sheet procedures in it.

I searched and found an hssf (.xls) protect sheet, then mucked about and
got an xssf (.xlsx) protect sheet to work, here's how -

The hssf protect sheet method works (for .xls files) when using the POI36/SETENV program,
which sets your environment for poi version 3.6 -
(found the below with search of this group)

// Protect sheet method works using poi3.6
d hssfSheet_protectSheet...
d pr extproc(*java
d : 'org.apache.poi.hssf-
d .usermodel.HSSFSheet'
d : 'protectSheet' )
d password like(jString) const

After some trialnerror I got the xssf one below to work (for .xlsx files) -

// Protect sheet method works using poi3.8
// (probably should be named xssfSheet_protectSheet?)
d mySheet_protectSheet...
d pr extproc(*java
d :SHEET_CLASS
d :'protectSheet' )
d password like(jString) const

mySheet_protectSheet() died when the environment was set for poi3.6., but I
found that if I called POI36/SETENV38, to set the environment for poi version 3.8,
mySheet_protectSheet() protect method worked. (and everthing else I'm using so far still worked)

fyi - I seem to remember that I read 'somewhere' that hssfr4 hasn't been tested with poi 3.8.

Anyway, just wanted to share.

John

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2026 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.