Below Program is used to open Excel File :
import java.awt.Desktop;
import java.io.*;
public class OpenExcel {
/**
* @param args
*/
public static void main(String[] args) {
if (Desktop.isDesktopSupported()) {
try {
Desktop.getDesktop().open(new File("File.xls"));
} catch (IOException e) {
e.printStackTrace();
}
} else {
try {
Process p = Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + new File("File.xls"));
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
import java.awt.Desktop;
import java.io.*;
public class OpenExcel {
/**
* @param args
*/
public static void main(String[] args) {
if (Desktop.isDesktopSupported()) {
try {
Desktop.getDesktop().open(new File("File.xls"));
} catch (IOException e) {
e.printStackTrace();
}
} else {
try {
Process p = Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + new File("File.xls"));
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
No comments:
Post a Comment