Hello Erik,

The cause of the problem in the other post that you refer to had something
to do with the sheet the author was trying to insert the images into; we
assumed some sort of interaction with either the chart or cells on the
second sheet. I do not know the exact details, but there was something about
that sheet that when there were charts in the same workbook meant that no
images could be added using POI.

The test is quite a simple one really. Use your existing template file, open
it with POI, insert a new sheet into the workbook and then try to add an
image or images to that new sheet. When we were working on the 'other'
problem, we were able to easilly add images to the new sheet but still not
to those that already existed in the workbook. The answer was to use POI to
build that troublesome sheet in the first place; I do not know if this will
be a possible solution to your problem however. Alternatively, try
disassembling the template workbook until you are at the point where an
image can be added and then use POI to build the missing features.

I cannot promise anyting at all but if I have the time, I will take a look
atthe attached files.

Yours

Mark B


Erik Lundström wrote:
> 
> Hello,
> 
> I'm struggling with a case where I have to write images to an Excel
> Workbook, when there are chart(s) present in the Excel template file.
> 
> (I have seen another message here on the mailing list labeled "Adding
> Image in Sheet while Diagram already exists in other does not work". I
> don't know if my problem is another form of the same problem; I couldn't
> manage to download the code from that author. I am sorry if I'm repeating
> the same question again, but I still haven't found a solution or
> workaround to my problem, whereas I think the other poster did).
> 
> Anyway, my case is this (download link to standalone example including
> images and Excel templates is below):
> 
> I have an Excel template, consisting of two sheets. There is one chart on
> Sheet0, and one on Sheet1.
> 
> There is data (numerical values, texts) being written to various cells on
> these two sheets. The num cells are the base for the charts.
> 
> On Sheet1, I want to write four images. This is where my problem surfaces.
> Using the intended Excel template, the image writing using POI screws up
> Sheet1 completely.
> 
> 
> Using various versions of my initial Excel template (basically stripping
> it down), I came to the depressing conclusion that there is a Catch22
> here: Charts must be present from scratch in the Excel template file (as
> by the given limitations in the POI HSSF+XSSF project), but writing images
> to a Workbook where there are charts just isn't possible. This conclusion
> was made when I removed the chart from Sheet1 (the sheet where I want to
> write images) - the images still don't appear.
> 
> But when starting out with a completely blank Excel file, and just adding
> a chart to Sheet0, I do manage to write images to Sheet1. Well, the "real"
> Excel template might of course have references and bindings that I'm not
> aware of - I am neither an Excel expert nor the author of that Excel file.
> 
> So it seems that charts can/might be present on OTHER sheets than the one
> where images are written? At least this is my humble suspicion after
> struggling with this for some time.
> 
> I would be very grateful if somebody here could clarify the image/chart
> problem! Can one make them co-exist, or must I use an external workaround
> (like having a macro reading the images afterwards to the Sheet).
> 
> I have been using POI 3.5 Beta6, and my "Excel viewer/template editor" was
> MS Excel 2007 (on Vista).
> 
> Source is here (standalone example, images and the various Excel templates
> I have tried):
> 
> http://uploading.com/files/HOJ1VIKT/POITest.zip.html
> 
> 
> Thanks
> 
> Erik
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Adding-images-to-Excel-sheet-with-existing-Chart---is-this-possible--tp25076212p25080874.html
Sent from the POI - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to