Advertisement
Guest User

Untitled

a guest
Feb 19th, 2019
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. java.util.List<CTTwoCellAnchor> drawingAnchors = ((XSSFDrawing)sheet.getDrawingPatriarch()).getCTDrawing().getTwoCellAnchorList();
  2. for (CTTwoCellAnchor drawingAnchor : drawingAnchors) {
  3. int fromRow = drawingAnchor.getFrom().getRow();
  4. int toRow = drawingAnchor.getTo().getRow();
  5. if (fromRow >= startRow) {
  6. drawingAnchor.getFrom().setRow(fromRow + n);
  7. drawingAnchor.getTo().setRow(toRow + n);
  8. }
  9. }
  10.  
  11. XSSFDrawing drawing = sheet.createDrawingPatriarch();
  12. for (XSSFShape shape : drawing.getShapes()) {
  13. if (shape instanceof XSSFPicture){
  14. XSSFClientAnchor anchor = ((XSSFPicture)shape).getClientAnchor();
  15.  
  16. anchor.setRow1(anchor.getRow1() +n); // n can be negative to move up
  17. anchor.setRow2(anchor.getRow2() +n);
  18. }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement