Hi, I am able to find items in my document that are ContentControlType.PlainText but I need to know how I actually go about setting the text that is stored in that, i.e.:
Many thanks
Peter
Hi, I am able to find items in my document that are ContentControlType.PlainText but I need to know how I actually go about setting the text that is stored in that, i.e.:
Many thanks
Peter
Hi Peter,
Try the following:
var document = DocumentModel.Load("input.docx");
var blockContentControl = document.GetChildElements(true, ElementType.BlockContentControl)
.Cast<BlockContentControl>()
.First(bcc => bcc.Properties.Title == "productType" &&
bcc.ContentControlType == ContentControlType.PlainText);
blockContentControl.Blocks.Clear();
blockContentControl.Blocks.Add(
new Paragraph(document,
new Run(document, "Sample text.")));
document.Save("output.docx");
Also, please check the Content Controls examples.
Let me know if you need anything else.
Regards,
Mario