public static void main(String[] args)
throws IOException
{
//String filename = args[0];
String file = "e:\\test.ppt";
POIFSReader r = new POIFSReader();/* Register a listener for *all* documents. */
r.registerListener(new MyPOIFSReaderListener());
r.read(new FileInputStream(file));
}
static class MyPOIFSReaderListener implements POIFSReaderListener{static int filename=1;
public void processPOIFSReaderEvent(POIFSReaderEvent event) {
PropertySet ps = null;
try{
org.apache.poi.poifs.filesystem.DocumentInputStream dis=null;
System.out.println("\n\n");
System.out.println(event.getPath()+event.getName());
dis=event.getStream();
String dest = "e:\\ppt.txt";
FileOutputStream fos= new FileOutputStream(dest);
byte btoWrite[]= new byte[dis.available()];
dis.read(btoWrite,0,dis.available());
for(int i=0;i<btoWrite.length-20;i++){
long type=LittleEndian.getUShort(btoWrite,i+2);
long size=LittleEndian.getUInt(btoWrite,i+4);
if (type==4008){
fos.write(btoWrite,i+4+1,(int)size+3);
}
}//System.out.println(event.getStream().toString());
//ps =
PropertySetFactory.create(event.getStream());
}
catch (Exception ex)
{
//System.out.println("No property set stream: \"" + event.getPath() +
// event.getName() + "\"");
System.out.println(ex);
return;
}
Ryan Ackley wrote:
Search the archives, someone has posted how to do this on the list.
-Ryan
----- Original Message ----- From: "Sergiu Gordea" <[EMAIL PROTECTED]>
To: "POI Users List" <[EMAIL PROTECTED]>
Sent: Wednesday, June 23, 2004 4:01 AM
Subject: Re: POI - HPFS problem
Hi all,
I need to index ppt files for our webserver, so that they will be serchable by lucene. For indexing xls files I used POI and it work quite good, exept that I needed to make the following adjustment in order to access all rows in the xls file:
int rows = sheet.getLastRowNum(); //I don't know why the last row = sheet.getRow(rows) and first row = sheet.getRow(0) for (int r = 0; r <= rows; r++) { HSSFRow row = sheet.getRow(r);
Can anyone give me an example about how can I read the text elements from ppt files?
Sergiu
Rainer Klute wrote:
On Mon, 2004-06-14 at 10:16, Rini van de Wiel wrote:
We were able to 'solve' the problem (read: make it working, for us). This might not be the perfect solution but with all the documents we tested (doc, xls, vsd, ppt) we were able to change the document such that both POI and MS-Word could read the resulting file
Hi Rini,
I just commited the changes you suggested (and a couple of other stuff) to the HEAD of POI's CVS repository. I'd appreciate if you could fetch and crosscheck it.
Many thanks to you and Gidi for pointing out the problem and for the fix!
Best regards Rainer Klute
Rainer Klute IT-Consulting GmbH Dipl.-Inform. Rainer Klute E-Mail: [EMAIL PROTECTED] K�rner Grund 24 Telefon: +49 172 2324824 D-44143 Dortmund Telefax: +49 231 5349423
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
