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

  • Home
  • SEARCH
  • 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 9235859
In Process

The Archive Base Latest Questions

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

I am fairly new to Word Addin development. Fortunately I was able to do

  • 0

I am fairly new to Word Addin development. Fortunately I was able to do almost everything but stuck at some simple issue I belive.

I want to insert plain text controls dynamically at the selected range. For this I am using the following:

    currentDocument = application.ActiveDocument;
    foreach(var field in myFieldsList)
    {      
         Microsoft.Office.Interop.Word.Range rng = currentDocument.ActiveWindow.Selection.Range;
         object oRng = rng;
         var contentControlPlain = application.ActiveDocument.ContentControls.Add(Microsoft.Office.Interop.Word.WdContentControlType.wdContentControlText, ref oRng);
         contentControlPlain.Tag = formField.FormFieldId.ToString();
         contentControlPlain.SetPlaceholderText(null, null, " <" + formField.FormFieldName + "> ");
         contentControlPlain.LockContentControl = (formField.TypeName.Trim() == "Blank");
    }

Code seems to be working fine but when I try to insert the second field it complains saying:

This method or property is not available because the current selection partially covers a plain text content control.

I understand that addin is trying to insert next content control into the previously inserted plain text control. But I tried giving some other range and could not fix it.
Any help is greatly appreciated.

Thanks.

  • 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-18T07:09:07+00:00Added an answer on June 18, 2026 at 7:09 am

    After adding every content control use

    Application.Selection.Start = lastControl.Range.End+1
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This should be fairly simple question. I'm using DocX library to create new word
Fairly new to jquery so I might be making a simple mistake but I
I am fairly new to php and mysql but I have created a small
I'm fairly new to Visual Studio (specifically Visual Basic .NET) but have been programming
Fairly new to Jquery here.... but one thing I have been told and being
So, this is a fairly simple thing I'm trying to accomplish (javascript), but it's
Fairly new to relational database and to sqlite. But I'm curious what's the best
fairly new to Objective-C and iOS development (coming from PHP) and I have a
I am fairly new to Word AddIns and trying to add Ribbon Group(s). for
might be an easy question but i'm fairly new to regular expressions. given 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.