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

Free Support Forum - aspose.com

Encrypt Word error


I’m using Words for C++, and got System::ArgumentException: An invalid SaveFormat for this options type was chosen..
Any docx file with the following code will fail.

void WordEncrypt() {
    auto doc = System::MakeObject<Aspose::Words::Document>(u"Borders.docx");
    auto opt = System::MakeObject<Aspose::Words::Saving::DocSaveOptions>();// Aspose::Words::SaveFormat::Docx);
    doc->Save(u"tutorial-0.docx", opt);

@kngstr for DOCX document format you have to use OoxmlSaveOptions.
DocSaveOptions accepts only DOC and DOT SaveFormat.


Thanks. It does work.