Prev Defined |
ExcelExplorer Manual |
Next DefinedArea |
 |
(ExcelExplorer 4.0)
Returns whether worksheet exists and contains any data or not.
boolean IsEmpty( )
Parameters
- None
Description
Returns TRUE for undefined worksheets. Also returns TRUE for defined worksheets that contains no data.
Otherwise returns FALSE.
- The worksheet is considered empty if it undefined (not stored in Excel file).
- The worksheet is considered empty if it defined but have no data.
Note the difference to the EEWorksheet->Defined() method.
Is worksheet have any data?
<?php
// prints 'Non-empty' if 6th worksheet exists and contains some data, 'Empty' otherwise
echo $ee->Worksheet(5)->IsEmpty() ? 'Empty' : 'Non-empty';
// prints 'Non-empty' for all worksheets that is defined and contains some data,
// 'Empty' for all worksheets that is defined and contains no data, and
// 'Empty' for last 5 worksheets (note $n+5 in the loop)
$n = $ee->WorksheetsNum();
for( $i=0; $i < $n+5; $i++ ) {
echo ($i+1).' - ';
echo $ee->Worksheet($i)->IsEmpty() ? 'Empty' : 'Non-empty';
echo "\n";
}
?>
|