Workbook wb = new HSSFWorkbook();
//Workbook wb = new XSSFWorkbook();
CreationHelper createHelper = wb.getCreationHelper();
Sheet sheet = wb.createSheet("new sheet");
// 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.
Cell cell = row.createCell(0);
cell.setCellValue(1);
// Or do it on one line.
row.createCell(1).setCellValue(1.2);
row.createCell(2).setCellValue(
createHelper.createRichTextString("This is a string"));
row.createCell(3).setCellValue(true);
// Write the output to a file
try (OutputStream fileOut = new FileOutputStream("workbook.xls")) {
wb.write(fileOut);
}
1条答案
按热度按时间xqnpmsa81#
1.将
tika-app-xxx.jar
复制到JMeter安装的“lib”文件夹1.重新启动JMeter以拾取.jar文件
1.切换到
groovy
language1.您的代码应该可以开始工作,并且不会出现“找不到类”错误
如果您正在寻找有关如何填充Excel文件的“食谱”,请查看Busy Developers' Guide to HSSF and XSSF Features
以防万一上面指南中的一段代码: