Hello!

> 4 byte for the header (sid + size) + 4 bytes for the fields.  That looks
> like a miscalculation for me (it looks like it should be 0xA +
> getSheetnameLength() -- meaning 4 bytes for the header, 6 bytes for the
> other fields + the length of the string.  That is unless the flag is
> part of the string (which may be the case).  I don't recall this record
> very well which probably means its from November 2001.  
> 
> My recommendation:  
> 
> look here http://sc.openoffice.org/excelfileformat.pdf on page 48.  
> 
> Make the record match that as close as possible.  Modify the toString to
> include a hexdump of the record (see org.apache.poi.util.HexDump). Use
> org.apache.poi.hssf.dev.BiffViewer MyFileWithRussianSheetName.xls. 
> Recreate the sheet with HSSF.  Run org.apache.poi.hssf.dev.BiffViewer
> MyRecreatedSheet.xls -- use the unix diff command on the output. 
> Correct the differences.  Submit a patch.
> 
> The above is serializing compressed or uncompressed unicode via the
> StringUtil with a 3 byte header (offset is = location in the file + 3
> more bytes, then start the string).  I'll bet that there is other code
> that writes stuff into the header.  
> 
> Glen, Marc?  I've not been spelunking in String code in a good long
> time.  (Can you believe that this project is like a whole year old or so
> already???).  Is there anything you can add?
> 
> Sorry if I'm not much help... Its been a good while since I looked
> there.  


Thank you. 
I had the story, while trying to recreate the sheet:

The sizes are seems to be correct,
but I am completly confused with the BoundSheet format.
 
COMPRESSED_UNICODE_EXAMPLE
============================================
Offset 0x6d8 (1752)
recordid = 0x85, size =12
[BOUNDSHEET]
    .bof             = 748
    .optionflags     = 0
    .sheetname length= 4
    .unicodeflag     = 0
    .sheetname       = Page
[/BOUNDSHEET]

============================================
Offset 0x6e8 (1768)

In compessed unicode the size = 8 + sheetLength = 8+ 4 = 12. 
The record length in Java = 12 + sheetLength = 12 + 4 = 16
The record length in Excel = (1768 - 1752 = 14)

I am confused. :( What is wrong?


UNCOMPRESSED_UNICODE_EXAMPLE
============================================
Offset 0x8be (2238)
recordid = 0x85, size =26
[BOUNDSHEET]
    .bof             = 93c
    .optionflags     = 0
    .sheetname length= 9
    .unicodeflag     = 1
    .sheetname       = ���������
[/BOUNDSHEET]

============================================
Offset 0x8dc (2268)

In uncompessed unicode the size = 8 + 2 * sheetLength = 8 + 2 * 9 = 8 + 18 = 26. 
The record length in Java = 12 + 2 * sheetLength = 12 + 18 = 30
The record length in Excel = (2268 - 2238 = 30)

That is OK, but then I try to make such record in serialize the name goes wrong. :(

After serialization on these rulez the wtritten name is incorrect and not opened with 
Excel as well as BiffViewer.
Any help is very very appreciated!
 
Sergei Kozello.

Reply via email to