Restriction of movement/copying/cutting/pasting in Word

Hi,

Is it possible to restrict clause movement (assuming an XML marked-up Word document) to prevent schema violations
At the current moment, I have managed a half-way solution, by calling undo when the XMLValidationError event is raised, but this seems like a sloppy fix. It would be much more effective to determine if a specific action (such as moving of an XMLNode) would violate the schema in advance of the actual action and prevent it from happening all together, as opposed to auto-undoing it.
Is such a control mechanism possible


Thank you,

-Nick


Answer this question

Restriction of movement/copying/cutting/pasting in Word

  • CrushDaByte

    Hi Mike,

    Yes, this is a legal document with certain structure that needs to be maintained. As such, I am able to catch violations of the schema after the action is performed (e.g. a clause is dragged where it is not supposed to) and undo it. However, I was curious if it was possible to see if an action that is about to be performed will produce a violation and prevent it from happening altogether.
    So, a preventative system rather than a symptomatic one.

    Further example:
    Suppose I have a doc that goes something like this:


    <body>
    <header>Stuff here</header>
       <clause>Blah 1</clause>
       <clause>Blah 2</clause>
       <clause>Blah 3</clause>
    </body>

     



    Now, suppose one of the rules is that a header cannot contain tags within itself (i.e. <header><clause>Blah!</clause></header> is not allowed).
    A user selects a clause (tags+text) and drags it into a header.
    What I want to do is, before the text is moved, display a message re:schema violation and stop this action from happening.
    What I have right now is the action happening, a XMLSchemaError event firing (~ 1 second later), and my response code executing (Undo, Error Message, or whatever else).


    Hopefully that clarifies it.
    And thank you for your help - I appreicate it!

    -Nick

  • tronth

    Hi Nick

    Have you looked at document protection Am not sure what you are trying to achieve specifically, is this a legal document with clauses that need to remain in place. Protection is more designed around this functionality, albeit I can see what you are doing if the schema is rich enough then you can action upon it as you have.

    More detail on the requirement may help me understand more.

    Regards
    Mike Walker MVP
    Visual Developer VSTO



  • Vijaya Kumar M

    Hi Nick

    I do think this is a limitation on the way the events are fired, being a writer for legal software for many years appreciate that there are sometimes things that are needed in the protection of documents, I do feel the new Office 2007 is a lot better on this and would hope this will resolve the issues for the future. I am also presuming Office 2003 is going to be the minimum required version but without doing this externally of word I can't see a way of doing this at present.

    Regards



  • Restriction of movement/copying/cutting/pasting in Word