poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 47624] File Error Data May Have been Lost error while opening commented workbook(excel file)
Date Thu, 18 Mar 2010 08:44:29 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=47624

--- Comment #3 from nothize <nothize@gmail.com> 2010-03-18 08:44:26 UTC ---
A simple workaround as a PoC is as below.

Where Invoker is a reflection util to read the private property by force.

-----------------------
        if ( null == drawing ) {
            drawing = sh.createDrawingPatriarch();
            // Remove redundant records to avoid error.

            Sheet _sh = (Sheet)Invoker.getProperty(sh, "_sheet");
            List list = _sh.getRecords();
            for ( Iterator it = list.iterator(); it.hasNext(); ) {
                RecordBase e = (RecordBase)it.next();
                if ( e instanceof TextObjectRecord || e instanceof
DrawingRecord || e instanceof ObjRecord ) {
                    it.remove();
                }
            }
        }
-----------------------

The idea is that the Sheet.aggregateDrawingRecords(..) called by
HSSFSheet.createDrawingPatriarch() fails to remove and also destroyed the
pairing of DrawingRecord and *ObjRecord that causing the Excel open file error
prompt.

The patch to Sheet.java will follow.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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