Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8032123
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T01:18:09+00:00 2026-06-05T01:18:09+00:00

I am manipulating a Word 2010 document on the server-side and some of the

  • 0

I am manipulating a Word 2010 document on the server-side and some of the content controls in the document have the following Locking properties checked

  • Content control cannot be deleted
  • Contents cannot be edited

Can anyone advise set these Locking options to false or remove then altogether using the OpenXML SDK?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T01:18:10+00:00Added an answer on June 5, 2026 at 1:18 am

    The openxml SDK provides the Lock class and the LockingValues enumeration
    for programmatically setting the options:

    • Content control cannot be deleted and
    • Contents cannot be edited

    So, to set those two options to “false” (LockingValues.Unlocked),
    search for all SdtElement elements in the document and set the Val property to
    LockingValues.Unlocked.

    The code below shows an example:

    static void UnlockAllSdtContentElements()
    {
      using (WordprocessingDocument wordDoc =
        WordprocessingDocument.Open(@"c:\temp\myword.docx", true))
      {        
        IEnumerable<SdtElement> elements = 
          wordDoc.MainDocumentPart.Document.Descendants<SdtElement>();
    
        foreach (SdtElement elem in elements)
        {
          if (elem.SdtProperties != null)
          {
            Lock l = elem.SdtProperties.ChildElements.First<Lock>();
    
            if (l == null)
            {              
              continue;
            }
    
            if (l.Val == LockingValues.SdtContentLocked)
            {
              Console.Out.WriteLine("Unlock content element...");
              l.Val = LockingValues.Unlocked;
            }
          }
        }
      }
    }
    
    static void Main(string[] args)
    {
      UnlockAllSdtContentElements();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When manipulating controls on a .NET windows form which of the following is best
I have this Word.cc that is like string class for manipulating words. I overloaded
I'm manipulating few data with PHP, I have the choice between Json and XML.
I'm having some trouble manipulating a complex array which looks like this: Array (
I have a GtkImage that I am manipulating with a GdkPixbuf. When I change
I'm trying to do a find and replace in an OpenXML word document which
Manipulating an applet is as easy as entering javascript:document.getElementsByTagName(applet)[0].publicMethod(); into the address bar. How
I'm getting garbage values when manipulating some of my NSString objects. I think the
I am using PHP to call/manipulate a Word document, using COM. One of the
Sometimes manipulating character strings at the character level is unavoidable. Here I have a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.