none
Word 2010 addin beforeSave "protected view" RRS feed

  • Question

  • Hello everyone,

    Am in the protected mode, when clicking on the enable mode, i wish to update some fields (Like title, headers...) and save it before the user can start doing his changes.

    In the BeforeSave event, for an active document, i can call the Macro "FileSave" but in protected mode i cant!

    Is there an equivalent for Protected view ?

    Thanks,

    Anoushka

     

    Thursday, October 27, 2011 4:56 PM

Answers

  • Hello,

     

    I di not quite understand what you want, but if you want to determin when you are in protected mode, use

    WordTools.Document vstoDocument = activeDocument.GetVstoObject();
    ...
    vstoDocument.ReadOnly; // readonly mode
    vstoDocument.ProtectionType; // more specific protection
    


    Best regards,

    Silviu


    http://www.rosoftlab.net/
    • Proposed as answer by Bruce Song Monday, November 7, 2011 11:00 AM
    • Marked as answer by Bruce Song Wednesday, November 9, 2011 6:13 AM
    Friday, October 28, 2011 4:57 AM
  • Hi Anoushka

    I take it you're talking about the "sandbox" mode? The "protected view" that Office 2010 will use for documents being opened from Email, for example?

    You first need to convert from protected mode to unprotected mode before you can make any changes or save. That's what "protected view" is all about.

    When the user clicks to allow editing in a document opened in protected view it triggers the ProtectedViewWindowBeforeEdit event. You should be able to hook into that and perform your actions?


    Cindy Meister, VSTO/Word MVP
    • Proposed as answer by Bruce Song Monday, November 7, 2011 11:00 AM
    • Marked as answer by Bruce Song Wednesday, November 9, 2011 6:13 AM
    Friday, October 28, 2011 5:46 AM
    Moderator

All replies

  • Hello,

     

    I di not quite understand what you want, but if you want to determin when you are in protected mode, use

    WordTools.Document vstoDocument = activeDocument.GetVstoObject();
    ...
    vstoDocument.ReadOnly; // readonly mode
    vstoDocument.ProtectionType; // more specific protection
    


    Best regards,

    Silviu


    http://www.rosoftlab.net/
    • Proposed as answer by Bruce Song Monday, November 7, 2011 11:00 AM
    • Marked as answer by Bruce Song Wednesday, November 9, 2011 6:13 AM
    Friday, October 28, 2011 4:57 AM
  • Hi Anoushka

    I take it you're talking about the "sandbox" mode? The "protected view" that Office 2010 will use for documents being opened from Email, for example?

    You first need to convert from protected mode to unprotected mode before you can make any changes or save. That's what "protected view" is all about.

    When the user clicks to allow editing in a document opened in protected view it triggers the ProtectedViewWindowBeforeEdit event. You should be able to hook into that and perform your actions?


    Cindy Meister, VSTO/Word MVP
    • Proposed as answer by Bruce Song Monday, November 7, 2011 11:00 AM
    • Marked as answer by Bruce Song Wednesday, November 9, 2011 6:13 AM
    Friday, October 28, 2011 5:46 AM
    Moderator