title: Using Java and Apache POI customizing image size within excel cell
body: <p>i am using apache poi to extract certain data in xls format. The cell size of each column has been fixed.</p>
  
  <p>Now my data is being fetched to each respective cell perfectly,but i want to change the scale of my image being fetched in one cell.</p>
  
  <p>I want to change the scaling of the image to lets say height 12% and width 16% only without altering the cell size.</p>
  
  <p>my code:</p>
  
  <pre><code>ResultSetMetaData resultSetMetaData = givenSetForExcel.getMetaData();
  int columnCount = resultSetMetaData.getColumnCount();
  
  XSSFWorkbook workbook = new XSSFWorkbook();
  XSSFSheet spreadsheet = workbook.createSheet(this.reportName);
  
  int pictureIdx = 0;
  if (substr.equalsIgnoreCase("jpg")
      || substr.equalsIgnoreCase("jpeg")) {
              pictureIdx = workbook.addPicture(bytes,
              Workbook.PICTURE_TYPE_JPEG);
  } else if (substr.equalsIgnoreCase("png")) {
              pictureIdx = workbook.addPicture(bytes,
              Workbook.PICTURE_TYPE_PNG);
  }
  try {
          is.close();
      } catch (Exception e) {
          dataCell.setCellValue("");
          break;
      }
  
  CreationHelper helper = workbook.getCreationHelper();
  Drawing drawing = spreadsheet.createDrawingPatriarch();
  // fit picture
  ClientAnchor anchor = helper.createClientAnchor();
  anchor.setCol1(i);
  anchor.setRow1(rowCounter);
  anchor.setCol2(i + 1);
  anchor.setRow2(rowCounter + 1);
  row.setHeight((short) 600);
  drawing.createPicture(anchor, pictureIdx);
  </code></pre>