Inserting Content Control for a selected text

Do you want to: Suggest a feature / Report a bug / Ask a how-to question
For feature suggestions, describe the result you would like to achieve in detail:
For bug reports, provide the steps to reproduce and if possible a minimal demo of the problem:
Document Server version:
Additional information:
Any relevant details about the situation. You can also attach images and videofile to the post (or to place them to external storage)
using below code to to select certian text from a pharagraph and add as a bookmark. Instead of adding as a bookmark, how to add selected text as a content control to display in left pane, so that when user clicks on content control , cursor will be pointed to exact location in the document. Just to mention document doesn’t have any content controls inside a document.

var oTextPr; var oParaPr;
var oDocument = Api.GetDocument();                                    
//header Test
var totallength = 0;
console.log("Number of elements oDocument : " + oDocument.GetElementsCount());
for(let i=0;i<oDocument.GetElementsCount();i++)
{
	var ephara=oDocument.GetElement(i);
	var paratext=ephara.GetText();
	var oContentLength = paratext.length;
	 try{
            oFontName = paratext.GetFontNames();
        } catch(error) { 
        }
      
                oRange.AddBookmark("Error at :" +paratext);
				
	console.log("element :" +i  + "oDocument get element:" + paratext);
}
		}totallength += oContentLength;
}

[/quote]

Hello @sanjeevareddy.nagire

Please note that this is quite complicated scenario with ability to display all Content Controls in the document and show them in the plugin panel. I’d recommend contacting us via sales@onlyoffice.com to discuss possibility of detailed analysis of your code.

In general, you can reference data about Content Controls in the document similarly to how it Example work with Content Control plugin does with Get All Content Controls button.


As for the possibility to place text into Content Controls: I’ve replied to you in another post, please see: