Reputation: 23
I am trying to access the existing Excel sheet and trying to create a new sheet and update the sheet with some values,On executing i am getting the below error for line "rowHeader.createCell((short) count ).setCellValue("test1");" Java.lang.NoClassDefFoundError :org/openxmlformats/schemas/spreadsheetml/x2006/main/ctextensionlist error on executing the below code
Foll are the list of jars i used
commons-codec-1.9
commons-logging-1.1.3
commons-net-3.3-ftp
junit-4.12,
jxl-2.6.6-sources,
jxl-2.6,
log4j-1.2.17,
MasterExcelReport,
ojdbc6,
poi-3.13-20150929,
poi-3.15-beta1,
poi-examples-3.13-20150929,
poi-examples-3.15-beta1,
poi-excelant-3.13-20150929,
poi-excelant-3.15-beta1,
poi-ooxml-3.5-beta5,
poi-ooxml-3.13-20150929,
poi-ooxml-3.15-beta1,
poi-ooxml-schemas-3.13-20150929,
poi-ooxml-schemas-3.15-beta1,
poi-scratchpad-3.13-20150929,
poi-scratchpad-3.15-beta1,
postgresql-9.3-1102.jdbc41,
sqljdbc42, xmlbeans-2.6.0
import java.io.*;
import java.util.*;
import java.util.List;
import javax.xml.parsers.*;
import javax.xml.xpath.*;
import javax.xml.datatype.*;
import javax.xml.*;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import org.w3c.dom.*;
import org.apache.poi.ss.usermodel.*;
import java.util.Iterator;
import java.lang.*;
import org.apache.poi.xssf.usermodel.XSSFCell;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
def fname = new Date().format("MM-dd-YYYY-HH-mm-a-z")
def TimeStamp = context.expand('${General_Properties#Current_Date}')
def destination_path_File = context.expand('${General_Properties#Destination_path}')
def destination_path = destination_path_File + "_" + TimeStamp
def Request = testRunner.testCase.getTestStepByName("Alliance_Ser")
//def FileName = "Individual Coverages Premium Result"
def Vehical = context.expand('${General_Properties#Alliance_Vehicals}')
def Driver = context.expand('${General_Properties#Alliance_Drivers}')
def FolderName = context.expand('${General_Properties#StateCode}')
def FileName = FolderName + "_Result_Status and Total Premiums_" + Vehical + "_Vehicals_" + Driver + "_Drivers"
def ResultPath = destination_path + "\\" + FolderName + "\\" + FileName + "_" + TimeStamp + ".xls"
log.info ResultPath
FileInputStream fileIn = new FileInputStream(new File(ResultPath))
XSSFWorkbook workbook = new XSSFWorkbook(fileIn);
XSSFSheet sheet = workbook.createSheet("Coverage_Resp_report");
short count = 0;
Row rowHeader = sheet.createRow((short)count);
rowHeader.createCell((short) count ).setCellValue("test1");
//rowHeader.createCell((short) count ).setCellValue("Test2");
FileOutputStream fileOut =new FileOutputStream(new File(ResultPath)); //Open FileOutputStream to write updates
workbook.write(fileOut); //write changes
fileOut.close();
Upvotes: 2
Views: 6039
Reputation: 21
After copying 'ooxml-schemas-1.3.jar' file in lib folder, issue was resolved
Upvotes: 2