Git Product home page Git Product logo

Comments (4)

hellokaton avatar hellokaton commented on August 25, 2024 1

@RoyXiBoy 我最近在重构这部分代码,100w 行数据读取和写入的测试在 30s 左右。
该版本尚未发布,还有一些其他测试在做,测试代码

from excel-plus.

jhsea3do avatar jhsea3do commented on August 25, 2024

https://github.com/biezhi/excel-plus/blob/c065d137f718a7d6f5f0533734639cfca098e438/src/main/java/io/github/biezhi/excel/plus/writer/ExcelWriter.java#L203

我也遇到了 ,我的做法是挪到for 后面, 重新 while 遍历一遍cols, 专门来 autoSizeColumn

        for (int rowNum = startRow; iterator.hasNext(); rowNum++) {
            T   item = iterator.next();
            Row row  = sheet.createRow(rowNum);
            if (null != rowStyle) {
                row.setRowStyle(rowStyle);
            }
            Iterator<Integer> colIt = columnIndexes.iterator();
            while (colIt.hasNext()) {
                int    col   = colIt.next();
                Cell   cell  = row.createCell(col);
                String value = ExcelUtils.getColumnValue(item, col);
                if (null != columnStyle) {
                    cell.setCellStyle(columnStyle);
                }
                if (null != value) {
                    if (ExcelUtils.isNumber(value)) {
                        cell.setCellValue(Double.valueOf(value));
                    } else {
                        cell.setCellValue(value);
                    }
                } else {
                    cell.setCellValue(value);
                }
                // sheet.autoSizeColumn(col);
            }
        }

        Iterator<Integer> colIt = columnIndexes.iterator();
        while (colIt.hasNext()) {
            int    col   = colIt.next();
            sheet.autoSizeColumn(col);
        }
           

from excel-plus.

RoyXiBoy avatar RoyXiBoy commented on August 25, 2024

还有一个就是使用xssfworkbook再导出2w条的时候就会oom了。建议使用sxssfworkbook装饰xssfworkbook。

from excel-plus.

hellokaton avatar hellokaton commented on August 25, 2024

该版本已发布,忘记这里的 issue 了。

from excel-plus.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.