DataRange::IsEmpty

Description

Check DataRange is valid or all the subranges are empty

Syntax

BOOL IsEmpty( )

Parameters

Return

TRUE if DataRange is invalid or all the subranges are empty, FALSE otherwise

Examples

EX1

//Check if the datarange is invalid or is empty.
void DataRange_IsEmpty_Ex1()
{
    Worksheet wks;
    wks.Create("Origin");
    if( wks )
    {
        while(wks.Columns(0))
            wks.DeleteCol(0);

        wks.AddCol("A");
        wks.AddCol("B");
        wks.AddCol("C");
  
        DataRange dr;
        // dr does not include any subrange, bValid = TRUE, 
        bool bValid = dr.IsEmpty();
        
        dr.Create();
        dr.Add();
        // dr includes a empty subrange, bValid = TRUE
        bValid = dr.IsEmpty();
        
        // dr includes a non-empty subrange and a empty subrange, bValid = FALSE 
        dr.Add("X", wks, 1, 1, 4, 2 );
        bValid = dr.IsEmpty();
      }
}

Remark

See Also

DataRange::GetNumRanges

header to Included

origin.h