2017-12-08 15 views
0

Ich benutze Apache Poi, um PPT zu erstellen. Bis jetzt kann ich Linien als Form in leere Folien einfügen, aber kein Rechteck darin einfügen. Ich bekomme nicht, wie ich fortfahren kann, um Rechteck in leerer Folie zu zeichnen.Wie kann ich Rechteck in leere Folie hinzufügen

Vielen Dank für alle Vorschläge im Voraus.

EDIT:

Below I-Code bin Entsendung Zeichnung Linie. Ich habe 4 Zeilen gezeichnet, die oben horizontal, rechts vertikal, unten horizontal, links vertikal sind. Es funktioniert gut, aber ich muss Rechteck statt 4 Zeilen zeichnen.

// zeichnet Platz

 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

Bitte zeigen Sie Ihre neuesten nicht-Arbeitsversuch zur Lösung dieses Problems. – vinS

Antwort

0

Im Folgenden Code wird dazu beitragen, rechteckige Form in Folie zu erstellen.

XSLFTextBox untereTextShape = 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); 
Verwandte Themen