Not able retrieve pictures inside cell

Hai

Is it possible to get pictures which are inside a cell? because i am using the following code to get the pictures present inside an excel sheet

public class ExcelTest {

public static void main(String[] args) {

Workbook wbookObj=new Workbook();

try {

File licenseFile = new File( "C:\\Aspose.Total.Java.lic");

License license = new License();

license.setLicense(new FileInputStream(licenseFile));

wbookObj.open("C:\\withPictures.xls");

Worksheet wsheetObj=wbookObj.getWorksheets().getActiveSheet();

Pictures pics=wsheetObj.getPictures();

} catch (Exception e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

}

}

but i am not able to get pictures from the excel cell, iam sending the excel file as an attachment.

Hi,

Well, I can get pictures in the Sheet1 in your template excel file. Do you mean you could not able to get pictures from the sheet cells? Please try the attached version and see the sample code below:

Workbook wbookObj = new Workbook();

wbookObj.open(“d:\Files\withPictures.xls”);

Worksheet wsheetObj=wbookObj.getWorksheets().getSheet(0);

Pictures pics=wsheetObj.getPictures();

System.out.println(pics.size()); // returns 3 OK.


for(int i =0;i<pics.size(); i++)

{
Picture pic = pics.get(i);
//Use Picture methods here for your further needs.


}

Also, there is no such api to get pictures from a single cell, I am afraid, you need to scan pictures one by one after getting all the pictures from the sheet (as described in the above code).

Thank you.

I had tried with your code also, it is not getting the pictures, i.e pics.size() is giving me 0, i had already tried with getPictures() it was giving me 0. Is the problem with version? if so where can i find the version number in my aspose suite. and which version you had tried.

Hi,

Please try my attached version v2.1.1.24 (attached in my previous post).
To check the version number for the Aspose.Cells for Java component, see the document:
http://www.aspose.com/documentation/java-components/aspose.cells-for-java/check-version-number-of-the-component.html



I have tested using your template file and code and it works fine with my attached version, so kindly try download and try it.

Thank you.

Thank you, you are correct we were using version 1.9.0.0 with that version we are not able to get pictures, but with a latest version it is returning picture count and it is working fine.

Thanks & Regards

Naresh