相关疑难解决方法(0)

如何在java中的excel文件的同一张表中插入带有值的新行

我想在 Excel 工作表中写入时插入新行。

这是我的代码:

public static void addValuesInWorkbook(String pathAndFileName, String sheetName,
            int rowNum, String valuesString,String delimeter) {
        if(pathAndFileName.length() > 0 && sheetName.length() > 0 && rowNum >= 0 && valuesString.length() > 0 && delimeter.length() > 0)
        {
            String[] colValues= null;
            if("|".equals(delimeter))
                colValues = valuesString.split("\\|");
            else
                colValues = valuesString.split(delimeter);
            int cellnum = 0;
            FileInputStream fsIP;
            try {
                fsIP = new FileInputStream(new File(pathAndFileName));
             //Read the spreadsheet that needs to be updated
            if(rowNum > 0)
            {
                rowNum--;               //As row indexing starts from 0 …
Run Code Online (Sandbox Code Playgroud)

java apache-poi

4
推荐指数
1
解决办法
8271
查看次数

标签 统计

apache-poi ×1

java ×1