DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUGĀ·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=40143>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED ANDĀ·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=40143





------- Additional Comments From [EMAIL PROTECTED]  2007-01-10 06:09 -------
Fixed.

There are three bugs I had to fix:

 (1) Bug in StyleTextPropAtom.
The rule is that sum(length) for paragraph and character style runs must be
text.length + 1.
It was true only for character styles. I had to add the symmetrical code to the
paragraph block.
See the change in StyleTextPropAtom.setParentTextSize

I added a warning if this rule is broken and it helped me to discover two more 
bugs:

 (2) The data setup for data_a and data_c in TestStyleTextPropAtom was wrong. 

What we had for data_a:

        /** From a real file: a paragraph with 4 different styles */
  private byte[] data_a = new byte[] { 
          0, 0, 0xA1-256, 0x0F, 0x2A, 0, 0, 0,
      0x36, 00, 00, 00, // paragraph is 54 long 
      00, 00,           // (paragraph reserved field)
      00, 00, 00, 00,   // it doesn't have any styles
      0x15, 00, 00, 00, // first char run is 21 long
      00, 00, 00, 00,   // it doesn't have any styles
      0x11, 00, 00, 00, // second char run is 17 long
      00, 00, 0x04, 00, // font.color only
      00, 00, 00, 0x05, // blue
      0x10, 00, 00, 00, // third char run is 16 long
      00, 00, 0x04, 00, // font.color only
      0xFF-256, 0x33, 00, 0xFE-256 // red
        };
   private int data_a_text_len = 54;


The value passed to StyleTextPropAtom.setParentTextSize is the text length.
If we read the corresponding style record we should get text.length + 1 chars
covered.
It means that actual text length is 54-1. The same stuff is with data_c. The
text length is 123-1.

 (3) When we construct a new style record we need to pass text.length+1 to the
constructor.
See the change in TextRun.ensureStyleAtomPresent. 

With these changes everything works fine.

Regards,
Yegor

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
Mailing List:    http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta POI Project: http://jakarta.apache.org/poi/

Reply via email to