poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Allison, Timothy B." <talli...@mitre.org>
Subject RE: Validating office files without saving them
Date Thu, 07 Apr 2016 14:35:13 GMT
Thanks to Javen and Dominik, I just learned this one myself...

    Workbook workbook = WorkbookFactory.create(java.io.File file, null, true);


-----Original Message-----
From: Joseph Price [mailto:joseph.price@numbersplace.com] 
Sent: Thursday, April 07, 2016 10:19 AM
To: user@poi.apache.org
Subject: Validating office files without saving them

Hello,


I am using POI to determine whether or not an existing office file is valid.  For Excel files,
I am using


    Workbook workbook = WorkbookFactory.create(java.io.File file);


If that succeeds without throwing an exception, I assume the file is valid, and then I close
it in a finally block:


    workbook.close();


The problem is that the close method is saving the file, which I don't want.  Is there a way
to close the workbook without modifying the file on disk?


Thanks,

Joe

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


Mime
View raw message