// Create a jpg file stream FileOutputStream outputStream = null; try { outputStream = new FileOutputStream("SetScaleAndResolution.jpg"); } catch (FileNotFoundException e) { e.printStackTrace(); } // Create a new workbook Workbook workbook = new Workbook(); IWorksheet worksheet = workbook.getWorksheets().get(0); worksheet.getRange("B1").setValue("Circle"); worksheet.getRange("B1").setHorizontalAlignment(HorizontalAlignment.Center); IShape circle = worksheet.getShapes().addShape(AutoShapeType.Oval, 20, 20, 100, 100); worksheet.getRange("E1").setValue("Square"); worksheet.getRange("E1").setHorizontalAlignment(HorizontalAlignment.Center); IShape square = worksheet.getShapes().addShape(AutoShapeType.Rectangle, 165, 20, 100, 100); circle.getTextFrame().setHorizontalAnchor(HorizontalAnchor.Center); circle.getTextFrame().setVerticalAnchor(VerticalAnchor.AnchorMiddle); square.getTextFrame().setHorizontalAnchor(HorizontalAnchor.Center); square.getTextFrame().setVerticalAnchor(VerticalAnchor.AnchorMiddle); ImageSaveOptions options = new ImageSaveOptions(); // Set the scaling of the exported image options.setScaleX(2.0); options.setScaleY(1.5); // Set the dpi of the exported jpg file options.setResolution(192); worksheet.toImage(outputStream, ImageType.JPG, options); // Close the file stream try { outputStream.close(); } catch (IOException e) { e.printStackTrace(); }