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 2009/05/11 15:45:09 UTC

DO NOT REPLY [Bug 47182] New: Link between HSSFCell and StyleRecord is broken

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

           Summary: Link between HSSFCell and StyleRecord is broken
           Product: POI
           Version: 3.5-dev
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: HSSF
        AssignedTo: dev@poi.apache.org
        ReportedBy: pinkOtter@gmx.ch


I need the UserStyleName of a cell. But when i call getUserName(), it always
returns null.

    // used version: poi-3.5-beta5, jdk1.6.0_04, excel 97
    FileInputStream input= new FileInputStream(filename);
    HSSFWorkbook worksheet= new HSSFWorkbook(input);
    HSSFSheet sheet = worksheet.getSheetAt(0);
    HSSFRow row = sheet.getRow(0);
    HSSFCell cellBeobachtung= row.getCell(0);
    HSSFCellStyle cellStyleBeobachtung= cellBeobachtung.getCellStyle();
    System.out.println("cellStyleBeobachtung, user name: " +
cellStyleBeobachtung.getUserStyleName());


After putting some effort in it, I figured out, that the StyleRecord is
correctly constructed (number 231 in the records array). But the xf reference
number is 63 which is a dummy value, indicating that the reference is stored
elsewhere:

   OpenOffice, Microsoft Excel File Format, Chapter 2.5.13 Cell Attributes
(BIFF2)
   <snip>
   If a real XF index greater than 62 is used, the XF index field always
contains the value 63, and an
IXFE record (➜5.62) occurs in front of a cell record. The IXFE record contains
the correct index of the XF record.
   <snip>


The method to get the appropriate UserStyleName has two problems. On the one
hand it assumes that all StyleRecords follow directly after the
ExtendenFormatRecords. But there are heaps of UnknownRecords in between the
StyleRecords.
On the other hand are the xf reference numbers which have to treat the number
63 in a different way.


For my excel files, the values are stored in MulRKRecord, there the xf value is
63 (dummy value) and the rk value is 1083088896. Does anybody know what this rk
value means. Can I navigate with this rk value to the StyleRecord?

(I will attach the java source, excel file and 2 printscreens later, since my
internet access is restricted at this place.)

-- 
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 47182] Link between HSSFCell and StyleRecord is broken

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





--- Comment #3 from Sarah <pi...@gmx.ch>  2009-05-11 10:59:48 PST ---
Created an attachment (id=23646)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=23646)
screen shot from debugger

This screenshot shows the code snippet which fails to find the StyleRecord
(with the name Beobachtung). The StyleRecord is selected in the variables view,
it exists, but the method won't find it.

-- 
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 47182] Link between HSSFCell and StyleRecord is broken

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

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

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

--- Comment #4 from Yegor Kozlov <ye...@dinom.ru> 2011-06-25 13:07:01 UTC ---
In your case the user style is a parent of the cell style. The correct code to
check UserStyleName is below:

        HSSFCellStyle style = cell.getCellStyle();
        if(style.getParentStyle() != null){
            HSSFCellStyle  parentStyle = style.getParentStyle();
            String styleName = parentStyle.getUserStyleName();
        }

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 47182] Link between HSSFCell and StyleRecord is broken

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





--- Comment #2 from Sarah <pi...@gmx.ch>  2009-05-11 10:54:22 PST ---
Created an attachment (id=23645)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=23645)
excel file

-- 
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 47182] Link between HSSFCell and StyleRecord is broken

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





--- Comment #1 from Sarah <pi...@gmx.ch>  2009-05-11 10:53:18 PST ---
Created an attachment (id=23644)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=23644)
ExcelBeobachtung.java - the source code

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