You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by ragz_82 <k....@oracle.com> on 2010/05/04 16:56:48 UTC

Re: POI XSSF API how do I lock specific Excel sheet features?

Mark,
I am facing a similar situation. My requirement is to basically make the
generated .xlsx file as read only. The enableLocking method almost achieves
this functionality, but there are two shortfalls.

1. In cases where the cell content is longer than usual, I am unable to
stretch the column width to view the cell content completely. This defeats
the purpose of the Report.
2. Clicking the Unprotect Worksheet button under the Review tab, revokes
this entire setting. In other words, the sheet is editable.

Please let me know if you have any suggestions.

Regards,
Raghu

-- 
View this message in context: http://old.nabble.com/POI-XSSF-API-how-do-I-lock-specific-Excel-sheet-features--tp27332341p28447752.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: POI XSSF API how do I lock specific Excel sheet features?

Posted by MSB <ma...@tiscali.co.uk>.
Sorry, no idea.

Zachary Mitchell, BCIS wrote:
> 
> Not quite.  I am talking about putting
> on a password for the *.xls
> fire itself so that it cannot be opened.
> 
> I can see generally how to do this in Excel.
> How would I acheive the same in Microsoft Word,
> *.doc  ?
> 
> 
> ----- Original Message ----- 
> From: "MSB" <ma...@tiscali.co.uk>
> To: <us...@poi.apache.org>
> Sent: Wednesday, May 05, 2010 4:09 PM
> Subject: Re: POI XSSF API how do I lock specific Excel sheet features?
> 
> 
>>
>> Please do not take this as the definitive example of locking using XSSF. 
>> That
>> was simply a small piece of code that I was playing around with because
>> at
>> that time no one seemed to know just whatthe sequence of method calls had 
>> to
>> be in order to protect the contents of an Excel workbook built using
>> XSSF.
>> It may well be that you need to call other methods than these and I have 
>> not
>> undertaken any testing to see what they do so cannot really comment 
>> further
>> on this matter. I do wonder though if you are focusing on the wrong
>> aspect
>> of the problem.
>>
>> If I understand what you said correctly, you have a worksheet that you 
>> wish
>> to protect, preventing users even from changing the widths of the
>> columns.
>> Occaisionally, you encounter a problem when the values you have to write
>> into certain cells are so long, they stretch past the edges of the cell 
>> and
>> are hidden from view unless the user CAN increase the width of the
>> column.
>> Well, if that is the case, I think that you should really consider
>> formatting those cells and structuring their contents so that they can be
>> seen without the need to expand the columns. POI includes a method that 
>> you
>> can call to size the column so that it accomodates the largest (in terms 
>> of
>> it's width) value. Alternatively, you could simply insert line breaks
>> (\n)
>> into the cells contents at strategic points and then set word wrapping on
>> for the cell. You may also need to adjust the height of the row in this 
>> case
>> although Excel may - MAY - set this for you automatically when the sheet 
>> is
>> opened.
>>
>> Yours
>>
>> Mark B
>>
>>
>> ragz_82 wrote:
>>>
>>> Mark,
>>> I am facing a similar situation. My requirement is to basically make the
>>> generated .xlsx file as read only. The enableLocking method almost
>>> achieves this functionality, but there are two shortfalls.
>>>
>>> 1. In cases where the cell content is longer than usual, I am unable to
>>> stretch the column width to view the cell content completely. This 
>>> defeats
>>> the purpose of the Report.
>>> 2. Clicking the Unprotect Worksheet button under the Review tab, revokes
>>> this entire setting. In other words, the sheet is editable.
>>>
>>> Please let me know if you have any suggestions.
>>>
>>> Regards,
>>> Raghu
>>>
>>>
>>
>> -- 
>> View this message in context: 
>> http://old.nabble.com/POI-XSSF-API-how-do-I-lock-specific-Excel-sheet-features--tp27332341p28457266.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/POI-XSSF-API-how-do-I-lock-specific-Excel-sheet-features--tp27332341p28457477.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: POI XSSF API how do I lock specific Excel sheet features?

Posted by Zachary Mitchell <za...@internode.on.net>.
Not quite.  I am talking about putting
on a password for the *.xls
fire itself so that it cannot be opened.

I can see generally how to do this in Excel.
How would I acheive the same in Microsoft Word,
*.doc  ?


----- Original Message ----- 
From: "MSB" <ma...@tiscali.co.uk>
To: <us...@poi.apache.org>
Sent: Wednesday, May 05, 2010 4:09 PM
Subject: Re: POI XSSF API how do I lock specific Excel sheet features?


>
> Please do not take this as the definitive example of locking using XSSF. 
> That
> was simply a small piece of code that I was playing around with because at
> that time no one seemed to know just whatthe sequence of method calls had 
> to
> be in order to protect the contents of an Excel workbook built using XSSF.
> It may well be that you need to call other methods than these and I have 
> not
> undertaken any testing to see what they do so cannot really comment 
> further
> on this matter. I do wonder though if you are focusing on the wrong aspect
> of the problem.
>
> If I understand what you said correctly, you have a worksheet that you 
> wish
> to protect, preventing users even from changing the widths of the columns.
> Occaisionally, you encounter a problem when the values you have to write
> into certain cells are so long, they stretch past the edges of the cell 
> and
> are hidden from view unless the user CAN increase the width of the column.
> Well, if that is the case, I think that you should really consider
> formatting those cells and structuring their contents so that they can be
> seen without the need to expand the columns. POI includes a method that 
> you
> can call to size the column so that it accomodates the largest (in terms 
> of
> it's width) value. Alternatively, you could simply insert line breaks (\n)
> into the cells contents at strategic points and then set word wrapping on
> for the cell. You may also need to adjust the height of the row in this 
> case
> although Excel may - MAY - set this for you automatically when the sheet 
> is
> opened.
>
> Yours
>
> Mark B
>
>
> ragz_82 wrote:
>>
>> Mark,
>> I am facing a similar situation. My requirement is to basically make the
>> generated .xlsx file as read only. The enableLocking method almost
>> achieves this functionality, but there are two shortfalls.
>>
>> 1. In cases where the cell content is longer than usual, I am unable to
>> stretch the column width to view the cell content completely. This 
>> defeats
>> the purpose of the Report.
>> 2. Clicking the Unprotect Worksheet button under the Review tab, revokes
>> this entire setting. In other words, the sheet is editable.
>>
>> Please let me know if you have any suggestions.
>>
>> Regards,
>> Raghu
>>
>>
>
> -- 
> View this message in context: 
> http://old.nabble.com/POI-XSSF-API-how-do-I-lock-specific-Excel-sheet-features--tp27332341p28457266.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: POI XSSF API how do I lock specific Excel sheet features?

Posted by MSB <ma...@tiscali.co.uk>.
Please do not take this as the definitive example of locking using XSSF. That
was simply a small piece of code that I was playing around with because at
that time no one seemed to know just whatthe sequence of method calls had to
be in order to protect the contents of an Excel workbook built using XSSF.
It may well be that you need to call other methods than these and I have not
undertaken any testing to see what they do so cannot really comment further
on this matter. I do wonder though if you are focusing on the wrong aspect
of the problem.

If I understand what you said correctly, you have a worksheet that you wish
to protect, preventing users even from changing the widths of the columns.
Occaisionally, you encounter a problem when the values you have to write
into certain cells are so long, they stretch past the edges of the cell and
are hidden from view unless the user CAN increase the width of the column.
Well, if that is the case, I think that you should really consider
formatting those cells and structuring their contents so that they can be
seen without the need to expand the columns. POI includes a method that you
can call to size the column so that it accomodates the largest (in terms of
it's width) value. Alternatively, you could simply insert line breaks (\n)
into the cells contents at strategic points and then set word wrapping on
for the cell. You may also need to adjust the height of the row in this case
although Excel may - MAY - set this for you automatically when the sheet is
opened.

Yours

Mark B


ragz_82 wrote:
> 
> Mark,
> I am facing a similar situation. My requirement is to basically make the
> generated .xlsx file as read only. The enableLocking method almost
> achieves this functionality, but there are two shortfalls.
> 
> 1. In cases where the cell content is longer than usual, I am unable to
> stretch the column width to view the cell content completely. This defeats
> the purpose of the Report.
> 2. Clicking the Unprotect Worksheet button under the Review tab, revokes
> this entire setting. In other words, the sheet is editable.
> 
> Please let me know if you have any suggestions.
> 
> Regards,
> Raghu
> 
> 

-- 
View this message in context: http://old.nabble.com/POI-XSSF-API-how-do-I-lock-specific-Excel-sheet-features--tp27332341p28457266.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