jdubs edited this page Oct 21, 2016 · 1 revision

Table of Contents


Locates the supplied paragraph style definition and applies the supplied properties.


ParagraphStyle (multiple) The name of a defined paragraph style in the template.

Font (multiple | optional) The name of a font family. The font must be installed and available to the project.

Alignment (multiple | optional) The alignment of all text in the paragraph. Options: Left, Right, Center, Justify, Force Justify

Size (multiple | optional) The measurement representing the font size.

Italic (multiple | optional) True or false value indicating font property.

Underline (multiple | optional) True or false value indicating font property.

Bold (multiple | optional) True or false value indicating font property.

BaselineShift (multiple | optional) The measurement representing the baseline shift.

Language (multiple | optional) The language use to specify hyphenation.

Color (multiple) The variable containing the color name value. The value must be a defined color in the Template.

ColorType (multiple) Either the name or the value associated for the color definition type. Name = 0, RGB = 1, CMYK = 2.

Definition (multiple | optional) The values for the color definition. Values must be delimited with "-". Preset values for the defined color will be altered for the entire Template. Ex: CMKY = 10-20-10-100.

Tint (multiple | optional) Percentage of the Fill Color to apply to the element (0% - 100%). Default is 100%.

ErrorMessage (multiple | optional) The error message to return when any error occurs.


This method offers multiple possibilities for defining a paragraph style definition in a template. Regardless of method used, a color must be defined in the template. You can use the definition parameter to redefine the values for the color.

Source Code

public static void DefineParagraphStyle(object ParagraphStyle, object Font, object Alignment, object Size, object Italic, object Underline,
	object Bold, object BaselineShift, object Language, object Color, object ColorType, object Definition, object Tint, object ErrorMessage)
		ParagraphStyle chr = Application.CurrentDocument.GetParagraphStyle((string)ParagraphStyle);
		chr.Italic = (string)Italic == String.Empty ? false : Convert.ToBoolean(Italic);
		chr.Underline = (string)Underline == String.Empty ? false : Convert.ToBoolean(Underline);
		chr.Bold = (string)Bold == String.Empty ? false : Convert.ToBoolean(Bold);
		chr.TextTint = (string)Tint == String.Empty ? 100 : N(Tint.ToString().Replace("%", ""));

		if ((string)Alignment != String.Empty)
			uint val;
			object type;

			bool IsNamed = !(UInt32.TryParse(Alignment.ToString(), out val));
			if (IsNamed)
				type = Enum.Parse(typeof(HorizontalAlignment), (string)Alignment, true);
				type = (HorizontalAlignment)Convert.ToUInt32(Alignment);

			chr.Alignment = (HorizontalAlignment)type;

		if ((string)Font != String.Empty)
			chr.FontFamily = Font.ToString();

		if ((string)Size != String.Empty)
			chr.FontSize = Size.ToString().ToLower();

		if ((string)BaselineShift != String.Empty)
			chr.BaselineShift = BaselineShift.ToString().ToLower();

		if ((string)Language != String.Empty)
			chr.Language = (Pageflex.Scripting.Language)Language;

		if ((string)ColorType != String.Empty)
			chr.TextColor = DefinedColor(Color, ColorType, Definition);
	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.