2017-12-08 3 views
0

나는 apache poi를 사용하여 ppt를 만듭니다. 지금까지 빈 슬라이드에 선을 추가했지만 사각형을 추가 할 수 없었습니다. 빈 슬라이드에서 사각형 그리기를 어떻게 진행할 수 있는지 알 수 없습니다.공백 슬라이드에 사각형을 추가하는 방법

미리 제안 해 주셔서 감사합니다.

편집 :

내가 코드 선 그리기를 게시하고 아래. 나는 위 수평, 오른쪽 수직, 아래 수평, 왼쪽 수직 인 4 개의 선을 그렸다. 그것은 잘 작동하지만 4 선 대신 사각형을 그릴 필요가있다.

// 코드 아래

 java.awt.geom.Path2D.Double upperHorizontalPath = new java.awt.geom.Path2D.Double(); 
     upperHorizontalPath.moveTo(20, 200); 
     upperHorizontalPath.lineTo(230, 200); 
     upperHorizontalPath.closePath(); 
     XSLFFreeformShape upperHorizontalShape = indexslide.createFreeform(); 
     upperHorizontalShape.setPath(upperHorizontalPath); 
     upperHorizontalShape.setLineWidth(3); 
     upperHorizontalShape.setLineColor(Color.BLACK); 

     java.awt.geom.Path2D.Double rightVerticalPath = new java.awt.geom.Path2D.Double(); 
     rightVerticalPath.moveTo(230, 200); 
     rightVerticalPath.lineTo(230, 300); 
     rightVerticalPath.closePath(); 
     XSLFFreeformShape rightVerticalShape = indexslide.createFreeform(); 
     rightVerticalShape.setPath(rightVerticalPath); 
     rightVerticalShape.setLineWidth(3); 
     rightVerticalShape.setLineColor(Color.BLACK); 

     java.awt.geom.Path2D.Double lowerHorizontalPath = new java.awt.geom.Path2D.Double(); 
     lowerHorizontalPath.moveTo(230, 300); 
     lowerHorizontalPath.lineTo(20, 300); 
     lowerHorizontalPath.closePath(); 
     XSLFFreeformShape lowerHorizontalShape = indexslide.createFreeform(); 
     lowerHorizontalShape.setPath(lowerHorizontalPath); 
     lowerHorizontalShape.setLineWidth(3); 
     lowerHorizontalShape.setLineColor(Color.BLACK); 

     java.awt.geom.Path2D.Double leftVerticalPath = new java.awt.geom.Path2D.Double(); 
     leftVerticalPath.moveTo(20, 300); 
     leftVerticalPath.lineTo(20, 200); 
     leftVerticalPath.closePath(); 
     XSLFFreeformShape leftVerticalShape = indexslide.createFreeform(); 
     leftVerticalShape.setPath(leftVerticalPath); 
     leftVerticalShape.setLineWidth(3); 
     leftVerticalShape.setLineColor(Color.BLACK); 
+0

이 문제를 해결하기위한 최신 방법을 선택하십시오. – vinS

답변

0

슬라이드에 사각형 모양을 만드는 데 도움이 될 것입니다 평방립니다.

XSLFTextBox lowerTextShape = locationSlide.createTextBox();

     ((XSLFSimpleShape) lowerTextShape).setAnchor(new Rectangle2D.Double(10, 100, 600, 80)); 
         ((XSLFSimpleShape) lowerTextShape).setAnchor(new java.awt.Rectangle(0, 385, 240, 110)); 
         ((XSLFSimpleShape) lowerTextShape).setLineColor(Color.WHITE); 
         ((XSLFSimpleShape) lowerTextShape).setLineWidth(3); 
관련 문제