Bug 14733 - [PATCH] HSSFHeader and HSSFFooter doesnot support for my native language
Summary: [PATCH] HSSFHeader and HSSFFooter doesnot support for my native language
Status: RESOLVED INVALID
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: 2.0-dev
Hardware: PC other
: P3 critical (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-11-21 13:02 UTC by jerry
Modified: 2004-11-16 19:05 UTC (History)
0 users



Attachments
Here is a test program and a test excel file, it will output two excel file (3.50 KB, application/octet-stream)
2002-11-22 01:22 UTC, jerry
Details
Fixed to support multibyte String value of sheet's footer. (7.22 KB, text/plain)
2002-11-27 06:37 UTC, Toshiaki Kamoshida
Details
Fixed to support multibyte String value of sheet's header. (7.20 KB, text/plain)
2002-11-27 06:38 UTC, Toshiaki Kamoshida
Details
Fixed the probrem BoundSheetRecord#setSheetsName() is not synchronize between sheetname and unicode flag. (9.53 KB, text/plain)
2002-11-27 06:41 UTC, Toshiaki Kamoshida
Details
PATCH for FooterRecord and HeaderRecord (9.08 KB, patch)
2002-12-03 04:16 UTC, Toshiaki Kamoshida
Details | Diff
general class for string length less than 2^31-1 org.apache.poi.hssf.record.StringValue2 (6.28 KB, patch)
2002-12-10 11:23 UTC, qiuyiping
Details | Diff
general class for string length less than 255 org.apache.poi.hssf.record.StringValue1 (6.13 KB, patch)
2002-12-10 11:24 UTC, qiuyiping
Details | Diff
HeaderRecord.java rewriten using StringValue2 (7.03 KB, patch)
2002-12-10 11:25 UTC, qiuyiping
Details | Diff
I make testcase for "this" problem. If sheet's header and footer has DBCS,assertions are failed. (1.82 KB, text/plain)
2002-12-13 04:40 UTC, Toshiaki Kamoshida
Details

Note You need to log in before you can comment on or make changes to this bug.
Description jerry 2002-11-21 13:02:09 UTC
Hello, thanks for you effort to make the work easy.


I have some problems when using HSSF classes to make a excel worksheet


First HSSFHeader and HSSFFooter doesnot support for my native language,


I use chinese in it.


I use excel enter an invalid formula in a field and save it as a template, there 
are error using excel to open then file that I use poi to read from the template 
and write to with no change. 


by the way, I tested it using version 1.8 and 1.9
Comment 1 Andy Oliver 2002-11-21 16:18:57 UTC
can you submit (click create a new attachment):

1. A minimal spreadsheet with a chinese header and footer
2. The minimum amount of code necessary to reproduce this problem?
   (code that tries to set a chinese header and footer)

-Andy
Comment 2 jerry 2002-11-22 01:22:49 UTC
Created attachment 3916 [details]
Here is a test program and a test excel file, it will output two excel file
Comment 3 Toshiaki Kamoshida 2002-11-27 06:08:21 UTC
Hello,
I'm Japanese programmer(sorry I can't write english well,so I may make 
incorrect expressions…)working with this useful library.
Thank you for your good effort.

I found the reason of the bug in library's source code.

org.apache.poi.hssf.record.HeaderRecord and 
org.apache.poi.hssf.record.FooterRecord, as concrete record classes of thease 
Objects,Excel sheet's header and footer, are not support String having some 
multibyte characters.In thease classes,String value is always compressed and
lost high byte of Unicode character.

And I found, because of same reason,
org.apache.poi.hssf.record.BoundSheetRecord is not support multibyte String,
so I can't use multibyte String to Excel sheet's name.

Now I'm using library that I fixed thease problems in my local environments.
Please fix thease classes in your repository.
Comment 4 Toshiaki Kamoshida 2002-11-27 06:37:21 UTC
Created attachment 3963 [details]
Fixed to support multibyte String value of sheet's footer.
Comment 5 Toshiaki Kamoshida 2002-11-27 06:38:21 UTC
Created attachment 3964 [details]
Fixed to support multibyte String value of sheet's header.
Comment 6 Toshiaki Kamoshida 2002-11-27 06:41:36 UTC
Created attachment 3965 [details]
Fixed the probrem BoundSheetRecord#setSheetsName() is not synchronize between sheetname and unicode flag.
Comment 7 jerry 2002-11-28 02:24:05 UTC
Thanks for fixing it, I hava tested it with several template, it works.
Comment 8 Toshiaki Kamoshida 2002-11-29 03:47:22 UTC
Sorry, my attatchments are not best solution,but only solved our problems.
I think the best solution is,not having by raw String instance,but delegate to 
some abstract String object,like org.apache.poi.hssf.record.UnicodeString.

I expect thease classes are fixed to good implementation. 
Comment 9 Andy Oliver 2002-11-29 04:11:15 UTC
ensure you put [PATCH] before patches or I won't notice them... Don't close it
unless its been applied.
Comment 10 Andy Oliver 2002-11-29 04:13:36 UTC
Please resubmit with PATCHES instead of the complete files.  It like next to
never works when I have to figure out what is different between a complete file.
See instructions (near the end)
http://jakarta.apache.org/poi/getinvolved/index.html.  Resubmit per the
instructions and reopen.  Thanks.
Comment 11 Toshiaki Kamoshida 2002-12-03 04:16:16 UTC
Created attachment 4013 [details]
PATCH for FooterRecord and HeaderRecord
Comment 12 Toshiaki Kamoshida 2002-12-03 04:20:19 UTC
Sorry I didn't understand the rules for submit patches.
I generated.Please check it.
Comment 13 qiuyiping 2002-12-10 11:20:55 UTC
I write a general String class for this problem.
StringValue2 for string length is a short value and StringValue1 for string 
length is a byte value.
I rewrite the HeaderRecord using StringValue2 class.
Comment 14 qiuyiping 2002-12-10 11:23:46 UTC
Created attachment 4104 [details]
general class for string length less than 2^31-1 org.apache.poi.hssf.record.StringValue2
Comment 15 qiuyiping 2002-12-10 11:24:36 UTC
Created attachment 4105 [details]
general class for string length less than 255 org.apache.poi.hssf.record.StringValue1
Comment 16 qiuyiping 2002-12-10 11:25:37 UTC
Created attachment 4106 [details]
HeaderRecord.java rewriten using StringValue2
Comment 17 Andy Oliver 2002-12-12 23:11:45 UTC
Please resubmit this as a PATCH against the HEAD per the instructions here:
http://jakarta.apache.org/poi/getinvolved/index.html.  Ensure that all unit
tests pass and consider writing one that replicates the conditions you've fixed.
 (which should fail without the patch but succeed after it has been applied).  
Comment 18 Toshiaki Kamoshida 2002-12-13 04:40:46 UTC
Created attachment 4156 [details]
I make testcase for "this" problem. If sheet's header and footer has DBCS,assertions are failed.
Comment 19 Andy Oliver 2002-12-13 14:21:56 UTC
Ahh okay I see now.  There is a patch for header record.  I'm not sure what the
second header record is...  Which of these should I apply?
Comment 20 Toshiaki Kamoshida 2002-12-19 08:06:43 UTC
My patch looks like "first aid" for this problem.
But the implementation Mr.qiuyping? wrote are not only solve this,but may make 
other i18n problems to solve easily.(I don't know his classes are correct for 
other Record classes or not...)
So if you adopt his implementation and plan(replace from raw String object to 
his classes),please ignore my patch.
Comment 21 Andy Oliver 2003-02-08 16:42:27 UTC
lets reopen another bug and attach only the patches which can be applied
especially w/breaking something else.
Comment 22 Toshiaki Kamoshida 2003-02-13 03:47:17 UTC
Hmm…
OK,I'll reopen this problem as a new bug [HSSFHeader and HSSFFooter doesnot 
support DBCS],and resubmit only my testcase and pathces,which will simply solve 
this without breaking something else.
Please wait a moment.