I’m merging values into plain text controls to create documents. Is it possible to use an Image control the same way to dynamically import images into documents? For example adding a customer signature image to a document? I’ve seen examples adding images into new sections, but I need them to be specifically placed and sized to a location.
Hi Vince,
Try this:
var document = DocumentModel.Load("input.docx");
foreach (var contentControl in document.GetChildElements(true)
.OfType<IContentControl>()
.Where(cc => cc.ContentControlType == ContentControlType.Picture))
{
var picture = new Picture(document, "image.png");
contentControl.Content.Set(picture.Content);
contentControl.Properties.IsShowingPlaceholderText = false;
}
document.Save("output.docx");
Does this solve your issue?
Regards,
Mario
Works perfectly - thanks!