poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nick Burch <nick.bu...@alfresco.com>
Subject RE: How to check whether an XLSX has a read password
Date Mon, 12 Sep 2011 13:17:22 GMT
On Mon, 12 Sep 2011, Simmons, Tom (GE Oil & Gas, VG) wrote:
> I've now got...
>
> 	System.out.println(new Date());
> 	NPOIFSFileSystem npoiFS = new NPOIFSFileSystem( new File("d:\\big n p.xls"));
> 	System.out.println(new Date());
> 	HSSFWorkbook wb = new HSSFWorkbook(npoiFS.getRoot(), true);
> 	System.out.println(new Date());
> 	Boolean check = wb. isWriteProtected();
> 	System.out.println(check);

You could try with the event usermodel, and bail out once you hit a point 
where it has worked.

> I'm also no longer sure I'm using the correct test (isWiteProtected). 
> All I am looking for is to check that the workbook hasn't had a password 
> added that prevents it being loaded/opened.

I'd suggest you create two files, one which isn't protected and one that 
is (in the way you want to check for). Try with them and use that to 
verify!

Nick

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


Mime
View raw message