poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Doppelhofer Andreas" <Andreas.Doppelho...@salomon.at>
Subject AW: AW: how to set character encoding in new doc file
Date Fri, 22 Jan 2010 11:28:37 GMT
This code shows my read of the doc file...

        for (int i = 0; i < range.numParagraphs(); i++) {

            Paragraph myparagraph = range.getParagraph(i);
            // line of a line
            String mytext = myparagraph.text();
            mytext = mytext.replace("\r", "");
            mytext = mytext.replace("\n", "");
            ...
            ...
        } 
Is this ok?

> -----Ursprüngliche Nachricht-----
> Von: Doppelhofer Andreas [mailto:Andreas.Doppelhofer@salomon.at] 
> Gesendet: Freitag, 22. Januar 2010 12:06
> An: POI Users List
> Betreff: AW: AW: how to set character encoding in new doc file
> 
> I use HWPFDocument(...) to read the document. When i print 
> the string (some text in doc) to stdout/stderr all characters 
> are displayed correctly, put when i write it to a new doc 
> file, all russian characters are stored with "?".
> 
> This is ok:
> System.out.println(line);
> 
> This is nok: (after opening with word)
> range.insertAfter(line);
> 
> dops
> 
> > -----Ursprüngliche Nachricht-----
> > Von: Nick Burch [mailto:nick.burch@alfresco.com]
> > Gesendet: Freitag, 22. Januar 2010 11:20
> > An: POI Users List
> > Betreff: Re: AW: how to set character encoding in new doc file
> > 
> > On Fri, 22 Jan 2010, Doppelhofer Andreas wrote:
> > > Can anybody help me with this problem?
> > 
> > Word (plus excel, powerpoint etc) can store strings as unicode or 
> > non-unicode. POI works only with java unicode strings, and handles 
> > reading and writing the strings to the appropriate kinds of 
> bytes for 
> > you.
> > 
> > Make sure you're correctly passing your strings as unicode 
> into java, 
> > converting the encoding as needed.
> > 
> > Nick
> > 
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@poi.apache.org For 
> additional 
> > commands, e-mail: user-help@poi.apache.org
> > 
> > 
> 
> -- 
> 
> 
> Salomon Automation GmbH - Friesachstrasse 15 - A-8114 
> Friesach bei Graz Sitz der Gesellschaft: Friesach bei Graz 
> UID-NR:ATU28654300 - Firmenbuchnummer: 49324 K
> Firmenbuchgericht: Landesgericht für Zivilrechtssachen Graz
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org For 
> additional commands, e-mail: user-help@poi.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Mime
View raw message