SetStyle

function SetStyle(oStyle: ApiStyle = null): void

Description

The paragraph style base method. This method is not used by itself, as it only forms the basis for the {@link ApiParagraph#SetStyle} method which sets the selected or created style for the paragraph.

Parameters

oStyleApiStyledefault: null

The style of the paragraph to be set.

Returns

void

Try It

var oDocument = Api.GetDocument();
var oHeading6Style = oDocument.GetStyle("Heading 6");
var oParaPr = oHeading6Style.GetParaPr();
oParaPr.SetJc("center");
var oParagraph = oDocument.GetElement(0);
oParagraph.SetStyle(oHeading6Style);
oParagraph.AddText("This is a text in a paragraph styled with the 'Heading 6' style.");

Get Help

  • If you have any questions about ONLYOFFICE Docs, try the FAQ section first.
  • You can request a feature or report a bug by posting an issue on GitHub.
  • You can also ask our developers on ONLYOFFICE forum (registration required).