Get Started
Usage API

Intersect

Intersect(Range1, Range2) → { ApiRange | Error }

Returns a ApiRange object that represents the rectangular intersection of two or more ranges. If one or more ranges from a different worksheet are specified, an error will be returned.

Parameters:

Name Type Description
Range1 ApiRange

The intersecting ranges. At least two Range objects must be specified.

Range2 ApiRange

The intersecting ranges. At least two Range objects must be specified.

Returns:

Type
ApiRange | Error

Example

Copy code
builder.CreateFile("xlsx");
oWorksheet = Api.GetActiveSheet();
oRange1 = oWorksheet.GetRange("A1:C5");
oRange2 = oWorksheet.GetRange("B2:B4");
oRange = Api.Intersect(oRange1, oRange2);
oRange.SetFillColor(Api.CreateColorFromRGB(255, 224, 204));
builder.SaveFile("xlsx", "Intersect.xlsx");
builder.CloseFile();

Resulting document