At 14:59 30.01.2007, Thang To wrote:
>Hello all,
>
>Is there anyway to identify the document language? I know one can retrieve
>the 'language' property in CustomProperties but this property is usually
>unset. When this property is blank, Word is still able to detect the correct
>language of the document.

Hello Thang,

as far as I know Word can set different languages for arbitrary regions of
text. (I "liked" the autodetect language feature a couple of years ago,
because it detected my German technical typing to be French, a few lines
below it decided that I now write Swedish or something like that... I
noticed that only because of the strange quote-signs Word "auto corrected"...)

I did not go into language details, so I'm not sure which is the right
source of information. 

You might first do HWPFDocument.getFileInformationBlock().getLid(), but
this may return the language of the Word which was used to create the file.
Maybe its the default document language - I don't know for sure right now.

If the results look strange, try to use CharacterProperties.getLidDefault()
or ...getLidFE() for far east versions. To retrieve a CharacterProperties
instance get a Range from the document and do something like
range.getCharacterRun(index).cloneProperties().

Best wishes,
Rainer


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