chenster / php-excel-reader

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

Invalid rowcount / numrows #37

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. On some XLS files with multiple sheets, the rowcount is not valid
2. Read XLS file
3. Dump sheet 2

require_once 'excel_reader2.php';
$data = new Spreadsheet_Excel_Reader("example.xls");
echo $data->dump(true,true, 1);

What is the expected output? What do you see instead?
The attached file as 29 rows in the 2nd sheet, when read it 12579 rows are 
found !

Please provide any additional information below.
Get attached XLS file as sample to reproduce

Original issue reported on code.google.com by j...@comonsoft.com on 20 Jul 2009 at 4:53

Attachments:

GoogleCodeExporter commented 9 years ago
I downloaded your xls file and opened it with excel :

Look at the scrollbar on the right :
- on 1st sheet, it is spreading all over the height and if you scroll it down 
you
reach  line number 26.
- Now, on 2nd sheet, the height of the scrollbar is very small, and if you 
slide it
to the bottom, you reach line 12579 !

Thus, excel reports itself 12579 lines on this sheet !

Solution : delete rows from row number 30 to 12579, then save ;p

Original comment by wilfrid....@gmail.com on 21 Jul 2009 at 10:31

GoogleCodeExporter commented 9 years ago
a small tip: when you are in excel, press Ctrl-End (or End and then Home) and 
the 
excel cursor will move to the last row / last column (bottom right corner) 
that, in 
the 2nd sheet is AH12579.
Cheers

Original comment by vve...@hotmail.it on 28 Jul 2009 at 8:22

GoogleCodeExporter commented 9 years ago
Hi.

 im using this php reader to retrieving data from xls sheet and its works well the xls sheet having 150 records. its limited to 20 records per page to show on result page .there is a search box and button to
search some specific data from the sheet, the search parameter giving the 
result from first 20 Records only. i can't get result from full excel sheet.

i dont understan whats wrong here, y can't search full records on xls sheet.
im expecting some ones help to solve my problem. and the PHP file is blow here 
to download. 
thnxx..

Original comment by tamiln...@gmail.com on 1 Aug 2011 at 2:49

Attachments:

GoogleCodeExporter commented 9 years ago
If you're having issues with rowCount() and numRows displaying ridiculously 
high values, try the following:

    max(count($data->sheets[$sheet]['cells']) - 1, 0);

This assumes your sheets have header rows (If not, remove the "- 1" part), 
$data is your Spreadsheet_Excel_Reader class and your sheet number is stored in 
$sheet.

In all honesty, the lines at 1354 and 1357 in excel_reader2.php should be 
replaced with the above instead of relying on Excel to accurately report the 
number of rows in the sheet...

Original comment by aend...@gmail.com on 3 Aug 2012 at 11:00

GoogleCodeExporter commented 9 years ago
the suggestion to use 
max(count($data->sheets[$sheet]['cells']) - 1, 0);
instead of relying on $data->sheets[0]['numRows'] works.

Original comment by raaqu...@gmail.com on 1 Apr 2013 at 9:40