poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vinod kaky <kak...@yahoo.com>
Subject request.getinputstream() to POI/HSSF
Date Tue, 02 Aug 2005 17:40:45 GMT
I am new to POI, and I am trying to upload a excel
from excel, my requirement is, to use the uploaded
stream directly with POI/HSSF, can anyone suggest me
how that is done, or any suggestions in this regard
will be quite helpfull.

thanks,
Vinod

--- Rainer Klute <klute@rainer-klute.de> wrote:

> Hi Sven,
> 
> can you see your special properties in other
> programs, e.g. the Windows
> Explorer?
> 
> When writing a section with a dictionary, HPSF
> checks whether the
> dictionary's codepage has been set. If it is not
> set, it sets it to
> Unicode. This might cause problems if you have
> non-Unicode strings as
> property values.
> 
> You should try the set the codepage explicitly like
> this:
> mySection.setProperty(PropertyIDMap.PID_CODEPAGE,
> Variant.VT_I2, new Integer(1252));
> 
> Please tell me whether this solves your problem! If
> it does, I'll add a
> setCodepage() method to MutableSection.
> 
> Am Freitag, den 29.07.2005, 15:43 +0200 schrieb Sven
> Billen:
> > Hi,
> > 
> > I'm trying to add some custom properties to a word
> document using HPSF.
> > It seems to work fine, besides that the
> information is not displayed in
> > the properties of the document when I open it
> using MS Word. Also the
> > information will be removed from the document when
> saving it in Word.
> > (I used a hex-editor to be sure, that everything
> is stored in the doc)
> > 
> > This is what I do in detail:
> > 
> > I create a new Section within the
> DocumentSummaryInformation and add a 
> > dictionary and a tag "info".
> > 
> > (I used the WriteAuthorAndTitle example from the
> HowTo)
> > 
> > --- begin of code ---
> > 
> > MutablePropertySet mps = new
> MutablePropertySet(si);
> > MutableSection s = null;
> > Map hm = new HashMap();
> > 
> > // If there is already a second section, then
> write to it.	
> > // Works fine and the information stays within the
> document
> > // even after saving it with MS Word
> > if (mps.getSectionCount() > 1){
> >    s = (MutableSection) mps.getSections().get(1);
> >    hm = s.getDictionary();
> > } // if not, create a new one
> > else {
> >    s = new MutableSection();
> >    s.setDictionary(hm);
> >   
>
s.setFormatID(SectionIDMap.DOCUMENT_SUMMARY_INFORMATION_ID);
> >    mps.addSection(s);
> > }
> > 
> > [...]
> > 
> > String info = "Hello World";
> > 
> > // size +2, becaus position 0 is the dictionary
> > // and 1 is the codepage
> > long posInfo = hm.size() + 2;
> > 
> > hm.put(new Long(posInfo), "info");
> > 
> > // creating a new property
> > MutableProperty p = new MutableProperty();
> > p.setType(Variant.VT_LPSTR);
> > p.setValue(info);
> > p.setID(posInfo);
> > 
> > s.setProperty(p);
> > 
> > // write to file etc.
> > InputStream pss = mps.toInputStream();
> > de.createDocument(name, pss);
> > 
> > --- end of code ---
> > 
> > I compared the output of POI to a document I
> created in MS Word using
> > the ReadCustomPropertySets example and the only
> difference I found was
> > the codepage set to 1200 by POI and 1252 by MS
> Word.
> > 
> > Any hints what I am doing wrong?
> > 
> > Thanks in advance,
> > 
> > Sven
> > 
> > 
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> poi-user-unsubscribe@jakarta.apache.org
> > Mailing List:    
> http://jakarta.apache.org/site/mail2.html#poi
> > The Apache Jakarta Poi Project: 
> http://jakarta.apache.org/poi/
> 
> 
> Best regards
> Rainer Klute
> 
>                            Rainer Klute
> IT-Consulting GmbH
>   Dipl.-Inform.
>   Rainer Klute             E-Mail: 
> klute@rainer-klute.de
>   K├Ârner Grund 24          Telefon: +49 172 2324824
> D-44143 Dortmund           Telefax: +49 231 5349423
> 
> Public key fingerprint:
> E4E4386515EE0BED5C162FBB5343461584B5A42E
> 
> European Parliament rejects software patent bill:
> http://news.bbc.co.uk/1/hi/technology/4655955.stm
> 



		
____________________________________________________
Start your day with Yahoo! - make it your home page 
http://www.yahoo.com/r/hs 
 

---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/


Mime
View raw message