[Bug 55786] FILEOPEN: read error for unsupported Lotus123 .wk3, .wk4

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Tue Nov 4 19:06:24 PST 2014


https://bugs.freedesktop.org/show_bug.cgi?id=55786

Thomas Kluyver <thomas at kluyver.me.uk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |thomas at kluyver.me.uk

--- Comment #13 from Thomas Kluyver <thomas at kluyver.me.uk> ---
I had to spend a while digging into an old WK4 file to extract some data. I
thought I'd document my main finding here:

opcode 0x17 appears to be a 10-byte extended precision float. After the record
header, there is a two byte row number, one byte sheet number, and one byte
column number. These are common to a few record types. The remainder of it is
the value, in the format described here:

http://en.wikipedia.org/wiki/Extended_precision#x86_Extended_Precision_Format

I was able to extract these, at least for the small positive numbers in my
sample, using the following Python code:

        a = int.from_bytes(r.data[-2:], 'little')
        sign = -1 if (a & (1<<15)) else 1
        e = a - (a & (1 << 15)) - 16383
        m = int.from_bytes(r.data[4:-2], 'little')
        val = m / (1<<(63-e))

0x16 is a label, with the same row/sheet/column fields.

I started looking into making a patch, but I got confused because there appear
to be opcode lookup tables both in optab.cxx and as switch statements in
lotread.cxx, with different opcodes in them.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20141105/2a930d7d/attachment.html>


More information about the LibreOffice mailing list