Re: Adding linked image to XLSX corrupts previous drawings
Jacob Danner <[email protected]> Tue, 3 Jan 2012 11:34:11 -0800
| Newsgroups | gmane.text.xml.xmlbeans.user |
|---|---|
| Message-ID | <CAM8xMGuUpGHyGXS4qR1s40uiAFcTXg-YSMMc_wJmqTDKaWCdWA@mail.gmail.com> |
Hey Michael, I don't have the knowledge of POI to really understand whats going on here but I'll give it a shot. > patriarch.createLinkedPicture(anchor, uri.toString()); What is uri.toString here? is uri and xmlbeans type? if so, what is it a type of? What were you expecting the value to be? it looks likes the code should create something like <a href="uri.toString()" .../> is that correct? If so, where does the image/link href get interpretted? > workbook.write(outDoc); Can you post the resulting code snippet of this section of the workbook to highlight the error in the output? Thanks, -jacobd On Tue, Jan 3, 2012 at 11:27 AM, Michael Benoit <[email protected]> wrote: > When adding a linked image to an XLSX using POI that already has at least > one drawing, the resulting file is corrupted but can be recovered. However > the original drawings are gone. > > Here is a code fragment: > Workbook workbook = getWorkbook(doc); > Sheet sheet = workbook.getSheetAt(0); > Drawing patriarch = sheet.createDrawingPatriarch(); > ClientAnchor anchor = > workbook.getCreationHelper().createClientAnchor(); > anchor.setCol1(0); > anchor.setRow1(0); > anchor.setDx1(100); > anchor.setDy1(100); > patriarch.createLinkedPicture(anchor, uri.toString()); > workbook.write(outDoc); > doc.close(); > outDoc.close(); > > I know that POI does not consider this a bug on their end so I was wondering > if this has to do with xmlbeans and if I could custom compile xmlbeans so > that I don't have this problem. > > Thanks, > Michael Benoit