There are actually 3 ways that Excel puts an image into a workbook.

The first is the old way, used by Excel v 4, but still supported by current
versions of Excel. In this case, images go into a 'DSO' record (I think).
Images done in this way are like any other cell content. This would be the
simplest way to implement image support, and is used by some PERL programs
There is also a patch to JExcelApi (but it's not part of the main
distribution yet) that does the same thing. Images attached in this way have
to be relatively small, and have to be a certain style of bitmap.

Here is a freshmeat description of Spreadsheet::WriteExcel
http://freshmeat.net/projects/writeexcel/?topic_id=66%2C78%2C131%2C809
"The Spreadsheet::WriteExcel module can be used to create a cross-platform
Excel binary file. Multiple worksheets can be added to a workbook and
formatting can be applied to cells. Text, numbers, formulas, hyperlinks and
images can be written to the cells"

Here is a link to JExcelApi (on SourceForge)
http://sourceforge.net/projects/jexcelapi/

The patch to attach images is in their Yahoo Group
http://groups.yahoo.com/group/JExcelApi/
Join the group, click on 'Files', then look for jxl_2_3_11_image_patch.zip

The second way is through the Escher layer. In this case, images are part of
the Unknown Record ec (and eb and ed), which have the names MSODRAWINGGROUP,
MSODRAWING, and MSODRAWINGSELECTION You can read my earlier messages
describing this format at a high level  Basically, the images themselves are
stored inside the MSODRAWINGGROUP record. The position and properties such
as borders, background color, grouping with other objects is described in
the MSODRAWING record. And the last selected object is stored in the
MSODRAWINGSELECTION record. There will also be an OBJ record for each image,
which is how Excel comes up with the name 'Picture 1' when the image is
selected. You can read some of my earlier posts

http://www.mail-archive.com/[EMAIL PROTECTED]/msg03479.html
http://www.mail-archive.com/[EMAIL PROTECTED]/msg03305.html

I had developed a POI based parser for this, but stopped work when I read
that the committers were going to implement Escher support 'real soon now'
(That was back in October).

The third way is as an OLE attachment. In this case, the images themselves
go into a separate stream in the OLE Doc file. Images attached in this way
are actually OLE documents, and will have an associated program such as
PaintBrush, PhotoShop or some other graphics editor. The 'image' can even be
a Power Point slide, a page from a Word document, or another Excel
spreadsheet. This second stream is referenced by an OBJECT record

-----Original Message-----
From: Kais Dukes [mailto:[EMAIL PROTECTED]
Sent: Thursday, January 22, 2004 7:53 AM
To: POI Developers List
Subject: RE: Support for Images and charting

Glen,

Thanks for the bar chart records, there very useful. Do you have a similar
dump for images?

Kind Regards

-- Kais

-----Original Message-----
From: Glen Stampoultzis [mailto:[EMAIL PROTECTED]
Sent: 22 January 2004 12:50
To: POI Developers List
Subject: Re: Support for Images and charting


At 04:57 PM 22/01/2004, you wrote:
>I think all things left to do in HSSF are basically easy, but what do I
>know.

Hrrmm... charting will be a lot of work.  The main problem is that there's
very little information available on how charts work.  These are the
records for a very "simple" bar chart:


[UNKNOWN RECORD:ec]
[UNKNOWN RECORD:5d]
[BOF RECORD]
     [HEADER]
     [FOOTER]
     [HCENTER]
     [VCENTER]
     [PRINTSETUP]
     [UNKNOWN RECORD:33]
     [FBI]
     [FBI]
     [PROTECT]
     [UNITS]
     [CHART]
     [BEGIN]
         [SCL]                 // zoom magnification
         [PLOTGROWTH]          // font scaling
         [FRAME]               // border around text
         [BEGIN]               // default line and area format
             [LINEFORMAT]
             [AREAFORMAT]
         [END]
         [SERIES]              // start of series
         [BEGIN]
             [AI]              // LINK_TYPE_TITLE_OR_TEXT
             [AI]              // LINK_TYPE_VALUES
             [AI]              // LINK_TYPE_CATEGORIES
             [AI]              // ??
             [DATAFORMAT]      // Formatting applies to series?
             [BEGIN]           // ??
                 [UNKNOWN RECORD]
             [END]
             [SeriesToChartGroup] // Used to support > 1 chart?
         [END]
         [SHTPROPS]            // Some defaults for how chart is displayed.
         [DEFAULTTEXT]         // Describes the characteristics of the next
                               // record
         [TEXT]                // Details of the text that follows in the
                               // next section
         [BEGIN]
             [UNKNOWN RECORD]  // POS record... looks like I missed this
one.
                               // docs seem to indicate it's better to use
                               // defaults...
             [FONTX]           // index to font record.
             [AI]              // link to text?  seems to be linking to
nothing
         [END]
         [DEFAULTTEXT]         // contains a category type of 3 which is not
                               // documented (sigh).
         [TEXT]                // defines position, color etc for text on
chart.
         [BEGIN]
             [UNKNOWN RECORD]  // Another pos record
             [FONTX]           // font
             [AI]              // reference type is DIRECT (not sure what
this
                               // means)
         [END]
         [AXISUSED]            // number of axis on the chart.
         [AXISPARENT]          // axis size and location
         [BEGIN]               // beginning of axis details
             [UNKNOWN RECORD]        // Another pos record.
             [AXIS]                  // Category axis
             [BEGIN]
                 [CATSERRANGE]       // defines tick marks and other stuff
                 [AXCEXT]            // unit information
                 [TICK]              // tick formating characteristics
             [END]
             [AXIS]                  // Value axis
             [BEGIN]
                 [VALUERANGE]        // defines tick marks and other stuff
                 [TICK]              // tick formating characteristics
                 [AXISLINEFORMAT]    // major grid line axis format
                 [LINEFORMAT]        // what do the lines look like?
             [END]
             [PLOTAREA]              // marks that the frame following
belongs
                                     // to the frame.
             [FRAME]                 // border
             [BEGIN]
                 [LINEFORMAT]        // border line
                 [AREAFORMAT]        // border area
             [END]
             [CHARTFORMAT]           // marks a chart group
             [BEGIN]
                 [BAR]               // indicates a bar chart
                 [UNKNOWN RECORD]    // apparently this record is ignoreable
                 [LEGEND]            // positioning for the legend
                 [BEGIN]
                     [UNKNOWN RECORD]    // another position record.
                     [TEXT]              // details of the text that follows
                                         // in the next section
                     [BEGIN]
                         [UNKNOWN RECORD]  // yet another pos record
                         [AI]              // another link (of type direct)
                     [END]
                 [END]
             [END]
         [END]
     [END]
     [DIMENSIONS]
     [SINDEX]
     [SINDEX]
     [SINDEX]
[EOF]





Glen [EMAIL PROTECTED]
http://members.iinet.net.au/~gstamp/glen/


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


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


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

Reply via email to