Some general thoughts on your requirements

1. People do use POI to read and write sheets with
Japanese/Chinese/Korean/Russian... etc characters in them ... you'll
find that if you search the mailing list. 

2. In the same vein, many bugs have been reported in the use of POI with
multibyte characters, many have been fixed, some are still
outstanding... search bugzilla for them. 

3. In general, I am not to sure what you mean by "contain Japanese
strings encoded in Shift-JIS encoding". Two things here.. one i am
pretty sure of, one i am guessing a bit. What I am pretty sure of, is
that you are looking at the wrong place to find a method to specify the
encoding...

Remember, you need to specify the encoding where you are converting from
a stream of bytes to a stream of characters. This is the what, for
example java Writers do, so they have the relevant methods. Streams only
work on bytes, so "encoding" is not relevant for them. What POI writes
is a stream of bytes that makes sense to Excel. The conversion from
characters to bytes are done by Excel rules, not Java or Unicode
rules... thats the reason why wb.write(..) takes an OutputStream and
nothing else. 

This leads on to my other point, where i might stand corrected. Why to
you want to specify the "Shift-JIS" encoding? Usually, environments have
their own internal encoding, and you need to specify you own encoding
only while doing IO. So Java internally uses UCS16 (aka UTF-16) for all
in memory characters/strings. You need to specify the encoding only if
you are reading or writing a file, or storing it in a database etc.. ie,
moving it in/out of the JVM's memory. So excel, AFAIK, has its own
internal encoding representation, (which i think is a variation of
UTF-16 for double byte characters..) .. so i dont understand why you
insist on storing characters in Shift-JIS in Excel.. .

Ok, to cut a long story short, all that should be needed is 
cell.setCellEncoding(..) //set this to take double byte chars
cell.setCellValue(someJavaStringVariableContainingJapanese);

Hope this makes sense ... its too late at night for me to make sense :).
Shout if you have any questions. 

Regards
-
Avik


On Wed, 2003-10-22 at 18:53, Mudit Gupta wrote:
>  
> 
>  
> 
> Hi All,
> 
>  
> 
> We are planning to use POI for creating an XLS file from a J2EE based
> application.
> 
>  
> 
> The application server is WebLogic 8.1, OS is Solaris 8.
> 
>  
> 
> However, the XLS to be created will contain Japanese strings encoded
> in Shift JIS encoding.
> 
>  
> 
> After checking the POI API, what we found there is no place where one
> can specify the encoding of the XLS file to be created. Typically it
> is done through OutputStreamWriter of java.io. However, the relevant
> APIs (wb.create(java.io.OutputStream stream))in POI, which can be used
> to write strings in the XLS file, accepts only OutputStream object.
> 
>  
> 
> In this situation, can anyone please let us know how POI can be used
> to create a XLS file with Japanese strings encoded in Shift_JIS ?
> 
>  
> 
> Regards,
> 
> Sourav
> 
> 
> 
> ______________________________________________________________________
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to