https://issues.apache.org/bugzilla/show_bug.cgi?id=51173
--- Comment #8 from Malcolm McMahon <[email protected]> --- (In reply to suman saurav from comment #7) > Hi Nick, > > I have same issue here. And I have tried every EMU value like > XSSFShape.EMU_PER_PIXEL and multiplied it by 10 and 20, but it doesn't make > an effect in converted sheet. Images are still coming at the edge of cell. > > Below is the code, i am using write now: > > XSSFClientAnchor anchor = new > XSSFClientAnchor(XSSFShape.EMU_PER_PIXEL*200,XSSFShape.EMU_PER_PIXEL*200,0,0, > (short)col,row,(short)col1,row1); > > Please suggest, if i did anything wrong. > > Thanks, > Saurav The real problem behind all these bug report seems to be in XSSFPicture.resize(); In here we find anchor.setCol2(col2); anchor.setDx1(0); // !! anchor.setDx2(pref.getDx2()); anchor.setRow2(row2); anchor.setDy1(0); // !! In other words calling resize discards any offsets you've set in your anchor. I've replaced the resize call with: Picture pic = drawing.createPicture(anchor, pictures.get(value)); ClientAnchor pref = pic.getPreferredSize(); anchor.setDx2(pref.getDx2() + anchor.getDx1()); anchor.setDy2(pref.getDy2() + anchor.getDy1()); And it works as expected. Something slightly more complicated would be needed if the picture extended over more than one cell. anchor.setDy2(pref.getDy2()); This kills any offsets you set, and if you don't call resize your picture will probably collapse. The resize source could be changed easily enough to preserver dx1 and dy1, and I don't imagine any existing code would break. -- You are receiving this mail because: You are the assignee for the bug. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
