2.2.4.9.26 DataRange::Intersects

Description

Find if a DataRange intersects another DataRange.

Syntax

BOOL Intersects( DataRange & dr )

Parameters

dr
[input]The other DataRange used to find intersection.

Return

True if two DataRanges are intersected, otherwise false.

Examples

EX1

//assume the active worksheet and has least three columns before run this code.
//Output the result that if one datarange have intersection with anoter datarange.
void DataRange_Intersects_Ex1()
{
	Worksheet wks = Project.ActiveLayer();
	if ( !wks )
	{
		printf("Can not find any active worksheet!");
		return;
	}
	DataRange dr1,dr2;
	BOOL nRet;
	dr1.Add("Range1", wks, 0, 0, -1, 0);
	dr2.Add("Range1", wks, 0, 1, -1, 1);
	nRet = dr1.Intersects(dr2);
	if (nRet)
		out_str("have common area");
	else
		out_str("have no common area");
	dr1.Add("Range2", wks, 0, 2, -1, 2);
	dr2.Add("Range2", wks, 0, 2, -1, 2);
	nRet = dr1.Intersects(dr2);
	if (nRet)
		out_str("have common area");
	else
		out_str("have no common area");
}

Remark

See Also

Header to Include

origin.h