I am able to create XSSFWorkbook() in the first iteration only. In second iteration, JSR233 Sampler is passing but Workbook is not getting created.
Workbook wb = new XSSFWorkbook();
Sheet sheet = wb.createSheet("SiteList"); Create a row and put some cells in it. Rows are 0 based. Row row = sheet.createRow(0);
Create a cell and put a value in it. row.createCell(0).setCellValue('ErtStudyName'); row.createCell(1).setCellValue('UniqueSiteID'); row.createCell(2).setCellValue('SiteNumber'); row.createCell(3).setCellValue('InvestigatorFirstName'); row.createCell(4).setCellValue('InvestigatorLastName'); row.createCell(5).setCellValue('InvestigatorMiddleName'); row.createCell(6).setCellValue('ShippingAddress1'); row.createCell(7).setCellValue('ShippingAddress2'); row.createCell(8).setCellValue('ShippingAddress3'); row.createCell(9).setCellValue('ShippingAddress4'); row.createCell(10).setCellValue('InstitutionName'); row.createCell(11).setCellValue('City'); row.createCell(12).setCellValue('PostalCode'); row.createCell(13).setCellValue('Country'); row.createCell(14).setCellValue('Region'); row.createCell(15).setCellValue('ShippingPhone'); row.createCell(16).setCellValue('ShippingPhoneExtension'); row.createCell(17).setCellValue('ShippingFax'); row.createCell(18).setCellValue('SiteAction');
row = sheet.createRow(1); row.createCell(0).setCellValue('${studyname}'); row.createCell(1).setCellValue('Uniques_${id2}'); row.createCell(2).setCellValue('${id2}'); row.createCell(3).setCellValue('InvestigatorFirstName1'); row.createCell(4).setCellValue('LAstName1'); //row.createCell(5).setCellValue('InvestigatorMiddleName');-- row.createCell(6).setCellValue('adrres1'); row.createCell(7).setCellValue('adrres2'); //row.createCell(8).setCellValue('ShippingAddress3'); //row.createCell(9).setCellValue('ShippingAddress4'); row.createCell(10).setCellValue('Institution'); row.createCell(11).setCellValue('Newyork'); row.createCell(12).setCellValue(32133); row.createCell(13).setCellValue('India'); row.createCell(14).setCellValue('NYC'); row.createCell(15).setCellValue('312312312'); row.createCell(16).setCellValue('312312312'); //row.createCell(17).setCellValue('ShippingFax'); row.createCell(18).setCellValue('Create');
Write the output to a file
try (OutputStream fileOut = new FileOutputStream("C:/Users/saurabh.arora/Desktop/Performance/SiteService/SiteUpload/testdata/mainint/workbook${__threadNum}${__iterationNum}.xlsx")) { wb.write(fileOut); }
to create a new workbook in new iteration