0

HAve this piece of code that opens the files:

Runtime.getRuntime().exec(new String[]
                      {"rundll32", "url.dll,FileProtocolHandler",
                       file.getAbsolutePath()});

where I have passed the file.. It's strange that its not opening some of the auto generated files in xlsx, where as it's able to open other xlsx files. Unable to debug/find a solution, Pls help

user2176576
  • 734
  • 3
  • 14
  • 39

2 Answers2

3

You can try the following:

try {
    Desktop.getDesktop().open(new File("F:\\folder\\data\\file.xlsx"));
} catch (IOException e) {e.printStackTrace();}
Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
yogesh
  • 463
  • 6
  • 15
0

Instead of reading xls using DLL methodology, you can use the new Apache API to open and access all the excel file data.

Please check the folllowing link for more details: https://poi.apache.org/

Bharat
  • 31
  • 4