How replace contentcontrol content

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:
DocumentBuilder version: 7.5
Installation method: windows install
OS: win11 21h2

I have tried before and the effect is not very stable

const oDocument = Api.GetDocument();
const aContentControls = oDocument.GetAllContentControls();

const fistControl = aContentControls[0];
const removeElements = [];

for (var i = 0; i < fistControl.GetElementsCount(); i++) {
    const el = fistControl.GetElement(i);
    if (el.GetText()) {

removeElements.forEach((el) => el.Delete())

fistControl.AddText("New content");

builder.SaveFile("docx", "../test.docx");

nother question is how can I insert HTML content into a document? I couldn’t find the relevant API for the onlyOffice builder

Hi @huzedong2022

Are you referring to this API method?

Regarding your main question, could you provide more details on what you are trying to achieve?

I want to use onlyoffice builder to modify the content of the first control to: “<p style='font-size:12pt'>test</p>” (similar to pastHTML), but I did not find the relevant API

To implement the steps for inserting and modifying the CC font, follow the instructions below:

  1. Retrieve all CC (content controls) from the document.
  2. Select the first.
  3. Obtain the content using the Get Content API.
  4. Set the desired font for each existing element.

If you encounter any specific challenges or have a code snippet or request example you are working with, feel free to share it.