poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 56440] removeRow in XSSF is much slower than with HSSF
Date Tue, 22 Apr 2014 04:34:39 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=56440

--- Comment #3 from ki <tersitain@gmail.com> ---
thx for answer me.
just the simple file whth the
FormulaCell[=IF((COUNT(U224,U225,U226,U227))>0,ROUND(SUM(U224,U225,U226,U227),6),0)].
The file has 2000rows and 100 cols,size is 1.3 MB,not ON ie.

to delete 20rows for xlsx cost 40sec,but xls is 1sec....

the test soure is under..

import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.usermodel.WorkbookFactory;

public class ReadExcelSheetTest {
    public static void main(final String[] args) throws InvalidFormatException
{
        try {
            String templatePath = "C:\\temp\\test.xlsx";
            FileInputStream fis = null;
            fis = new FileInputStream(templatePath);
            Workbook workbook = WorkbookFactory.create(fis);
            Sheet sheet = workbook.getSheet("a");

            for (int i = 20; i >= 1; i--) {
                Row row = sheet.getRow(i);
                if (row != null) {
                    sheet.removeRow(row);
                    System.out.println("-----" + i);
                }
            }
            workbook.write(new FileOutputStream("C:\\temp\\3.xlsx"));
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


Mime
View raw message