I have several xlsx files that have the "read-only recommended" flag set.
- Is there a POI 5.x method available to disable this checkbox?
I looked through POI XML Properties with no luck.
I have several xlsx files that have the "read-only recommended" flag set.
I looked through POI XML Properties with no luck.
Copyright © 2021 Jogjafile Inc.
In
Office Open XML
-Excel files the setting "read only recommended" is stored in/xl/workbook.xml
as an attribute in afileSharing
XML-element.This can be set or unset using
apache poi
only using the low levelorg.openxmlformats.schemas.spreadsheetml.x2006.main.*
-classes.Complete example:
If the
sourceFile.xlsx
has set that option, but without passwords, then after running that code theresultFile.xlsx
has not set that option anymore.If passwords are set too, then decryption is needed at first and the password in
fileSharing
needs to be unset too. Of course then at least the decryption-password needs to be known.