GetSections

function GetSections(): ApiSection[]

Description

Returns a collection of section objects in the document.

Returns

ApiSection[]

Try It

var oDocument = Api.GetDocument();
var oParagraph = oDocument.GetElement(0);
oParagraph.AddText("This is a new paragraph.");
oParagraph.AddLineBreak();
oParagraph.AddText("Scroll down to see the new section.");
var oSection1 = oDocument.CreateSection(oParagraph);
oParagraph = Api.CreateParagraph();
oParagraph.AddText("This is a paragraph in a new section");
oDocument.Push(oParagraph);
var aSections = oDocument.GetSections();
oParagraph = Api.CreateParagraph();
var sClassType = aSections[1].GetClassType();
oParagraph.AddText("Class type: " + sClassType);
oDocument.Push(oParagraph);

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).