Home Ask Login Register

Developers Planet

Your answer is one click away!

marcss February 2016

How can I get a preview image of an excel document?

I've got an excel document and i need to take an image of the first sheet and use it to put in the icon of JLabel. How can I do it?


centic February 2016

I don't think Apache POI provides anything here as it is not concerned about displaying the data, only about retrieving and updating the data in the Excel Workbook.

So basically only Excel and other office applications like LibreOffice know how to actually display the data.

A few alternative options that come to my mind:

  • Use some other software to display the contents as a web-page and use Selenium to take a screenshot, see e.g. Take a screenshot with Selenium WebDriver
  • Programmatically open the file in Excel on a Windows box, then use some screenshot utility with automation support

Post Status

Asked in February 2016
Viewed 3,459 times
Voted 6
Answered 1 times


Leave an answer

Quote of the day: live life