ApiParagraph

class ApiParagraph extends ApiParaPr

Description

Class representing a paragraph.

Instance Methods

GetClassType(): paragraph

Returns a type of the ApiParagraph class.

AddText(sText): ApiRun

Adds some text to the current paragraph.

AddPageBreak(): ApiRun

Adds a page break and starts the next element from the next page.

AddLineBreak(): ApiRun

Adds a line break to the current position and starts the next element from a new line.

AddColumnBreak(): ApiRun

Adds a column break to the current position and starts the next element from a new column.

AddPageNumber(): ApiRun

Inserts a number of the current document page into the paragraph.

AddPagesCount(): ApiRun

Inserts a number of pages in the current document into the paragraph.

GetParagraphMarkTextPr(): ApiTextPr

R.

GetParaPr(): ApiParaPr

Returns the paragraph properties.

GetNumbering(): ApiNumberingLevel

Returns the numbering definition and numbering level for the numbered list.

SetNumbering(oNumberingLevel)

Specifies that the current paragraph references the numbering definition instance in the current document.

GetElementsCount(): number

Returns a number of elements in the current paragraph.

GetElement(nPos): ParagraphContent

Returns a paragraph element using the position specified.

RemoveElement(nPos)

R.

RemoveAllElements()

R.

Delete(): boolean

Deletes the current paragraph.

GetNext(): ApiParagraph | "null"

Returns the next paragraph.

GetPrevious(): ApiParagraph

Returns the previous paragraph.

Copy(): ApiParagraph

C.

AddElement(oElement, nPos): boolean

Adds an element to the current paragraph.

AddTabStop(): ApiRun

Adds a tab stop to the current paragraph.

AddDrawing(oDrawing): ApiRun

Adds a drawing object (image, shape or chart) to the current paragraph.

AddInlineLvlSdt(oSdt): ApiInlineLvlSdt

Adds an inline container.

AddComment(sText, sAuthor, sUserId): ApiComment

A.

AddHyperlink(sLink, sScreenTipText): ApiHyperlink | "null"

Adds a hyperlink to a paragraph.

GetRange(Start, End): ApiRange

Returns a Range object that represents the part of the document contained in the specified paragraph.

Push(oElement): boolean

Adds an element to the current paragraph.

GetLastRunWithText(): ApiRun

Returns the last Run with text in the current paragraph.

SetBold(isBold): ApiParagraph

Sets the bold property to the text character.

SetCaps(isCaps): ApiParagraph

Specifies that any lowercase characters in this paragraph are formatted for display only as their capital letter character equivalents.

SetColor(r, g, b, isAuto): ApiParagraph

Sets the text color to the current paragraph in the RGB format.

SetDoubleStrikeout(isDoubleStrikeout): ApiParagraph

Specifies that the contents of this paragraph are displayed with two horizontal lines through each character displayed on the line.

SetFontFamily(sFontFamily): ApiParagraph

Sets all 4 font slots with the specified font family.

GetFontNames(): string[]

Returns all font names from all elements inside the current paragraph.

SetFontSize(nSize): ApiParagraph

Sets the font size to the characters of the current paragraph.

SetHighlight(sColor): ApiParagraph

Specifies a highlighting color which is applied as a background to the contents of the current paragraph.

SetItalic(isItalic): ApiParagraph

Sets the italic property to the text character.

SetPosition(nPosition): ApiParagraph

Specifies an amount by which text is raised or lowered for this paragraph in relation to the default baseline of the surrounding non-positioned text.

SetSmallCaps(isSmallCaps): ApiParagraph

Specifies that all the small letter characters in this paragraph are formatted for display only as their capital letter character equivalents which are two points smaller than the actual font size specified for this text.

SetSpacing(nSpacing): ApiParagraph

Sets the text spacing measured in twentieths of a point.

SetStrikeout(isStrikeout): ApiParagraph

Specifies that the contents of this paragraph are displayed with a single horizontal line through the center of the line.

SetUnderline(isUnderline): ApiParagraph

Specifies that the contents of this paragraph are displayed along with a line appearing directly below the character (less than all the spacing above and below the characters on the line).

SetVertAlign(sType): ApiParagraph | "null"

Specifies the alignment which will be applied to the contents of this paragraph in relation to the default appearance of the paragraph text: "baseline" .

Last(): ParagraphContent

Returns the last element of the paragraph which is not empty.

GetAllContentControls(): ApiInlineLvlSdt[]

Returns a collection of content control objects in the paragraph.

GetAllDrawingObjects(): ApiDrawing[]

Returns a collection of drawing objects in the paragraph.

GetAllShapes(): ApiShape[]

Returns a collection of shape objects in the paragraph.

GetAllImages(): ApiImage[]

Returns a collection of image objects in the paragraph.

GetAllCharts(): ApiChart[]

Returns a collection of chart objects in the paragraph.

GetAllOleObjects(): ApiOleObject[]

Returns a collection of OLE objects in the paragraph.

GetParentContentControl(): ApiBlockLvlSdt | "null"

Returns a content control that contains the current paragraph.

GetParentTable(): ApiTable | "null"

Returns a table that contains the current paragraph.

GetParentTableCell(): ApiTableCell | "null"

Returns a table cell that contains the current paragraph.

GetText(oPr, oPr.Numbering, oPr.Math, oPr.NewLineSeparator, oPr.TabSymbol): string

Returns the paragraph text.

GetTextPr(): ApiTextPr

Returns the paragraph text properties.

SetTextPr(oTextPr): boolean

Sets the paragraph text properties.

InsertInContentControl(nType): ApiParagraph | ApiBlockLvlSdt

Wraps the paragraph object with a rich text content control.

InsertParagraph(paragraph, sPosition, beRNewPara): ApiParagraph | "null"

Inserts a paragraph at the specified position.

Select(): boolean

Selects the current paragraph.

Search(sText, isMatchCase): ApiRange[]

S.

WrapInMailMergeField()

Wraps the paragraph content in a mail merge field.

AddNumberedCrossRef(sRefType, oParaTo, bLink, bAboveBelow, sSepWith): boolean

A.

AddHeadingCrossRef(sRefType, oParaTo, bLink, bAboveBelow): boolean

A.

AddBookmarkCrossRef(sRefTo, sBookmarkName, bLink, bAboveBelow, sSepWith): boolean

A.

AddFootnoteCrossRef(sRefType, oParaTo, bLink, bAboveBelow): boolean

A.

AddEndnoteCrossRef(sRefType, oParaTo, bLink, bAboveBelow): boolean

A.

AddCaptionCrossRef(sCaption, sRefType, oParaTo, bLink, bAboveBelow): boolean

A.

ToJSON(bWriteNumberings, bWriteStyles): JSON

Converts the ApiParagraph object into the JSON object.

GetPosInParent(): Number

Returns the paragraph position within its parent element.

ReplaceByElement(oElement): boolean

Replaces the current paragraph with a new element.

AddCaption(sAdditional, sLabel, bExludeLabel, sNumberingFormat, bBefore, nHeadingLvl, sCaptionSep): boolean

A.

GetSection(): ApiSection

Returns the paragraph section.

SetSection(oSection): boolean

Sets the specified section to the current paragraph.

SetStyle(oStyle)

T.

GetStyle()

Returns the paragraph style method.

SetContextualSpacing(isContextualSpacing)

Specifies that any space before or after this paragraph set using the {@link ApiParaPr#SetSpacingBefore} or {@link ApiParaPr#SetSpacingAfter} spacing element, should not be applied when the preceding and following paragraphs are of the same paragraph style, affecting the top and bottom spacing respectively.

SetIndLeft(nValue)

Sets the paragraph left side indentation.

GetIndLeft()

Returns the paragraph left side indentation.

SetIndRight(nValue)

Sets the paragraph right side indentation.

GetIndRight()

Returns the paragraph right side indentation.

SetIndFirstLine(nValue)

Sets the paragraph first line indentation.

GetIndFirstLine()

Returns the paragraph first line indentation.

SetJc(sJc)

Sets the paragraph contents justification.

GetJc()

Returns the paragraph contents justification.

SetKeepLines(isKeepLines)

Specifies that when rendering the document using a page view, all lines of the current paragraph are maintained on a single page whenever possible.

SetKeepNext(isKeepNext)

Specifies that when rendering the document using a paginated view, the contents of the current paragraph are at least partly rendered on the same page as the following paragraph whenever possible.

SetPageBreakBefore(isPageBreakBefore)

Specifies that when rendering the document using a paginated view, the contents of the current paragraph are rendered at the beginning of a new page in the document.

SetSpacingLine(nLine, sLineRule)

S.

GetSpacingLineValue()

Returns the paragraph line spacing value.

GetSpacingLineRule()

Returns the paragraph line spacing rule.

SetSpacingBefore(nBefore, isBeforeAuto)

S.

GetSpacingBefore()

Returns the spacing before value of the current paragraph.

SetSpacingAfter(nAfter, isAfterAuto)

S.

GetSpacingAfter()

Returns the spacing after value of the current paragraph.

SetShd(sType, r, g, b, isAuto)

Specifies the shading applied to the contents of the paragraph.

GetShd()

Returns the shading applied to the contents of the paragraph.

SetBottomBorder(sType, nSize, nSpace, r, g, b)

S.

SetLeftBorder(sType, nSize, nSpace, r, g, b)

Specifies the border which will be displayed at the left side of the page around the specified paragraph.

SetRightBorder(sType, nSize, nSpace, r, g, b)

Specifies the border which will be displayed at the right side of the page around the specified paragraph.

SetTopBorder(sType, nSize, nSpace, r, g, b)

S.

SetBetweenBorder(sType, nSize, nSpace, r, g, b)

Specifies the border which will be displayed between each paragraph in a set of paragraphs which have the same set of paragraph border settings.

SetWidowControl(isWidowControl)

Specifies whether a single line of the current paragraph will be displayed on a separate page from the remaining content at display time by moving the line onto the following page.

SetTabs(aPos, aVal)

S.

SetNumPr(oNumPr, nLvl)

Specifies that the current paragraph references a numbering definition instance in the current document.

SetOutlineLvl(nLvl)

Sets the outline level for the specified properties.

GetOutlineLvl()

Gets the outline level of the specified properties.

Extends

ApiParaPr

Class representing the paragraph properties.

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