Forum Discussion
http://www.javabykiran.com/tutorials/how-to-set-data-into-excel-sheet-using.jxl/how-to-set-data-into-excel-sheet-using.jxl.php
http://www.quicklyjava.com/write-to-excel-in-java/
2. I am particularly not favour of saving response into excel (column ). Excel becomes clutter. Instead you can save it a file and have the file name in the column. It's just my opinion and upto you.
Hi,
Finally I find the solution. Find the below code
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.ss.usermodel.*;
import java.io.*;
def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )
def holder = groovyUtils.getXmlHolder("validateFile#Response")
log.info "soap xml >>>>>>>>>>>>>>>>:"+holder.getXml()
xPath1 = "//*:uniqueid/text()"
log.info "uniqueid value >>>>>>>>>>>>>>>:"+holder.getNodeValue(xPath1)
iniqueidVal=holder.getNodeValue(xPath1)
FileInputStream fIpStream= new FileInputStream(new File("D:\\tmp_input.xls"));
HSSFWorkbook wb = new HSSFWorkbook(fIpStream);
// accessing your existing sheet
HSSFSheet worksheet = wb.getSheetAt(0);
Row row = worksheet.getRow(2);
//Create a new cell in current row
Cell cell = row.createCell(18);
cell.setCellValue(iniqueidVal);
//log.info(xPath1)
fIpStream.close(); //Close the InputStream
FileOutputStream output_file =new FileOutputStream(new File("D:\\tmp_input.xls"));
wb.write(output_file);
output_file.close();
Thanks
Mani
Related Content
- 10 months agoIrinaManea
- 11 months agoMarcusBengtsson
- 9 months agoAnabelle
Recent Discussions
- 6 days agoruchisingh