You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2008/09/01 10:19:35 UTC

DO NOT REPLY [Bug 45720] New: cloneSheet breaks autofilters

https://issues.apache.org/bugzilla/show_bug.cgi?id=45720

           Summary: cloneSheet breaks autofilters
           Product: POI
           Version: unspecified
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: HSSF
        AssignedTo: dev@poi.apache.org
        ReportedBy: antti.koskimaki@joinex.com


Created an attachment (id=22505)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=22505)
excel and sourcecode to reproduce bug

Excel Autofilter does not survive through cloneSheet. Autofilter on original
sheet does work, but on cloned sheet there is UI-component visible but it does
not respond anymore.

Same behaviour on latest SVN (r690837) as well as all 3.0.2-FINAL and
3.1-FINAL.

Excel file + source for reproducing attached.

P.S. how badly does this relate to bug 35125... ???


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


DO NOT REPLY [Bug 45720] cloneSheet breaks autofilters

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45720


Yegor Kozlov <ye...@dinom.ru> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED




--- Comment #5 from Yegor Kozlov <ye...@dinom.ru>  2008-09-07 09:28:19 PST ---
Fixed

If the cloned sheet has drawings, a new drawing group ID must be allocated. It
was a crucial part of the bug.

See Workbook.cloneDrawings(Sheet sheet) for details.

Yegor


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


DO NOT REPLY [Bug 45720] cloneSheet breaks autofilters

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45720


Antti Koskimäki <an...@joinex.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|WONTFIX                     |




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


DO NOT REPLY [Bug 45720] cloneSheet breaks autofilters

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45720





--- Comment #8 from Yegor Kozlov <ye...@dinom.ru>  2008-09-08 06:33:57 PST ---
Josh,

HSSFWorkbook.findExistingBuiltinNameRecordIdx does not find NameRecord if there
is a sheet before the cloned one.
As result, the NameRecord is missing in the output. 

Run the code from the second attachment. The following "if" clause is not
executed: 

int filterDbNameIndex = findExistingBuiltinNameRecordIdx(sheetIndex,
NameRecord.BUILTIN_FILTER_DB);
if (filterDbNameIndex >=0) {
  ...
}

Yegor


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


DO NOT REPLY [Bug 45720] cloneSheet breaks autofilters

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45720





--- Comment #1 from Josh Micich <jo...@gildedtree.com>  2008-09-03 12:58:00 PST ---
I could reproduce this bug fairly easily.  One slight difference however, was
that my Excel(2007) completely crashes when I try to sort using the autofilter
in the newly copied sheet.

To help diagnose, I cloned the sheet in the input spreadsheet using Excel and
ran BiffViewer on that file, and the POI generated file.

The first problem I noticed was a missing NameRecord (of the 'built-in' kind). 
Another cosmetic problem was POI's choice of name for the new sheet.  Excel
adds a space before the bracket e.g. "Test Clone (2)", which upsets the file
offsets and causes false deltas when comparing the BiffViewer files.  If fixed
both these problems in svn r691740. No junit for the built-in name record yet.

After that fix the next difference I tried working on was within the MSODRAWING
record (in the second, copied sheet).  Unfortunately, POI does not interpret
that record when reading from and existing file (BiffViewer does though), so I
had to resort to hex-editing the POI generated XLS file.  After changing a few
bytes (to make the POI generated second MSODRAWING record the same as the Excel
generated one), the file loaded OK in Excel, and the autofilters worked fine.

I will attach the BiffViewer dump of the MSODRAWING records before and after
manual hex editing.


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


DO NOT REPLY [Bug 45720] cloneSheet breaks autofilters

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45720





--- Comment #4 from Yegor Kozlov <ye...@dinom.ru>  2008-09-03 22:33:04 PST ---
> 
> Step 3 might be trivial, but Steps 1 and 2 definitely are not. Can someone who
> knows a bit about drawing records take a look at this?
> 

I'm not sure if (1) is possible. Probably (2) would be enough. We can just
traverse drawing records and update IDs when cloning sheets.

I will look into it and keep you informed about the status.

Yegor


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


DO NOT REPLY [Bug 45720] cloneSheet breaks autofilters

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45720


Antti Koskimäki <an...@joinex.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|FIXED                       |WONTFIX




--- Comment #6 from Antti Koskimäki <an...@joinex.com>  2008-09-07 22:49:51 PST ---
(In reply to comment #5)
> Fixed
> 
> If the cloned sheet has drawings, a new drawing group ID must be allocated. It
> was a crucial part of the bug.

Thanks for quick responses.

I'll verify that you are getting closer, bug seemed to be fixed when tested
with that simple example.

But, something is still wrong when there exists sheet(s) before the cloned one. 


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


DO NOT REPLY [Bug 45720] cloneSheet breaks autofilters

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45720





--- Comment #10 from Antti Koskimäki <an...@joinex.com>  2008-09-09 02:10:14 PST ---
> Please re-open this bug if you find any other special case (of cloning sheets
> with autofilters) that is not handled.

Thanks. Got my real-world case functioning, so everything seems ok for me.


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


DO NOT REPLY [Bug 45720] cloneSheet breaks autofilters

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45720





--- Comment #3 from Josh Micich <jo...@gildedtree.com>  2008-09-03 13:18:03 PST ---
By comparing the BiffViewer dumps, I can see that some internal IDs need
adjusting, as well as an options flag.

There are probably a few steps required to complete this fix:
 1 - Make POI always interpret MSODRAWING records
 2 - Understand the the rules for updating the drawing IDs (do they just have
to be  globally unique, or do they have to coordinate with other records?)
 3 - Implement those rules within HSSFWorkbook.cloneSheet()

Step 3 might be trivial, but Steps 1 and 2 definitely are not. Can someone who
knows a bit about drawing records take a look at this?


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


DO NOT REPLY [Bug 45720] cloneSheet breaks autofilters

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45720





--- Comment #2 from Josh Micich <jo...@gildedtree.com>  2008-09-03 13:08:07 PST ---
Created an attachment (id=22522)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=22522)
Biff dump of MSODRAWING before and after manual hex editing

biff45720-msoDrawing-bad.txt is a BiffViewer dump of the cloned drawing record
(in the second sheet) as generated by POI with the example code of this
bugzilla
biff45720-msoDrawing-good.txt is a BiffViewer dump of the same record after
manual hex editing to make it the same as the one Excel produces.

These changes alone are enough to fix the POI generated XLS file so that the
autofilters work OK in Excel.


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


DO NOT REPLY [Bug 45720] cloneSheet breaks autofilters

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45720


Josh Micich <jo...@gildedtree.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|                            |FIXED




--- Comment #9 from Josh Micich <jo...@gildedtree.com>  2008-09-08 13:00:23 PST ---
(In reply to comment #8)

> HSSFWorkbook.findExistingBuiltinNameRecordIdx does not find NameRecord if there
> is a sheet before the cloned one.

Seemed to be a wrong interpretation of NamedRecord.getSheetNumber().  This bug
would also have affected HSSFWorkbook.setRepeatingRowsAndColumns.  Fixed and
junit added in svn r693221. Attachment (id=22537) seems to work OK now. 

Please re-open this bug if you find any other special case (of cloning sheets
with autofilters) that is not handled.


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


DO NOT REPLY [Bug 45720] cloneSheet breaks autofilters

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45720





--- Comment #7 from Antti Koskimäki <an...@joinex.com>  2008-09-07 22:51:56 PST ---
Created an attachment (id=22537)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=22537)
 excel with two sheets and source to reproduce the bug

> But, something is still wrong when there exists sheet(s) before the cloned one. 

excel with two sheets and source to reproduce the bug


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