Lock class

Office 2013 and later

Defines the Lock Class. When the object is serialized out as xml, its qualified name is w:lock.

Namespace:  DocumentFormat.OpenXml.Wordprocessing
Assembly:  DocumentFormat.OpenXml (in DocumentFormat.OpenXml.dll)

public class Lock : OpenXmlLeafElement

[ISO/IEC 29500-1 1st Edition]

lock (Locking Setting)

This element specifies the set of behaviors which shall be applied to the contents of the parent structured document tag when the contents of this documents are edited by an application (whether through a user interface or directly). The type of locking applied to the structured document tag is specified via the value of the associated val attribute.

If this element is omitted, then the locking settings implied for the structured document tag shall be as follows:

  • If the structured document tag specifies that it is a group via the group element (§17.5.2.17), then the contents of the structured document tag shall be editable, but the entire tag can be deleted.

  • For all other kinds, no locking settings shall be applied to the structured document tag.

[Example: Consider the following plain text structured document tag:

<w:sdt>
  <w:sdtPr>
    <w:lock w:val="sdtLocked"/>
    …    <w:text/>
  </w:sdtPr>
  …</w:sdt>

This plain text structured document tag's properties contain a lock element, specifying locking behaviors for the structured document tag. Since the locking val attribute value is sdtLocked, this locking setting must specify that the contents of the structured document tag can be edited, but the structured document tag itself must not be deleted from the document. end example]

Parent Elements

sdtPr (§17.5.2.38)

Attributes

Description

val (Locking Type)

Specifies the type of locking which shall be applied to the parent structured document tag.

If this attribute is omitted, this its value shall be assumed to be unlocked (using the defaults stated above).

[Example: Consider the following plain text structured document tag properties:

<w:sdtPr>
  <w:lock w:val="contentLocked"/>
  …  <w:text/>
</w:sdtPr>

The val attribute value is contentLocked, therefore this locking setting shall specify that the contents of the structured document tag must not be edited, but the structured document tag itself can be deleted from the document. end example]

The possible values for this attribute are defined by the ST_Lock simple type (§17.18.49).

[Note: The W3C XML Schema definition of this element’s content model (CT_Lock) is located in §A.1. end note]

© ISO/IEC29500: 2008.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show: