Thanks for your follow up. The your example word document works perfectly and does not produce the security alert I described. So, there is something special about the forms that I am processing. These were not created by me, but are freely distributed state government nursing forms (https://www.dshs.wa.gov/altsa/residential-care-services/nurse-delegation-program is the link to the page (the bottom half of the page)that then links to “nurse delegation forms”). Sorry, these are too big to attach in the forum. These forms are set to AllowOnlyFormFields from the originator. A screenshot of the security alert is attached. To reproduce the behavior:
(1) In c# 4.6 .NET, open any of the forms from dshs.wa.gov with Syncfusion DocIO as WordDocument
(2) Set to NoProtection with Syncfusion DocIO methods
(3) Save document.
(4) Open in Word 2007. Security alert will show.
// my code fragment showing how I load the Word doc, change the protections, and resave:
// fDialog is the standard FileDialog. I get the user's file name and open the Syncfusion WordDocument:
using (WordDocument document = new WordDocument(fDialog.FileName))
{
ProtectionType pType = document.ProtectionType; // the loaded doc's protection, for showing the end user
FormatType fType = document.ActualFormatType;
string justDocNm = fDialog.SafeFileName; // the name of the doc file
// open the Dialog to get the user's choice of Protection type:
ProtectDocForm pForm = new ProtectDocForm(justDocNm, pType);
DialogResult pFormResult = pForm.ShowDialog(this); // find out if user Canceled or chose.
if (pFormResult == DialogResult.OK)
{
document.Protect(pForm.UserProtectionChoice); // set to NoProtection for test
try
{
document.AcceptChanges();
document.Save(fDialog.FileName, fType);
}
catch (Exception ex)
{
// SourcebankException is my custom Exception for my winword app.
throw (new SourcebankException("Couldn't change the Word document protection settings.", ex));
}
}
}
// As a workaround, to eliminate the security alert, resave from Word itself.