I am trying to make Read-only files in Excel.
I have Aspose cells 21.2 jar.
When I am using
workBook.getSettings().setWriteProtected(true); on java platform
the “setWriteProtected” is coming as deprecated and thus I cannot use the feature and make it read only file.
What method to use for such instance?
Please try using the line of code to specify the write protection settings (with a password):
workBook.getSettings().getWriteProtection().setPassword("your_password");
when you specify the write protection setting with a password, the file will automatically become a read-only file for general users.
1 Like
Thank you so much.
It did worked for me.
I even played around with it to make all the files open in read-only mode.
Regards,
Shikhar Nigam
Good to know that the suggested line of code works for your needs. In the event of further queries or issue, feel free write us back.
1 Like