GetStyle

function GetStyle(sStyleName: string = null): ApiStyle

Description

Returns a style by its name.

Parameters

sStyleNamestringdefault: null

The style name.

Returns

ApiStyle

Try It

var oDocument = Api.GetDocument();
var oNoSpacingStyle = oDocument.GetStyle("Heading 6");
var oParagraph = oDocument.GetElement(0);
oParagraph.SetStyle(oNoSpacingStyle);
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).