How interesting. Thanks for your reply. What you said makes sense and I
don't know why I missed it (the OBJ record) so many times.

(My copy of the Excel Developers guide is electronic, and in HTML. The page
that describes the OBJ record is mysteriously truncated). But there is
enough there to interpret:

>-BEGIN DUMP---------------------------------
>00000000 15 00 12 00 08 00 01 00 11 60 00 00 00 00 00 07 .........`......
>00000010 DC 00 00 00 00 00 07 00 02 00 FF FF 08 00 02 00 ................
>00000020 01 00 00 00 00 00                               ......

15 00 = sub type 0x15, Common Object Data
12 00 = length 18 bytes
08 00 = Object Type 0008 (Picture)
01 00 = Object ID 0001
60 11 = Object Flags (Auto-Line, Auto-Fill, Printable, Locked)
00 00 00 00 00 07 DC 00 00 00 00 00 = should be 0 according to Excel 97
developers guide

07 00 = sub type 0x07, Clipboard Format
02 00 = length 2 bytes
FF FF = private format

08 00 = sub type 0x08, Picture Option Flags
02 00 = length 2 bytes
01 00 = Flags (?) Excel 97 Developers Guide says reserved

00 00 = sub type 0x00, End
00 00 = length 0 bytes

The first sub record makes particular sense, because Excel shows a name of
'Picture 1' when the picture is selected. None of the stuff inside the
Escher objects corresponded to this, especially when you add, group, and
delete objects.

So there are still some small details I don't understand - What is the
meaning of Flags in sub type 08, What is the meaning of the 07 DC bytes in
the Common sub type which should be all 00 according to the developer's
guide.

About submitting my stuff as a patch: I would except for these things:

1) According to my reading of this list, a committer is working on it, and
will be released soon.

2) It's *way* more than just a patch. Nearly 50 new classes in an entirely
new package, plus a dozen or so changed and new classes inside HSSF. And
almost as many Junit test cases.

3) Even so, it isn't really integrated with HSSF, because of the problems I
am having with using RecordFactory. The drawing structure is split across
many BIFF records, which are not necessarily contiguous. RecordFactory
builds separate objects for each BIFF record (unless it's a CONTINUE record,
which is never used in these drawing records as far as I know).

So how can you implement an MsoDrawingRecord object? RecordFactory will
return a List of objects, but each MsoDrawing object will only have one
branch of the tree. To alter the drawing structure, you need to walk the
entire tree. For example, when you create new objects, a new Shape ID is
created, whose value depends on Shape Ids already assigned. When you Group
or Ungroup objects, you collapse or split nodes in the tree.

I suppose the best way would be to add some class to WorkSheet, which would
scan the List returned by RecordFactory, and assemble all the drawing
records into one structure that can be manipulated. Or just hack up
RecordFactory to treat the drawing records somehow similar to the CONTINUE
records.

I chose instead to wait and see how this was actually to be implemented by
the committers.

The only thing my package does do that is somewhat useful are the extensions
to BiffViewer, which produce output of the drawing records in a indented
format which corresponds to the hierarchy, like I showed in my original
message below. The package understands a good chunk of the record types,
such as lines and arrows, rectangles and ovals, autoshapes, call-out
diagrams, 3 D objects, connectors, etc. It also understands how to group and
ungroup. I haven't tried yet, but I believe it would extend easily to work
with Power Point.

-----Original Message-----
From: Glen Stampoultzis [mailto:[EMAIL PROTECTED]
Sent: Wednesday, December 03, 2003 10:35 PM
To: POI Users List
Subject: RE: Including images in Excel sheet

At 01:11 PM 4/12/2003, you wrote:
>I am curious if you have deciphered the meaning of the 0x5d BIFF record
that
>occurs between MSODRAWING records. It does not seem to be an anchor. If you
>know, I would appreciate comments.
>
>Here is an example from my enhanced version of BiffViewer.
>
>============================================
>Offset 0x1044 (4164)
>rectype = 0xec, recsize = 0xdc
>-BEGIN DUMP---------------------------------
>00000000 0F 00 02 F0 D4 00 00 00 10 00 08 F0 08 00 00 00 ................
>00000010 02 00 00 00 01 04 00 00 0F 00 03 F0 BC 00 00 00 ................
>00000020 0F 00 04 F0 28 00 00 00 01 00 09 F0 10 00 00 00 ....(...........
>00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
>00000040 02 00 0A F0 08 00 00 00 00 04 00 00 05 00 00 00 ................
>00000050 0F 00 04 F0 84 00 00 00 B2 04 0A F0 08 00 00 00 ................
>00000060 01 04 00 00 00 0A 00 00 43 00 0B F0 4A 00 00 00 ........C...J...
>00000070 04 41 01 00 00 00 05 C1 32 00 00 00 BF 01 00 00 .A......2.......
>00000080 01 00 BF 03 00 00 08 00 44 00 3A 00 5C 00 42 00 ........D.:.\.B.
>00000090 41 00 53 00 49 00 53 00 5C 00 47 00 4D 00 4C 00 A.S.I.S.\.G.M.L.
>000000A0 5C 00 46 00 4D 00 55 00 5F 00 47 00 30 00 31 00 \.F.M.U._.G.0.1.
>000000B0 2E 00 42 00 4D 00 50 00 00 00 00 00 10 F0 12 00 ..B.M.P.........
>000000C0 00 00 02 00 00 00 00 00 00 00 00 00 04 00 40 00 [EMAIL PROTECTED]
>000000D0 10 00 5A 00 00 00 11 F0 00 00 00 00             ..Z.........
>-END DUMP-----------------------------------
>recordid = 0xec, size =220
>  [MSODRAWING]
>Drawing Container n=0
>   Drawing Atom v=0 (f008) Drawing ID=1
>     Number of Shapes: 2
>     Last Assigned Shape ID: 1:1
>   Shape Group Container (f003) n=0
>     Shape Container n=0
>       DrawingShapeGroup Atom v=1 n=0
>         Boundary: (0,0)-(0,0)
>       Shape v=2 (f00a) Primitive
>         ShapeId: 1:0
>         Flags: Group, Patriarch
>     Shape Container n=0
>       Shape v=2 (f00a) Picture Frame
>         ShapeId: 1:1
>         Flags: Anchored, Has Property
>       Property Table Atom (f00b) v=3, 4 properties
>         Property Table
>           BLIP (260): 1
>           BLIP File Name (261): D:\IMAGES\FMU_G01.BMP
>           [f]Fill Flags (447): 65536
>           Unknown Property (959): 524288
>       Client Anchor Atom v=0 (f010) n=0
>         Binary Data
>           02 00 00 00 00 00 00 00 00 00 04 00 40 00 10 00
>           5A 00
>[/MSODRAWING]
>
>============================================
>Offset 0x1124 (4388)
>rectype = 0x5d, recsize = 0x26
>-BEGIN DUMP---------------------------------
>00000000 15 00 12 00 08 00 01 00 11 60 00 00 00 00 00 07 .........`......
>00000010 DC 00 00 00 00 00 07 00 02 00 FF FF 08 00 02 00 ................
>00000020 01 00 00 00 00 00                               ......
>-END DUMP-----------------------------------
>recordid = 0x5d, size =38
>[UNKNOWN RECORD:5d]
>     .id        = 5d
>[/UNKNOWN RECORD]
>
>The Client Anchor Atom above is the anchor which describes how the drawing
>is positioned, and is interpreted outside of the Escher object. The 0x5d
>record follows immediately, and I haven't got a clue about how to build it.

That an OBJ record.  The Excel 97 Developers Guide describes how to create
this record.

>Also, how does your library deal with the MSODRAWING records, which are
>scattered throughout the worksheet? Neither MSODRAWING nor MSODRAWINGGROUP
>uses CONTINUE records like the rest of Excel.

This puzzled me for a long time.  I ended up aggregating them together
before attempting to decode the hierarchy.  When serializing them back out
again I had to be careful to chop the hierarchy back up at the right spots.

>I too had (actually have) a package that does drawings. The drawing part
>(contents of MSODRAWING and MSODRAWINGGROUP records) are completely worked
>out, except for these unknown BIF records, and the compression of BLIP
>structures. I can build the Escher side of the MSODRAWING structure with
>various kinds of shapes and properties, including PNG images
(uncompressed).

I've implemented BLIP compression and decompression (it's not too
hard).  What I haven't done is provide a high level API for that bit yet.

>However, I also cannot release just yet. I'm not even a committer. And I
>thought the committers were about to release something, so I stopped work
on
>the Excel interface. My main interest was getting it to work with Microsoft
>Project.

I'm a committer was planning on releasing this sooner but unfortunately
it's paid work and the payment hasn't been finalized yet.

You don't need to be a committer to develop POI.  Just submit a patch and
if everything is okay one of the committers will load it into CVS for you.

The stuff I have is a little bit tied to Excel but could be made more
generic without too much effort.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to