poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 55280] Poor (Blocking) Performance of Merged Regions
Date Fri, 19 Jul 2013 12:34:32 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=55280

--- Comment #2 from proplant <poipp2013@proplant.de> ---
We migrated from HSSF to XSSF and did not notice the problem with HSSF.

I tried the following code to do a faster remove from outside POI. It is copied
and changed from XSSFSheet.removeMergedRegion(int):

----------------------
    public static void removeMergedRegions(XSSFSheet sheet, HashSet<Integer>
indices) {
        if (indices.size() == 0)
            return;

        CTWorksheet worksheet = getCTWorksheet(sheet);     // via reflection
        CTMergeCells ctMergeCells = worksheet.getMergeCells();

        CTMergeCell[] mergeCellsArray = new
CTMergeCell[ctMergeCells.sizeOfMergeCellArray() - indices.size()];
        int d = 0;
        for (int i = 0 ; i < ctMergeCells.sizeOfMergeCellArray() ; i++) {
            if (! indices.contains(i)) {
                mergeCellsArray[d++] = ctMergeCells.getMergeCellArray(i);
            }
        }
        if(mergeCellsArray.length > 0){
            ctMergeCells.setMergeCellArray(mergeCellsArray);
        } else{
            worksheet.unsetMergeCells();
        }
    }
--------------------
It worked so far, but it doesn't fix the internal usages of removeMergedRegion.
At this point we decided to use a workaround (different excel output).

-- 
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