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
