poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Zalewski <zalew...@optonline.net>
Subject RE: Excel charts [Long]
Date Fri, 09 Jan 2004 01:19:18 GMT
Andrew C. Oliver wrote:
> You are wrong about drawing.  Actually it looks like most of the records
> require for charting are there.  Just someone needs to create a high level
> API and low level model for putting them together.

Here are some reasons why I think I am not wrong:

1. You can manipulate Excel Charts the same as other MS Office Drawing
shapes. Try the following:

- Open a new workbook in Excel
- Add a simple chart
- Make the drawing toolbar visible (View | Toolbars | Drawing)
- Add any other drawing shape, such as a rectangle.
- Select both the chart and the rectangle (Hold Shift down, click on the
chart, then click on the rectangle). Note that both objects are selectable.
- You can perform drawing commands, such as grouping, ungrouping, bring to
front or back, resize, etc. You can lock the position of a chart, hide it
from printing, etc in the same way as any other escher shape.

It appears that charts are just another type of office drawing shape.

======

2. The POI website seems to suggest that charts are part of Office Drawings.
Check out http://jakarta.apache.org/poi/hssf/chart.html

That page shows a binary dump of a simple Excel file with an embedded chart.
The very first record shown on that page is a MSODRAWING record, not
implemented in HSSF. MSODRAWING records do not appear in the file unless
drawings are activated.

You cannot completely interpret an MSODRAWING record without the prior
MSODRAWINGGROUP record, which is not shown on that page.

======

3. I have developed an enhanced version of BiffViewer, which shows the
Escher structure of the drawing inside each sheet. When I make a simple
worksheet with a simple chart (no other drawing object), I get the
following:

...

Offset 0x5d0 (1488)
rectype = 0xeb, recsize = 0x5a
-BEGIN DUMP---------------------------------
00000000 0F 00 00 F0 52 00 00 00 00 00 06 F0 18 00 00 00 ....R...........
00000010 02 04 00 00 02 00 00 00 02 00 00 00 01 00 00 00 ................
00000020 01 00 00 00 02 00 00 00 33 00 0B F0 12 00 00 00 ........3.......
00000030 BF 00 08 00 08 00 81 01 09 00 00 08 C0 01 40 00 ..............@.
00000040 00 08 40 00 1E F1 10 00 00 00 0D 00 00 08 0C 00 ..@.............
00000050 00 08 17 00 00 08 F7 00 00 10                   ..........
-END DUMP-----------------------------------
[MSODRAWINGGROUP]
DrawingGroup Container n=0
  DrawingGroup Atom (f006) v=0 n=0 [24 bytes]
    Maximum Shape ID: 1:2
    Number of ID Clusters: 2
    Number of Shapes Saved: 2
    Number of Drawings Saved: 1
    Drawing ID Clusters
      02 04 00 00 02 00 00 00
  Property Table Atom (f00b) v=3, 3 properties
    Property Table
      [f]Size Text to Fit Shape (191): 524296
      [color]Background Color (385): 134217737
      [color]Line Color (448): 134217792
  Atom (f11e) v=0 n=4
    Binary Data
      0D 00 00 08 0C 00 00 08 17 00 00 08 F7 00 00 10
[/MSODRAWINGGROUP]

...

============================================
Offset 0x7a4 (1956)
rectype = 0xec, recsize = 0xc8
-BEGIN DUMP---------------------------------
00000000 0F 00 02 F0 C0 00 00 00 10 00 08 F0 08 00 00 00 ................
00000010 02 00 00 00 01 04 00 00 0F 00 03 F0 A8 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 70 00 00 00 92 0C 0A F0 08 00 00 00 ....p...........
00000060 01 04 00 00 00 0A 00 00 93 00 0B F0 36 00 00 00 ............6...
00000070 7F 00 04 01 04 01 BF 00 08 00 08 00 81 01 4E 00 ..............N.
00000080 00 08 83 01 4D 00 00 08 BF 01 10 00 11 00 C0 01 ....M...........
00000090 4D 00 00 08 FF 01 08 00 08 00 3F 02 00 00 02 00 M.........?.....
000000A0 BF 03 00 00 08 00 00 00 10 F0 12 00 00 00 00 00 ................
000000B0 03 00 00 03 07 00 C4 00 0B 00 10 01 17 00 4B 00 ..............K.
000000C0 00 00 11 F0 00 00 00 00                         ........
-END DUMP-----------------------------------
recordid = 0xec, size =200
[MSODRAWING]
Drawing Container n=0
  Client Anchor Atom v=0 (f008) n=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) Unknown Type 201
        ShapeId: 1:1
        Flags: Anchored, Has Property
      Property Table Atom (f00b) v=3, 9 properties
        Property Table
          Unknown Property (127): 17039620
          [f]Size Text to Fit Shape (191): 524296
          [color]Background Color (385): 134217806
          Unknown Property (387): 134217805
          [f]Fill Flags (447): 1114128
          [color]Line Color (448): 134217805
          Unknown Property (511): 524296
          Unknown Property (575): 131072
          Unknown Property (959): 524288
      Client Anchor (f010) Drawing ID=0
        Binary Data
          00 00 03 00 00 03 07 00 C4 00 0B 00 10 01 17 00
          4B 00
[/MSODRAWING]

...

/* An extra BOF/EOF pair for each chart. Here I just show the record types

[BOF RECORD]
[HEADER]
[FOOTER]
[HCENTER]
[VCENTER]
[PRINTSETUP]
[UNKNOWN RECORD:33]
[FBI]
[FBI]
[PROTECT]
[UNITS]
[CHART]
[BEGIN]
[SCL]
[PLOTGROWTH]
[FRAME]
[BEGIN]
[LINEFORMAT]
[AREAFORMAT]
[END]
[SERIES]
[BEGIN]
[AI]
[AI]
[AI]
[AI]
[DATAFORMAT]
[BEGIN]
[UNKNOWN RECORD:105f]
[END]
[SeriesToChartGroup]
[END]
[SERIES]
[BEGIN]
[AI]
[AI]
[AI]
[AI]
[DATAFORMAT]
[BEGIN]
[UNKNOWN RECORD:105f]
[END]
[SeriesToChartGroup]
[END]
[SHTPROPS]
[DEFAULTTEXT]
[TEXT]
[BEGIN]
[UNKNOWN RECORD:104f]
[FONTX]
[AI]
[END]
[DEFAULTTEXT]
[TEXT]
[BEGIN]
[UNKNOWN RECORD:104f]
[FONTX]
[AI]
[END]
[AXISUSED]
[AXISPARENT]
[BEGIN]
[UNKNOWN RECORD:104f]
[AXIS]
[BEGIN]
[CATSERRANGE]
[AXCEXT]
[TICK]
[END]
[AXIS]
[BEGIN]
[VALUERANGE]
[TICK]
[AXISLINEFORMAT]
[LINEFORMAT]
[END]
[PLOTAREA]
[FRAME]
[BEGIN]
[LINEFORMAT]
[AREAFORMAT]
[END]
[CHARTFORMAT]
[BEGIN]
[BAR]
[UNKNOWN RECORD:1022]
[LEGEND]
[BEGIN]
[UNKNOWN RECORD:104f]
[TEXT]
[BEGIN]
[UNKNOWN RECORD:104f]
[AI]
[END]
[END]
[END]
[END]
[END]
[DIMENSIONS]
[SINDEX]
[SINDEX]
[NUMBER]
[NUMBER]
[NUMBER]
[NUMBER]
[NUMBER]
[NUMBER]
[SINDEX]
[EOF]

============================================
Offset 0xdc2 (3522)
rectype = 0xed, recsize = 0x18
-BEGIN DUMP---------------------------------
00000000 00 00 19 F1 10 00 00 00 01 00 00 00 00 00 00 00 ................
00000010 01 04 00 00 01 04 00 00                         ........
-END DUMP-----------------------------------
recordid = 0xed, size =24
[MSODRAWINGSELECTION]
Selection Atom v=0 (f119) n=0
  Number of Shapes Selected: 1
  Selection Kind: 0
  Focus SPID: 1:1
  SPID List
    01 00 00 00
[/MSODRAWINGSELECTION]

...

In the above, you can see that there are a *lot* of specific chart records,
which might lead you to believe that charts are completely described by
their own set of BIFF records. But the position of the chart on the page
(including z-order), and its anchor (including hierarchy with other drawing
objects) is described in the Escher structure.

So that's why I think you need to implement the Escher layer first.



---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: poi-user-help@jakarta.apache.org


Mime
View raw message