×

Good News Everybody!

The new search engine is LIVE!

Please report any problems to david (at) midrange.com.




I've had no luck trying to use the "protectSheet" method in the HSSFSheet
class. It fails with:
RPG procedure HSSF_PROTE in program SOUTHERN/HSSFSRVPGM received Java
exception "java.lang.NoSuchMethodError: protectSheet" when calling method
"protectSheet" with signature "(Ljava.lang.String;)V" in class
"org.apache.poi.hssf.usermodel.HSSFSheet".

A web search pointed me to a discussion thread where the guy complained
that the method didn't exist inside the poi release 3.0.1 FINAL file but,
after much playing with JBuilder, I finally got to see the class source
and found that the "protectSheet" method does indeed exist.

So now I figure I've mis-coded the RPG. I assumed I had to code prototypes
for both "HSSFSheet_protectSheet()" and my own little 'wrapper', called
"hssf_protectSheet" (all credit to Scott Klement) and have the second
invoke the first.

Have I coded this wrong? Or am I invoking protection at the wrong time
(i.e., right after the sheet is added to the workbook)?

If anyone can help, I'd really appreciate it.

Arthur Marino
Southern Container Corp.

The s/sheet builder program:
// create the sheet object
sheet = HSSF_newSheet(book: sht_name);
// set protection for the sheet
hssf_protectSheet(sheet: password);

The service program:
P hssf_protectSheet...
P B export
D hssf_protectSheet...
D PI
D sheet like(HSSFSheet) const
D string 64A const varying options(*varsize)
D tempStr s like(jString)
/free
tempStr = new_String(string);
HSSFSheet_protectSheet(sheet: tempStr);
hssf_freelocalref(tempStr);
/end-free
P E

The prototypes:
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
* HSSFSheet_protectSheet():
* set protection of a sheet in the workbook
* sheet = ordinal number that specifies the sheet to
protect
* password = res ipso loquitor
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
D HSSFSheet_protectSheet...
D PR EXTPROC(*JAVA
D :'org.apache.poi.hssf.usermodel-
D .HSSFSheet'
D :'protectSheet')
D password like(jString)

*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
* hssf_protectSheet():
* Shortcut to protecting an HSSFSheet object
* (Wrapper around HSSFSheet_protectSheet() method)
* sheet = sheet object to protect
* password = res ipso loquitor
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
D hssf_protectSheet...
D PR
D sheet like(HSSFSheet) const
D string 64A const varying options(*varsize)


This thread ...

Follow-Ups:
Replies:

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.