3

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 ?

CSchulz
  • 10,882
  • 11
  • 60
  • 114
Pratik Roy
  • 724
  • 1
  • 5
  • 21
  • what is the prob here , please a little more detail – Hussain Akhtar Wahid 'Ghouri' Feb 18 '14 at 05:27
  • when xls to xlsx converter is executed, a dialog box pops up even if the code runs in background. I am unable to use my computer properly for others tasks, as the pop up box will come up and stay on top of all other windows and disappear after conversion completes. is there a way to avoid the pop up and keep it in background or is there another xls to xlsx converter that will have no pop up at all ? – Pratik Roy Feb 18 '14 at 05:33
  • Run the code on a different machine then? – Gagravarr Feb 18 '14 at 11:41
  • Obviously cant keep a different machine for a single program. – Pratik Roy Feb 18 '14 at 12:56

1 Answers1

1

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

Community
  • 1
  • 1
Abhishek
  • 271
  • 3
  • 6
  • I will have to change a hell lot of code for this. Also there are files that give OldFormatException. Cannot take this as a solution – Pratik Roy Feb 18 '14 at 06:14