alfatahnesab / php-excel-reader

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

Custom Number format displaying wrong cell data #114

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Use the attached file and don't open it.   
2. Upload it to server
3. echo $xls->val(3,10); on the attached excel file.

What is the expected output? What do you see instead?
Expected Output: 7.5
See Instead: 8888.88

Please provide any additional information below.
The 10th column has a custom number format of #,##0.00
If I resave the file from my computer it seems to fix the problem. Also if if i 
create a test file with the same custom number format it seems to work just 
fine. For some reason the two columns, "qty" and "wt" don't display correctly 
unless I resave it and then upload. If I create a completely new spreadsheet 
from my computer and use the custom number format it also seems to work but on 
the attached excel file it doesn't. Hope that makes sense since this my first 
post ever about a problem. 

Original issue reported on code.google.com by danielas...@gmail.com on 20 Apr 2011 at 6:24

Attachments:

GoogleCodeExporter commented 8 years ago
I have the same problem, help please

Original comment by compserv...@gmail.com on 14 Jul 2011 at 2:40

GoogleCodeExporter commented 8 years ago
unfortunately, i never figured out how to solve this issue. i'm now using 
http://phpexcel.codeplex.com/

hope that helps. 

Original comment by danielas...@gmail.com on 14 Jul 2011 at 5:02

GoogleCodeExporter commented 8 years ago
Solution:

1. Load the file with formatting ON. ($inventory = new 
Spreadsheet_Excel_Reader('inventory.xls', true);)
2. Retrieve value with raw() instead of val(). raw() is what you see on-screen.
3. Number format to force the display of 2 decimals (7.5 => 7.50)

$inventory = new Spreadsheet_Excel_Reader('inventory.xls', true);
echo number_format($inventory->raw(3, 10), 2);

Original comment by endar...@gmail.com on 17 Jul 2011 at 11:17