Hi. I'm new to POI and am getting a little perplexed. I'm trying to do something seemingly simple - getting text from each slide in sequence while keeping track of which slide the text is from. However, the slides do not show up in sequence (and it seems like some slides are repeated e.g. try it on http://www.gersteinlab.org/lectures/ppt/A2K-at-Yale-20060422.ppt). Also, I don't know where/how to get the real slide number.

There seems to have been a related discussion here

http://mail-archives.apache.org/mod_mbox/jakarta-poi-user/200603.mbox/[EMAIL 
PROTECTED]

but I'm having difficulty following it (too many dead brain cells I guess). My code is below. Could you tell me what i'm doing wrong and how to fix it? Thanks!

P.S. Why does getSheetNumber() keep giving me -1?

//-----------------------------------------------
import org.apache.poi.hslf.HSLFSlideShow;
import org.apache.poi.hslf.usermodel.*;
import org.apache.poi.hslf.model.*;

public class ppt2txt {

    public static void main(String[] args) {

        try{
       HSLFSlideShow fn = new HSLFSlideShow (args[0]);
       SlideShow ss = new SlideShow (fn);
       Slide[] sa = ss.getSlides();

       for (int i = 0; i < sa.length; i++) { //for each slide

       TextRun[] tr= sa[i].getTextRuns();

       for (int j = 0; j < tr.length; j++) { //for each slide

       String test = tr[j].getRawText();
       System.out.println(test);
       }

       System.out.printf("\n%d\n--------------NEXT SLIDE-----------------\n", 
sa[i].getSheetNumber());
       }
       } catch (java.io.IOException junk) { System.out.println(junk);
        }
    }

}
//-----------------------------------------------



- Mihali

----
.  Mihali A. Felipe
.  Gerstein Lab : Bioinformatics
.  Yale University Molecular Biophysics and Biochemistry
.  203-432-6337


---------------------------------------------------------------------
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/

Reply via email to