2.1.7.9 okoc_compare_obj_ranges


Description

Compare two range strings and check to see if they resolved into same object

Syntax

int okoc_compare_obj_ranges( LPCSTR lpcszRange1, LPCSTR lpcszRange2, BOOL bIgnoreRowRange = true )

Parameters

lpcszRange1
[input] range in the form of [page]layer!obj with or without [r1:r2]
lpcszRange2
[input] range in the form of [page]layer!obj with or without [r1:r2]
bIgnoreRowRange
[input] true will ignore [r1:r2] so even if two ranges are having diff row range will still return 0

Return

0 if two ranges are from the same object, -1 if lpcszRange1 is not valid, -2 if lpcszRange2 not valid, otherwise one of the > 0 enum like COR_DIFF_SHEET

Examples

EX1

#include <okocutils.h> // not included in origin.h, so you must add this
void okoc_compare_obj_ranges_ex1()
{
	Worksheet wks;
	wks.Create("Origin");	
	DataRange dr1;
	dr1.Add(wks, 0, "X"); 
	
	Worksheet wks2;
	wks2.Create("Origin");	
	DataRange dr2;			
	dr2.Add(wks2, 0, "X");
	
	string strDR1, strDR2;
	dr1.GetRangeString(strDR1);
	dr2.GetRangeString(strDR2);
	
	bool ignoreRrows = true;
	int nRet = okoc_compare_obj_ranges(strDR1, strDR2, ignoreRrows);
	out_int("", nRet); // output 2 (COR_DIFF_SHEET)	
}

Remark

See Also

Header to Include

okocUtils.h

Reference