SetSelectionParagraphStyle()

Example 1:

In this example, the second paragraph of a Text object named IntroText is set to have a left justification and a bullet point. A new object named newStyle is created that contains the new styles you want to set for IntroText

ParaNum = IntroText.ParagraphIndex(0);
ParaLength = IntroText.ParagraphLength(0);
IntroText.SetSelection(ParaNum,ParaLength);
var newStyle = new Object();
newStyle.justification = "Centre";
newStyle.bullet.type = "Character";
newStyle.bullet.character = "a";
newStyle.bullet.font = "WingDings";
newStyle.bullet.colour = RGB(255,128,64);
IntroText.SetSelectionParagraphStyle(newStyle);

Example 2:

In this example, the second paragraph of a Text object named MoreInfo is set to the same paragraph style as the first paragraph in the Text object named IntroText

ParaNum = IntroText.ParagraphIndex(0);
ParaLength = IntroText.ParagraphLength(0);
IntroText.SetSelection(ParaNum,ParaLength);
var paraInfo = IntroText.GetSelectionParagraphStyle();
ParaNum = MoreInfo.ParagraphIndex(1);
ParaLength = MoreInfo.ParagraphLength(1);
MoreInfo.SetSelection(ParaNum,ParaLength);
MoreInfo.SetSelectionParagraphStyle(paraInfo);

Note:
In Example 1, a new object was created in OpusScript and the style you required added to it. In Example 2, an existing Text object on the current page of a publication was used to copy a paragraph style and apply it to another Text object.

 

see also:GetSelectionParagraphStyle, ParagraphIndex, ParagraphLength, GetSelectionStyle, SetSelectionStyle and SetSelection

Close