This function is optimized for memory usage, but the script takes more times to be completely executed and to parse the selected data. Use with large files.
This function is not optimized for memory usage, but the script takes less times to be completely executed and to parse the selected data. Use when parsing speed is critical (PHP memory limit can be exceed for huge files and script will terminate!).
IN: string contents - File contents string filename - File name of an existing Excel file.
Tags:
return:
0 - success
- can't open file
- file too small to be an Excel file
- error reading header
- error reading file
- This is not an Excel file or file stored in < Excel 5.0
An RK value is an encoded integer or floating-point value. RK values have a size of 4 bytes and are used to decrease filesize for floating-point values.
Bit Mask Contents
00000001H 0 = Value not changed 1 = Value is multiplied by 100
00000002H 0 = Floating-point value 1 = Signed integer value
31-2 FFFFFFFCH Encoded value If bit 1 is cleared, the encoded value represents the 30 most significant bits of an IEEE 754 floating-point value (64-bit double precision). The 34 least significant bits must be set to zero. If bit 1 is set, the encoded value represents a signed 30-bit integer value. To get the correct integer, the encoded value has to be shifted right arithmetically by 2 bits. If bit is set, the decoded value (both integer and floating-point) must be divided by 100 to get the final result.
Examples: RK value Type Div 100 Encoded value Decoded value Result 3FF00000H float no 3FF00000H 3FF0000000000000H = 1.0 1.0 3FF00001H float yes 3FF00000H 3FF0000000000000H = 1.0 0.01 004B5646H integer no 004B5644H 0012D591H = 1234321 1234321 004B5647H integer yes 004B5644H 0012D591H = 1234321 12343.21