0

So i get chart from excel file (.xlsx) by this code.

XSSFSheet sheet = workbook.getSheetAt(10);
XSSFDrawing drawing = sheet.createDrawingPatriarch();
XSSFChart chart = drawing.getCharts().get(0);

and i need to resize this chart like

chart.setHeight(100);
podebwm
  • 5
  • 2

1 Answers1

0

Using CTMarker and XSSFDrawing, you shall resize with the coordinates as below.

XSSFDrawing draw= ((XSSFSheet)currentSheet).createDrawingPatriarch();
CTMarker chartEndCoords = CTMarker.Factory.newInstance();
chartEndCoords.setCol(column);
chartEndCoords.setColOff(0);
chartEndCoords.setRow(row);
chartEndCoords.setRowOff(0);
draw.getCTDrawing().getTwoCellAnchorArray(0).setTo(chartEndCoords);

Please refer here for detailed explanation- Resize in POI

Community
  • 1
  • 1
Srikanth Balaji
  • 2,638
  • 4
  • 18
  • 31