Hi,
I have a problem whit the property "page count" when I try to access a MS Word
document. I have MS Office 2003.
I have a Word document whith 2 pages, and the result in the "page count"
is "1" every time.
POI works fine with Office 2003? What's is the version supported?
Thanks for your help.
Carlos Velázquez
I attached the java code:
*******************************************************************
package com.ecm.office;
import java.io.*;
import org.apache.poi.hpsf.*;
import org.apache.poi.poifs.eventfilesystem.*;
/**
* <p>Title: Librerías de Documentum</p>
*
* <p>Description: Librerías de Documentum</p>
*
* <p>Copyright: Copyright (c) 2005</p>
*
* <p>Company: Sictel</p>
*
* @author Carlos Velázquez Luzardo
* @version 1.0
*/
public class Office {
public Office() {
}
public static void main(String[] args) throws IOException {
final String filename = "C:/Documents and Settings/Carlos
Velázquez/Escritorio/Por Organizar/SCT - Plan de Trabajo (libro blanco).doc";
POIFSReader r = new POIFSReader();
r.registerListener(new MyPOIFSReaderListener
(), "\005SummaryInformation");
r.read(new FileInputStream(filename));
}
static class MyPOIFSReaderListener implements POIFSReaderListener {
public void processPOIFSReaderEvent(POIFSReaderEvent event) {
SummaryInformation si = null;
try {
si = (SummaryInformation)
PropertySetFactory.create(event.getStream());
} catch (Exception ex) {
throw new RuntimeException
("Property set stream \"" +
event.getPath() + event.getName() + "\": " + ex);
}
final String title = si.getTitle();
final int pageCount = si.getPageCount();
if (title != null)
System.out.println("Title: \"" + title + "\"");
else
System.out.println("Document has no title.");
if (pageCount != 0)
System.out.println("Page Count: \"" + pageCount + "\"");
else
System.out.println("Document has no pages.");
}
}
}
---------------------------------------------------------------------
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/