Set the content control highlight color

Good day all,

Is it possible to set content control highlight settings via document builder?

Hello @r4gie ,
Looks like, this is a missing method.
We will be looking for implementing this method in the future, but now, we have registered the issue by number №58818

1 Like

Hi, having the same trouble. any update on this point.
Best regards

Hello @amed.lam

You can set highlight as text properties for content inside the content control with SetTextPr.

Hello @Constantine,

Thank you for your prompt response. Unfortunately, the two methods do not behave the same way. For instance, when we export the document to PDF, the highlights applied via the UI disappear, while those set with setTextPr are preserved. The goal of the native highlight feature is to gracefully emphasize content controls without affecting the printing or export process.

Try using SetBackgroundColor for specified Content Control in latest version. For instance:

var oDocument = Api.GetDocument();
var oBlockLvlSdt = Api.CreateBlockLvlSdt();
oBlockLvlSdt.GetContent().GetElement(0).AddText("Some text");
oDocument.AddElement(0, oBlockLvlSdt);
oBlockLvlSdt.SetBackgroundColor(111, 0, 0)