We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

File with protection can't be unprotect after save

Hi,

Aspose library : Aspose-words-15.9
Microsoft Office 2013.

I’m working with file protect against modification with password. I have just upgraded Aspose library from 14.5 to 15.9.
Since I have upgraded the library, when I create a file with Aspose, I’ve got a problem with the password: I can’t unprotect the file. The password seems to have changed. Even if I lock the file with code, the password is still incorrect.
Here is the simple test code to reproduce the problem: The password is test:

public static void main(String[] args) {
try {
License license = new License();
license.setLicense(“Aspose.Total.Java.lic”);
String fileName = “D:\ASPOSETEST\blankmodel.docx”;
Document doc = new Document(fileName);
replacePlaceHolderText(doc);
} catch (Exception e) {
System.err.print(e);
}
}

public static void replacePlaceHolderText(Document doc) throws Exception {
String destFile = “D:\ASPOSETEST\asposefilledmodel.docx”;
DocumentBuilder builder = new DocumentBuilder(doc);
NodeCollection sdtNodes = doc.getChildNodes(NodeType.STRUCTURED_DOCUMENT_TAG, true);
Iterator it = sdtNodes.iterator();
while (it.hasNext()) {
StructuredDocumentTag sdt = (StructuredDocumentTag) it.next();
Run run = (Run) sdt.getChild(NodeType.RUN, 0, true);
if (run != null) {
run.setText(“Hello”);
}
}
// doc.unprotect();
// doc.protect(ProtectionType.READ_ONLY, “test”);
doc.save(destFile);
}

Thank you for your help.
Hi Piot,

Thanks for your inquiry. We tested the scenario and have managed to reproduce the same problem on our end. For the sake of correction, we have logged this problem in our issue tracking system as WORDSNET-12519. Our product team will further look into the details of this problem and we will keep you updated on the status of correction. We apologize for your inconvenience.

Best regards,

The issues you have found earlier (filed as WORDSNET-12519) have been fixed in this .NET update and this Java update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.