kasimbadami / php-excel-reader

Automatically exported from code.google.com/p/php-excel-reader
0 stars 0 forks source link

how many sheets in a XLS file? #94

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I don't find a way to get the number of sheets in a XLS file accroding to the 
excel-reader api,but there is a simple way to finish it.

we can use the function rowcount($sheet=0) to finish it.

The code just like the follow,and it works well.Put it in the Class 
Spreadsheet_Excel_Reader.
//////////////////Code here

    function countSheets()
    {
        $i = 0;
        while(1)
        {
            if($this->rowcount($i) > 0)
            {
                $i++;
            }
            else
            {
                break;
            }
        }
        return $i;
    }

Original issue reported on code.google.com by xiaoLin3...@gmail.com on 17 Oct 2010 at 5:50