poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yegor Kozlov <ye...@dinom.ru>
Subject Re: Text positions in ppt
Date Fri, 31 Jul 2009 19:25:42 GMT
> I'm trying to determine the (x,y) coordinates for TextRuns within a slide (so
> I can figure out which one is *really* the title!).  Can someone point me to
> some sample code?
> 

The code you need is in Slide#getTitle(), see 
ihttp://svn.apache.org/repos/asf/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/Slide.java

To test whether a shape is the title use the following code:

         for(Shape sh : slide.getShapes()){
             if(sh instanceof TextShape){
                 TextShape tx = (TextShape)sh;
                 TextRun run = tx.getTextRun();
                 int type = run.getRunType();
                 if (type == TextHeaderAtom.CENTER_TITLE_TYPE || type == TextHeaderAtom.TITLE_TYPE
){
                     //got title
                     String title = run.getText();

                 }

             }
         }

Yegor

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Mime
View raw message