Hey I think I found the problem, and it wasn't what I mentioned before.

in PAPFormattedDiskPage, right after the code to get the size of the PAPX/GRPPRL, the code creates a new papx byte array and then populates it starting with THE NEXT BYTE! That's wrong! The next byte should be the istd.

so the code:
[WRONG-CODE]
if(size == 0)
{
size = 2 * LittleEndian.getUnsignedByte(_fkp, _offset + ++papxOffset);
}
else
{
size--;
}


      byte[] papx = new byte[size];
      System.arraycopy(_fkp, _offset + ++papxOffset, papx, 0, size);
[/WRONG-CODE]

Should read:
[CORRECT-CODE]
if(size == 0)
{
size = 2 * LittleEndian.getUnsignedByte(_fkp, _offset + ++papxOffset);
}
else
{
size--;
}


//HERE'S THE CHANGE
byte istd = _fkp[ ++papxOffset ]; //THIS MOVES IT FORWARD PAST THE istd BYTE


      byte[] papx = new byte[size];
      System.arraycopy(_fkp, _offset + ++papxOffset, papx, 0, size);
[/CORRECT-CODE]

This fixes my problem where I was getting SprmType's of 0. They're now all valid. I hope this helps!




From: "Robert Paris" <[EMAIL PROTECTED]>
Reply-To: "POI Developers List" <[email protected]>
To: [email protected]
Subject: Trying to understand PAPX Code
Date: Fri, 08 Apr 2005 05:09:46 +0000

Can someone explain this to me?

In the code for getting the PAPX (getGrpprl of PAPFormattedDiskPage), the following code is used to determine the size of the PAPX:

[CODE]
int papxOffset = 2 * LittleEndian.getUnsignedByte(_fkp, _offset + (((_crun + 1) * FC_SIZE) +
(index * BX_SIZE)));
int size = 2 * LittleEndian.getUnsignedByte(_fkp, _offset + papxOffset);
..other code elided ..
[/CODE]


What I don't understand is the papxOffset code and the size code. As I understand the documentation, the first byte of the PAPX (since we're in an FKP here) holds the count of words for this PAPX. So why isn't the papxOffset simply:

int papxOffset = _offset + ( ( ( _crun + 1 ) * FC_SIZE ) + ( index * BX_SIZE ) ) ) + 1;

I don't understand why you're getting the last byte of the BX's and then multiplying that value by 2. I don't see where in the documentation it says that the byte at that spot is something that indicates our offset for the PAPX's. (I may be missing something)

I ask because in using the above code, I keep getting weird values, such as my sprm types keep coming up as 0, which of course is not a valid type. Can someone explain the above code to me?

Thank you very much for any help you guys can give!

Robert



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




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