tomfaulhaber / excel-templates

Create Excel workbooks from Clojure code using templates and plain old data
Eclipse Public License 1.0
152 stars 20 forks source link

Can't capture and reinsert charts that are not TwoCellAnchors #29

Open tomfaulhaber opened 8 years ago

tomfaulhaber commented 8 years ago

The POI library does not support creating anchors on sheets that are absolutely positioned, but only the TwoCellAnchor. This is an issue because the workaround to #7 requires us to remove the charts from the sheets and reinsert them later. We avoid this problem for chartsheets by simply leaving them in place, but if there's an absolute anchor on a worksheet, we don't have much choice but to throw an exception.

As far as I can tell, this happens when you copy a chart from a chart sheet to a work sheet, but there may be other ways to get into this situation as well. The workaround would be to recreate the chart from scratch on the worksheet (but maybe just resizing it would work - I didn't try that).

One approach to resolving this might be to simply create an equivalent TwoCellAnchor to the AbsoluteAnchor. Another way would be as a side product of #28.