• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to extract images from XSSFSheet?

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I needed code sample on extracting images from XSSFSheet in Apache POI.

Can anybody help on providing links or code samples on this topic? There are links available fro HSSFSheet but not much on XSSFSheet.

Any help is highly appreciated!!!

Thanks & Regards,
Amit Nerkar
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to JavaRanch.

Don't use either the HSSF or XSSF classes, but the SS classes. In this case, that means org.apache.poi.ss.usermodel.Workbook instead of HSSFWorkbook or XSSFWorkbook. Then use the code shown at http://poi.apache.org/spreadsheet/quick-guide.html#Images. Additional benefit: your code works with both XLS and XLSX files.
 
Amit Nerkars
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ulf,

Thanks for posting!!!

However the link you have provided is at WorkBook level. I needed at XSSFSheet level. Means I needed to get a list of images for a particular XSSFSheet.

Is there any example/code snippet available to extract the images from a XSSFSheet?

Thanks for the earlier post!

Thanks,
Amit Nerkar
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is there a particular reason you are not allowed to use Workbook? Remember, it can handle both XLS and XLSX files.
 
Amit Nerkars
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Paul,

Thanks for posting!!!

Actually yes, I am trying to convert xlsx into pdf and also trying to extract images from xlsx and write into pdf. I am iterating sheet wise and therefore require to extract images sheet wise to write into pdf.


Thanks & Regards,

Amit Nerkar
 
Amit Nerkars
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey Ulf, Paul !!!

I got what I wanted, am able to get images from sheet.

Thanks for all the help!

Thanks & Regards,
Amit Nerkar
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's great. Please post what you did, so that others have an opportunity to learn from that.
 
Amit Nerkars
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sure,

Here is the code snippet.










 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Interesting. I notice that the HSSF API has similar API calls, but for some reason they have not been unified into the SS API.
 
The happiness of your life depends upon the quality of your thoughts -Marcus Aurelius ... think about this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic