小编unk*_*own的帖子

36
推荐指数
8
解决办法
7万
查看次数

读取不带标题的 POI 的 Excel 文件

我想使用没有标题标题的 poi 读取 excel 文件,我的预期结果是 预期读取 excel 文件

这是我的代码

public String processExcel(Model model, @RequestParam(value = "excelfile", required = false) MultipartFile excelfile, HttpSession session) {        

        try {
            List<UserRegistrationDetail> lstUser = new ArrayList<>();

            Workbook workbook = null;

            if (excelfile.getOriginalFilename().endsWith("xlsx")) {
                workbook = new XSSFWorkbook(excelfile.getInputStream());
            } else if (excelfile.getOriginalFilename().endsWith("xls")) {
                workbook = new HSSFWorkbook(excelfile.getInputStream());
            } else {
                model.addAttribute("msg", new IllegalArgumentException("The specified file is not Excel file"));
            }

            Sheet worksheet = workbook.getSheetAt(0);


        Iterator<Row> iterator = worksheet.iterator();
        while (iterator.hasNext()) {
            Row nextRow = iterator.next();
            Iterator<Cell> cellIterator = nextRow.cellIterator(); …
Run Code Online (Sandbox Code Playgroud)

java excel apache-poi

2
推荐指数
1
解决办法
3994
查看次数

将特定的int数组转换为String

我有像这样的变量int数组

int[] sample = new int[];
sample[0] = 1;
sample[1] = 2;

String two = sample[1].toString(); <==== i have problem with this

System.out.println(two);
Run Code Online (Sandbox Code Playgroud)

如何解决它们?我不能将int [1]的值显示为字符串..

java arrays string int

0
推荐指数
1
解决办法
80
查看次数

标签 统计

java ×2

apache-poi ×1

arrays ×1

excel ×1

int ×1

ruby ×1

ruby-on-rails ×1

rubygems ×1

string ×1