Security alert when opening Word document in Office Word

When I save a Word document with WordDocument.Save(<path>,<format>) after changing the protection mode (from AllowOnlyFormsFields to NoProtection for example) and then open it in Word (2007), I get a security alert from Word. Is there a way to avoid triggering the security alert behavior before saving the document?

The work-around solution is to open the document in Word and then save the file again. The alert will go away. 

3 Replies

VR Vijay Ramachandran Syncfusion Team October 20, 2017 06:04 AM UTC

Hi Robert,

Thank you for contacting Syncfusion support.

We are unable to reproduce the reported issue with the given details. As per your description, we have opened an existing Word document (which has protection) and set the protection type as NoProtection then opened the resultant Word document in Microsoft Word 2007 application. Please find the sample from below link which is used at our end to reproduce the issue.
http://www.syncfusion.com/downloads/support/forum/133294/ze/GenerateWord-780120330.zip

So, kindly modify the above sample and provide us to reproduce the same issue at our end. Also provide us the screen shot of alert message with the output Word document. Thereby we will analyze further and provide you a prompt solution.

Please let us know if you have any concern.

Regards,
Vijay R
 



RD Robert Dickow October 20, 2017 06:55 PM UTC

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.


Attachment: Word2007_SecurityAlert_57f4d265.zip


VR Vijay Ramachandran Syncfusion Team October 23, 2017 10:57 AM UTC

Hi Robert,

Thank you for your update.

A support incident to track the status of your query has been created under your account. Please log on to our support website to check for further updates,

https://www.syncfusion.com/account/login?ReturnUrl=%2fsupport%2fdirecttrac%2fincidents

Please let us know if you have any concern.

Regards,
Vijay R


Loader.
Up arrow icon