You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@poi.apache.org by NSK <co...@yahoo.com> on 2008/02/25 15:14:10 UTC

HPSF Template POI

Hi,
   
  I was trying to change the template of a word document, and was not able to do so. What format of the file path is the setTemplate() function of SummaryInformation expecting ?
   
  I tried to use the removeTemplate() function as well, and it doesn't work either.
   
  I am using POI 3.0.1.
   
  My function goes something like this
   
  ----------------------------------------
   
  try
  {
  DocumentEntry siEntry = (DocumentEntry)
  dir.getEntry(SummaryInformation.DEFAULT_STREAM_NAME);
  DocumentInputStream dis = new DocumentInputStream(siEntry);
  PropertySet ps = new PropertySet(dis);
  dis.close();
  
  si = new SummaryInformation(ps);
  }
  catch (FileNotFoundException ex)
  {
  /* There is no summary information yet. We have to create a new
  * one. */
  si = PropertySetFactory.newSummaryInformation();
  
  }
  
   
  
  if (p_template != null && p_template.length() > 0) {
  si.removeTemplate();
  si.setTemplate("c:\temp\icaseworkmacro.dot");
   
  si.write(dir, SummaryInformation.DEFAULT_STREAM_NAME);
   
  -----------------------------------
   
   
  Am I missing something ?
   
  Please help !!!
   
  Satish
   

       
---------------------------------
Be a better friend, newshound, and know-it-all with Yahoo! Mobile.  Try it now.