Package org.apache.poi.ss.usermodel

Examples of org.apache.poi.ss.usermodel.ClientAnchor


      final int dx1 = (int) (1023 * ((cb.getX() - cell1xPos) / (double) cell1width));
      final int dy1 = (int) (255 * ((cb.getY() - cell1yPos) / (double) cell1height));
      final int dx2 = (int) (1023 * ((cb.getX() + cb.getWidth() - cell2xPos) / (double) cell2width));
      final int dy2 = (int) (255 * ((cb.getY() + cb.getHeight() - cell2yPos) / (double) cell2height));

      final ClientAnchor anchor = workbook.getCreationHelper().createClientAnchor();
      anchor.setDx1(dx1);
      anchor.setDy1(dy1);
      anchor.setDx2(dx2);
      anchor.setDy2(dy2);
      anchor.setCol1((short) cell1x);
      anchor.setRow1(cell1y);
      anchor.setCol2((short) cell2x);
      anchor.setRow2(cell2y);
      anchor.setAnchorType(ClientAnchor.MOVE_DONT_RESIZE); // Move, but don't size
      if (patriarch == null)
      {
        patriarch = sheet.createDrawingPatriarch();
      }
      final Picture picture = patriarch.createPicture(anchor, pictureId);
View Full Code Here


  {
    TableRectangle rect = new TableRectangle();
    rect.setRect(1, 1, 2, 2);
    StrictBounds b = new StrictBounds(StrictGeomUtility.toInternalValue(100), StrictGeomUtility.toInternalValue(100),
        StrictGeomUtility.toInternalValue(400), StrictGeomUtility.toInternalValue(400));
    ClientAnchor clientAnchor = imageHandler.computeClientAnchor(sheetLayout, rect, b);
    Assert.assertEquals(1, clientAnchor.getCol1());
    Assert.assertEquals(1, clientAnchor.getCol2());
    Assert.assertEquals(1, clientAnchor.getRow1());
    Assert.assertEquals(1, clientAnchor.getRow2());

    Assert.assertEquals(0, clientAnchor.getDx1());
    Assert.assertEquals(1023, clientAnchor.getDx2());
    Assert.assertEquals(0, clientAnchor.getDy1());
    Assert.assertEquals(255, clientAnchor.getDy2());
  }
View Full Code Here

    TableRectangle rect = new TableRectangle();
    rect.setRect(1, 1, 2, 2);
    StrictBounds b = new StrictBounds(StrictGeomUtility.toInternalValue(100), StrictGeomUtility.toInternalValue(100),
        StrictGeomUtility.toInternalValue(300), StrictGeomUtility.toInternalValue(300));

    ClientAnchor clientAnchor = imageHandler.computeClientAnchor(sheetLayout, rect, b);
    Assert.assertEquals(1, clientAnchor.getCol1());
    Assert.assertEquals(1, clientAnchor.getCol2());
    Assert.assertEquals(1, clientAnchor.getRow1());
    Assert.assertEquals(1, clientAnchor.getRow2());

    Assert.assertEquals(0, clientAnchor.getDx1());
    Assert.assertEquals(1023 * 3 / 4, clientAnchor.getDx2());
    Assert.assertEquals(0, clientAnchor.getDy1());
    Assert.assertEquals(255 * 3 / 4, clientAnchor.getDy2());
  }
View Full Code Here

    TableRectangle rect = new TableRectangle();
    rect.setRect(1, 1, 2, 2);
    StrictBounds b = new StrictBounds(StrictGeomUtility.toInternalValue(200), StrictGeomUtility.toInternalValue(200),
        StrictGeomUtility.toInternalValue(200), StrictGeomUtility.toInternalValue(200));

    ClientAnchor clientAnchor = imageHandler.computeClientAnchor(sheetLayout, rect, b);
    Assert.assertEquals(1, clientAnchor.getCol1());
    Assert.assertEquals(1, clientAnchor.getCol2());
    Assert.assertEquals(1, clientAnchor.getRow1());
    Assert.assertEquals(1, clientAnchor.getRow2());

    Assert.assertEquals(255, clientAnchor.getDx1());
    Assert.assertEquals(1023 * 3 / 4, clientAnchor.getDx2());
    Assert.assertEquals(63, clientAnchor.getDy1());
    Assert.assertEquals(255 * 3 / 4, clientAnchor.getDy2());
  }
View Full Code Here

  {
    TableRectangle rect = new TableRectangle();
    rect.setRect(1, 1, 2, 2);
    StrictBounds b = new StrictBounds(StrictGeomUtility.toInternalValue(100), StrictGeomUtility.toInternalValue(100),
        StrictGeomUtility.toInternalValue(400), StrictGeomUtility.toInternalValue(400));
    ClientAnchor clientAnchor = xlsxImageHandler.computeClientAnchor(sheetLayout, rect, b);
    Assert.assertEquals(1, clientAnchor.getCol1());
    Assert.assertEquals(1, clientAnchor.getCol2());
    Assert.assertEquals(1, clientAnchor.getRow1());
    Assert.assertEquals(1, clientAnchor.getRow2());

    Assert.assertEquals(0, clientAnchor.getDx1());
    Assert.assertEquals(400 * XSSFShape.EMU_PER_POINT, clientAnchor.getDx2());
    Assert.assertEquals(0, clientAnchor.getDy1());
    Assert.assertEquals(400 * XSSFShape.EMU_PER_POINT, clientAnchor.getDy2());
  }
View Full Code Here

    TableRectangle rect = new TableRectangle();
    rect.setRect(1, 1, 2, 2);
    StrictBounds b = new StrictBounds(StrictGeomUtility.toInternalValue(100), StrictGeomUtility.toInternalValue(100),
        StrictGeomUtility.toInternalValue(300), StrictGeomUtility.toInternalValue(300));

    ClientAnchor clientAnchor = xlsxImageHandler.computeClientAnchor(sheetLayout, rect, b);
    Assert.assertEquals(1, clientAnchor.getCol1());
    Assert.assertEquals(1, clientAnchor.getCol2());
    Assert.assertEquals(1, clientAnchor.getRow1());
    Assert.assertEquals(1, clientAnchor.getRow2());

    Assert.assertEquals(0, clientAnchor.getDx1());
    Assert.assertEquals(300 * XSSFShape.EMU_PER_POINT, clientAnchor.getDx2());
    Assert.assertEquals(0, clientAnchor.getDy1());
    Assert.assertEquals(300 * XSSFShape.EMU_PER_POINT, clientAnchor.getDy2());
  }
View Full Code Here

    TableRectangle rect = new TableRectangle();
    rect.setRect(1, 1, 2, 2);
    StrictBounds b = new StrictBounds(StrictGeomUtility.toInternalValue(200), StrictGeomUtility.toInternalValue(200),
        StrictGeomUtility.toInternalValue(200), StrictGeomUtility.toInternalValue(200));

    ClientAnchor clientAnchor = xlsxImageHandler.computeClientAnchor(sheetLayout, rect, b);
    Assert.assertEquals(1, clientAnchor.getCol1());
    Assert.assertEquals(1, clientAnchor.getCol2());
    Assert.assertEquals(1, clientAnchor.getRow1());
    Assert.assertEquals(1, clientAnchor.getRow2());

    Assert.assertEquals(100 * XSSFShape.EMU_PER_POINT, clientAnchor.getDx1());
    Assert.assertEquals(300 * XSSFShape.EMU_PER_POINT, clientAnchor.getDx2());
    Assert.assertEquals(100 * XSSFShape.EMU_PER_POINT, clientAnchor.getDy1());
    Assert.assertEquals(300 * XSSFShape.EMU_PER_POINT, clientAnchor.getDy2());
  }
View Full Code Here

        // should not happen, as PNG is always supported.
        logger.warn("Assertation-Failure: PNG encoding failed.", uee)// NON-NLS
        return;
      }

      final ClientAnchor anchor = computeClientAnchor(currentLayout, rectangle, cb);

      Drawing patriarch = printerBase.getDrawingPatriarch();

      final Picture picture = patriarch.createPicture(anchor, pictureId);
      logger.info(String.format("Created image: %d => %s", pictureId, picture))// NON-NLS
View Full Code Here

    final int dx1 = (int) (1023 * ((cb.getX() - cell1xPos) / (double) cell1width));
    final int dy1 = (int) (255 * ((cb.getY() - cell1yPos) / (double) cell1height));
    final int dx2 = (int) (1023 * ((cb.getX() + cb.getWidth() - cell2xPos) / (double) cell2width));
    final int dy2 = (int) (255 * ((cb.getY() + cb.getHeight() - cell2yPos) / (double) cell2height));

    final ClientAnchor anchor = printerBase.getWorkbook().getCreationHelper().createClientAnchor();
    anchor.setDx1(dx1);
    anchor.setDy1(dy1);
    anchor.setDx2(dx2);
    anchor.setDy2(dy2);
    anchor.setCol1(cell1x);
    anchor.setRow1(cell1y);
    anchor.setCol2(cell2x);
    anchor.setRow2(cell2y);
    anchor.setAnchorType(ClientAnchor.MOVE_DONT_RESIZE);
    return anchor;
  }
View Full Code Here

    final int dx1 = (int) StrictGeomUtility.toExternalValue((cb.getX() - cell1xPos) * XSSFShape.EMU_PER_POINT);
    final int dy1 = (int) StrictGeomUtility.toExternalValue((cb.getY() - cell1yPos) * XSSFShape.EMU_PER_POINT);
    final int dx2 = (int) Math.max(0, StrictGeomUtility.toExternalValue((cb.getX() + cb.getWidth() - cell2xPos) * XSSFShape.EMU_PER_POINT));
    final int dy2 = (int) Math.max(0, StrictGeomUtility.toExternalValue((cb.getY() + cb.getHeight() - cell2yPos* XSSFShape.EMU_PER_POINT));

    final ClientAnchor anchor = printerBase.getWorkbook().getCreationHelper().createClientAnchor();
    anchor.setDx1(dx1);
    anchor.setDy1(dy1);
    anchor.setDx2(dx2);
    anchor.setDy2(dy2);
    anchor.setCol1(cell1x);
    anchor.setRow1(cell1y);
    anchor.setCol2(cell2x);
    anchor.setRow2(cell2y);
    anchor.setAnchorType(ClientAnchor.MOVE_DONT_RESIZE);
    return anchor;
  }
View Full Code Here

TOP

Related Classes of org.apache.poi.ss.usermodel.ClientAnchor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.