Forum Discussion

Deloitte_Consul's avatar
Deloitte_Consul
Contributor
13 years ago

Compatibility of Soapui PRO 4.5.0.1 with Excel

I have saved an xlsx file having some 2010 features as an xls file and then using the code mentioned below to write to the excel but i am unable to write.
I get an error at line "copy.write()" ...........Please let me know if the error is due to the compatibility issue

Note: This code works well when writing in an excel with no 2010 features in it.

Please let me know if there is any other way i can access xlsx fiel using groovy
import com.eviware.soapui.impl.wsdl.teststeps.*
// JAVA CLASSES
import java.io.File;
import com.eviware.soapui.support.*;
import java.util.*;
import jxl.*;
import jxl.read.*;
import jxl.write.*;
import java.lang.*;
import java.*

Workbook workbook = Workbook.getWorkbook(new File("<filepath>\abcd.xls"));
WritableWorkbook copy = Workbook.createWorkbook(new File("<filepath>\abcd.xls",workbook);
Sheet sheet1 = copy.getSheet("Sheet1");
WritableSheet sheet2 = copy.getSheet("Sheet1");



tc_row = 3
CL = 2;
rows = sheet1.getRows();
Label label = new Label(CL,tc_row,s1);
sheet2.addCell(label);

copy.write();
copy.close();
workbook.close();

Regards,
Dipti

1 Reply