You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by "TARAF, WALID (ATTSI)" <TW...@att.com> on 2010/03/24 17:58:38 UTC

HSSF hide menu item?

Hi everyone, 

I am tryin to disable a menu item in the Excel file I generate...for
example "Review....unprotect sheet"
Has anyone been able to do either of the following using HSSF?

I am able to lock the sheet, and set up a password etc...but I do not
see any functionality to disable particular menu item (almost like a VB
macro would do).

Thanks for your consideration
wt

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


RE: HSSF hide menu item?

Posted by MSB <ma...@tiscali.co.uk>.
Are you able to use the xml based file format exclusivly for your work
because there is a workaround to the 'password issue'.

As you correctly state, the intorduction of the newer file format was
accompanied by an overhaul in the protection available. It is possible now
to exercise a much finer grained level of control as you know and XSSF
offers access to this for the xml based file format. What XSSF does not
offer is an equivalent to the protectSheet() method found in the HSSF stream
but there is a workaround, well a bit of a bodge to be honest.

I view the list through Nabble so forgive the link please, but have a look
at this;

http://old.nabble.com/DO-NOT-REPLY--Bug-48900--New%3A-XSSF-doesn%27t-have-the-method-protectSheet-as-we-have-for-HSSF-API-to27878972.html

Near to the top, you will find three messages posted by me in quite quick
succession because I found out that you could use Excel to create a empty
file and set the password. POI is then able to open that file and populate
it with data successfully without corrupting the password you have set. So,
if the issue is a blocker for your project and you can use the xml based
file format, this may offer some hope. One thing I did not try was to modify
the protection settings using POI but I am going to guess that this should
be possible also. Finally, you will see that I suggested a possible soltuion
to the situation where you may not know how many sheets are required before
populating the workbook. To date, I have not tested the cloneSheet() method
at all but can still see no reason why it will not work.

Yours

Mark B

PS. The problem may, and that is a may as I am not a part of the development
team, be that the password is actually encrypted in the xml file at least
and I do not know how easy it is to discover details about the encryption
algorithm that Microsoft uses.


TARAF, WALID (ATTSI) wrote:
> 
> Yeah I was asking about the ability to control those widgets such as
> Menu and/or menu items.   
> 
> See what happens is the following for my case.  I need to completely
> disable "cut/copy-n-paste" a selection of rows/columns AND protect the
> sheet.
> 
> Well:
> 
> 1) HSSF allows protection the sheet thru password setting etc.  But does
> not allow disabling the "cut-n-paste"
> 2) XSSF allows protection at cell level with the disabling of
> cut-n-paste.  But no API to set password setting to protect the sheet.
> POI developers user list did confirm that was a bug and they should have
> had that set up like HSSF does....basically build on HSSF interfaces.
> 
> 
> SO I am trying to use option 2 while disabling "Review....unprotect
> sheet" menu item :)
> 
> Thanks for your quick reply Mark
> 
> Walid t.
> 
> 
> -----Original Message-----
> From: MSB [mailto:markbrdsly@tiscali.co.uk] 
> Sent: Wednesday, March 24, 2010 1:06 PM
> To: user@poi.apache.org
> Subject: Re: HSSF hide menu item?
> 
> 
> Are you asking if it is possible to disable - just as an example - the
> Save
> As menu option? If so, then the answer is no. POI is not able to control
> Excel in the way that VBA macros can; you can use POI to create and edit
> files that are compatible with Excel.
> 
> Yours
> 
> Mark B
> 
> 
> TARAF, WALID (ATTSI) wrote:
>> 
>> Hi everyone, 
>> 
>> I am tryin to disable a menu item in the Excel file I generate...for
>> example "Review....unprotect sheet"
>> Has anyone been able to do either of the following using HSSF?
>> 
>> I am able to lock the sheet, and set up a password etc...but I do not
>> see any functionality to disable particular menu item (almost like a
> VB
>> macro would do).
>> 
>> Thanks for your consideration
>> wt
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
>> For additional commands, e-mail: user-help@poi.apache.org
>> 
>> 
>> 
> 
> -- 
> View this message in context:
> http://old.nabble.com/HSSF-hide-menu-item--tp28018065p28018163.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
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/HSSF-hide-menu-item--tp28018065p28018455.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


RE: HSSF hide menu item?

Posted by "TARAF, WALID (ATTSI)" <TW...@att.com>.
Yeah I was asking about the ability to control those widgets such as
Menu and/or menu items.   

See what happens is the following for my case.  I need to completely
disable "cut/copy-n-paste" a selection of rows/columns AND protect the
sheet.

Well:

1) HSSF allows protection the sheet thru password setting etc.  But does
not allow disabling the "cut-n-paste"
2) XSSF allows protection at cell level with the disabling of
cut-n-paste.  But no API to set password setting to protect the sheet.
POI developers user list did confirm that was a bug and they should have
had that set up like HSSF does....basically build on HSSF interfaces.


SO I am trying to use option 2 while disabling "Review....unprotect
sheet" menu item :)

Thanks for your quick reply Mark

Walid t.


-----Original Message-----
From: MSB [mailto:markbrdsly@tiscali.co.uk] 
Sent: Wednesday, March 24, 2010 1:06 PM
To: user@poi.apache.org
Subject: Re: HSSF hide menu item?


Are you asking if it is possible to disable - just as an example - the
Save
As menu option? If so, then the answer is no. POI is not able to control
Excel in the way that VBA macros can; you can use POI to create and edit
files that are compatible with Excel.

Yours

Mark B


TARAF, WALID (ATTSI) wrote:
> 
> Hi everyone, 
> 
> I am tryin to disable a menu item in the Excel file I generate...for
> example "Review....unprotect sheet"
> Has anyone been able to do either of the following using HSSF?
> 
> I am able to lock the sheet, and set up a password etc...but I do not
> see any functionality to disable particular menu item (almost like a
VB
> macro would do).
> 
> Thanks for your consideration
> wt
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org
> 
> 
> 

-- 
View this message in context:
http://old.nabble.com/HSSF-hide-menu-item--tp28018065p28018163.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


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: HSSF hide menu item?

Posted by MSB <ma...@tiscali.co.uk>.
Are you asking if it is possible to disable - just as an example - the Save
As menu option? If so, then the answer is no. POI is not able to control
Excel in the way that VBA macros can; you can use POI to create and edit
files that are compatible with Excel.

Yours

Mark B


TARAF, WALID (ATTSI) wrote:
> 
> Hi everyone, 
> 
> I am tryin to disable a menu item in the Excel file I generate...for
> example "Review....unprotect sheet"
> Has anyone been able to do either of the following using HSSF?
> 
> I am able to lock the sheet, and set up a password etc...but I do not
> see any functionality to disable particular menu item (almost like a VB
> macro would do).
> 
> Thanks for your consideration
> wt
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/HSSF-hide-menu-item--tp28018065p28018163.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