excel - How can I open an xls file, save it, and then close it all in java? -


how can open xls file, save it, , close in java?

i have workaround make java write vbs script same thing

set excel = createobject("excel.application") excel.workbooks.open("path xls file") excel.activeworkbook.save() excel.quit 

java runs vbs script passing path cmd

runtime rt = runtime.getruntime(); rt.exec("cscript " + decodedpath3 + filename + ".vbs"); 

and delete vbs created

is there way can replicate these steps in java?

i've done lot of reading poi , i'm not sure how simple task java.

note - vbs script doesn't make excel open , display sheet making fast. need java same thing.

in response comments http://jexcelapi.sourceforge.net/ work?

import java.io.file;  import java.util.date;  import jxl.*;  import jxl.write.*;    workbook workbook = workbook.getworkbook(new file("myfile.xls")); writableworkbook copy = workbook.createworkbook(new file("myfile.xls"), workbook); 

you can this, need third party library it. there various available both free , not free. @ project on sourceforge example:

jexcelapi.sourceforge.net 

nothing wrong solution except not portable off of windows machine vba runtime libraries installed.


Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -