-
Notifications
You must be signed in to change notification settings - Fork 1
InsertImage
jdubs edited this page Oct 21, 2016
·
1 revision
Assigns an image resource to the supplied image element.
ImageElement (multiple) The image element in the Template. The name property is assigned in the Info tab of the element properties.
Source (multiple) The value determining the image source.
ErrorMessage (multiple | optional) The error message to return when any error occurs.
This method takes the Source variable and locates a matching image in the images folder of the project. If located, that image is assigned to the element identified.
public static void InsertImage(object ImageElement, object Source, object ErrorMessage)
{
Break();
try
{
Image img = (Image)Application.CurrentDocument.FindElement((string)ImageElement);
img.Source = (string)Source;
if (img.SourceResolved == null)
throw new Exception("Image resource not found.");
}
catch (Exception ex)
{
throw new Four51ActionsException(ex.Message, (string)ErrorMessage);
}
}