Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Converting xls to xlsx in java

I am converting xls files to xlsx using the software from the following link http://www.microsoft.com/en-in/download/details.aspx?id=3

I run the above software by creating a batch file using java.

try {
    String cmds[] = {batPath};
    Runtime runtime = Runtime.getRuntime();
    Process process = runtime.exec(cmds);
    process.getOutputStream().close();
    InputStream inputStream = process.getInputStream();
    InputStreamReader inputstreamreader = new InputStreamReader(inputStream);
    BufferedReader bufferedrReader = new BufferedReader(inputstreamreader);
    String strLine = "";
    while ((strLine = bufferedrReader.readLine()) != null) {
        //    System.out.println(strLine);
    }
} catch (IOException ioException) {
    ioException.printStackTrace();
}

Every time the converter runs, a dialog box pops up on top saying converting files... The problem is that I may have to run the software 100 times, but it keeps interfering with any other work although my program runs in background.

Is there another way to do this ?

like image 287
Pratik Roy Avatar asked May 14 '26 06:05

Pratik Roy


1 Answers

See the article [Upgrading to POI 3.5, including converting existing HSSF Usermodel code to SS Usermodel (for XSSF and HSSF)] http://poi.apache.org/spreadsheet/converting.html.

There is an example here : Best language to parse extremely large Excel 2007 files

like image 99
Abhishek Avatar answered May 15 '26 20:05

Abhishek



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!