× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hi Arthur,

Please type the following command (this is one command -- sorry if the e-mail software splits it into two lines):

STRQSH CMD('javap -s org.apache.poi.hssf.usermodel.HSSFSheet > /tmp/sheetmeth.txt')

This will create an IFS file named /tmp/sheetmeth.txt that lists all of the Java methods in the HSSFSheet class. Then, type the following to see the contents of this file:

DSPF STMF('/tmp/sheetmeth.txt')

in the 'control' field at the top, type 'f protectSheet' (without the quotes) and it'll search for that string -- just like SEU, if you've used that.

In my case, it does NOT show a method by that name... therefore your RPG program wouldn't be able to use it. FWIW agree with the bug report -- the bug report says that the online Javadocs are from TRUNK.. (which is the copy of the code that the developers are currently working with) Protection was not implemented in 3.0.1 FINAL therefore, it won't exist... and it didn't on my system. However, the team did recently release a 3.0.2 BETA which should have these new functions in it (I haven't tested it, though.)

If you're already trying the new version of the JAR files that do have a 'protectSheet' method, then you need to look at the signature. There's should be a line that says "Signature:" below each method. The signature is a code that identifies the types of the parameters that are to be passed to the method. Since Java supports overloading (i.e. having two separate methods with the same names, but different parameters) both the method name AND the signature have to match in order for RPG to find the method.



Arthur.Marino@xxxxxxxxxxxxxxxx wrote:
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)



As an Amazon Associate we earn from qualifying purchases.

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-2024 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.