Get Started
Usage API
More information

IntersectWith

IntersectWith(oRange) → { ApiRange | null }

Return a new range as the intersection of this range with another range. The current range has not changed. Throws an error if two ranges do not overlap or are not adjacent.

Parameters:

Name Type Description
oRange ApiRange

The range that will be intersected with another range.

Returns:

Type
ApiRange | null

Example

Copy code
builder.CreateFile("docx");
oDocument = Api.GetDocument();
oParagraph = oDocument.GetElement(0);
oParagraph.AddText("Lorem ipsum dolor sit amet,");
oParagraph.AddText(" consectetuer adipiscing elit,");
oParagraph.AddText(" sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.");
oRangeFirst = oDocument.GetRange(0, 49);
oRangeSecond = oDocument.GetRange(22, 123);
oRange = oRangeFirst.IntersectWith(oRangeSecond);
oRange.SetBold(true);
builder.SaveFile("docx", "IntersectWith.docx");
builder.CloseFile();

Resulting document