I want to convert a few cells (which have made to appear as a chart but are not a chart) to an image using Maven in Java. I have written the below code -
public void celltoImage(String sheetname, int firstrow, int firstcol, int totalrow, int totalcol) throws Exception
{
Workbook wb = new Workbook (File1).
Worksheet sheet = wb.getWorksheets(). get(sheetname).
//Cells cell = sheet.getCells();
Range range = sheet.getCells().createRange(firstrow,firstcol,totalrow,totalcol);
ImageOrPrintOptions options = new ImageOrPrintOptions();
options.setPrintingPage(PrintingPageType.IGNORE_BLANK);
options.setImageFormat(ImageFormat.getJpeg());
SheetRender sheetRender = new SheetRender(range.getWorksheet(), options);
String imgName=INPATH+sheetname+ ".jpeg";
OutputStream outputStream = new FileOutputStream(imgName).
sheetRender.toImage(0, outputStream).
}
When I am running this, code with the statement - celltoImage("Sheetname",8,4,3,8)
I am getting an image starting from 1st cell of the worksheet instead of the cell specified, I5.
What am I doing wrong?