InsertImage

jdubs edited this page Oct 21, 2016 · 1 revision

Table of Contents

Overview

Assigns an image resource to the supplied image element.

Parameters

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.

Synopsis

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.

Source Code

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);
	}
}

Referenced Methods

Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.