wp.setJustification

Syntax wp.setJustification (value)

Params value is a number between 1 and 4 whose meaning is defined under "Action," below.

Action Sets the justification of the selection in the target window in accordance with the content of value :

1 = left justification

2 = centered

3 = right justification

4 = full justification (flush)

If the selection is empty, this verb applies to the entire paragraph in which the cursor appears.

Returns True

Examples edit (@examples.testText2);
wp.setSelect (0, 0); « sets cursor in upper left corner, selection empty
wp.setJustification (2)

   » true

Notice that the first paragraph is now centered and that the icon indicating centered text in the ruler (if the ruler is visible) is highlighted.

edit (@examples.testText2);
wp.setSelect (140, 140); // sets cursor at start of second paragraph
wp.setRightMargin (216); // so you can see justification change
wp.setJustification (3)

   » true

Notice that the text in the second paragraph is now flush with the right margin but not with the left. Now type and execute:
wp.setJustification (4)


   » true

Notice that the text in the second paragraph is now flush at both left and right margins.

Errors Entering a number outside the valid range of 1-4 returns false but is not an error.

Discuss