the code is as follows:
File f = new File("D://demo.pptx");
InputStream in = new FileInputStream(f);
XMLSlideShow slideShow = new XMLSlideShow(in);
XSLFSlideLayout layOut = slideShow.getSlideMasters()[0].getLayout(SlideLayout.CUST);
XSLFSlide slide = slideShow.createSlide(layOut);
XSLFTable table = slide.createTable();
//
XSLFTableRow titleRow = table.addRow();
titleRow.setHeight(44.15);
//
XSLFTableRow contentRow = table.addRow();
contentRow.setHeight(94.4);
String tableTitles[] = new String[]
{"AAA","BBB","CCC","DDD","EEE","FFF","GGG"};
String content[] = new String[]
{"1","2","3","4","5","6","11"};
for(int x = 0 ; x < tableTitles.length ; xPP){
XSLFTableCell titleCell = titleRow.addCell();
titleCell.setBorderBottomColor(new Color(149,179,215));
XSLFTextRun textRun = titleCell.addNewTextParagraph().addNewTextRun();
textRun.setFontSize(14);
textRun.setFontColor(Color.BLACK);
textRun.setFontFamily("");
textRun.setText(tableTitles[x]);
titleCell.addNewTextParagraph().setTextAlign(TextAlign.CENTER);//
titleCell.setFillColor(new Color(219,229,241));
titleCell.setBorderLeft(1);
titleCell.setBorderRight(0.5);
titleCell.setBorderTop(1);
titleCell.setBorderBottom(1);
XSLFTableCell contentCell = contentRow.addCell();
contentCell.setText(content[x]);
}
table.setAnchor(new Rectangle2D.Double(18.8,200,60,9000));
System.out.println(table.getAnchor().getWidth());
slideShow.write(new FileOutputStream("D:/xxx.pptx"));
table.setAnchor (new Rectangle2D.Double (18.8 table.setAnchor) (18.8));) sets the X Y position as well as the width and height of the table.
but the output file. It is found that the width and height set has no effect. Ask the great god for an answer. No, no, no.
poi version is 3.9