No, I meant TextBox. Rectangle was a subclass of TextBox. It is obsololete and was removed some time ago.
EE> The line: EE> if (sh[i] instanceof TextBox) EE> is meant to be: EE> if (sh[i] instanceof Rectangle) EE> ? EE> -----Original Message----- EE> From: Yegor Kozlov [mailto:[EMAIL PROTECTED] EE> Sent: Thursday, June 08, 2006 9:41 AM EE> To: POI Users List EE> Subject: Re[2]: org.apache.poi.hslf.model.TextRun EE> Hi EE> TextRun is just a holder of the text. If you want to work with shapes EE> you should use Slide.getShapes() which returns a collection of shapes EE> in the slide: EE> SlideShow ppt = new SlideShow(new HSLFSlideShow(filename)); EE> Dimension pgsize = ppt.getPageSize(); //page size EE> Slide sl = ppt.getSlides()[0]; EE> Shape[] sh = sl.getShapes(); EE> for (int i = 0; i < sh.length; i++) { EE> //anchor of the shape EE> java.awt.Rectangle anchor = sh[i].getAnchor(); EE> if (sh[i] instanceof TextBox){ EE> TextBox box = (TextBox) EE> String text = box.getText(); EE> String font = box.getFontName(); EE> int size = box.getFontSize(); EE> ... EE> } EE> } EE> Warning: In the current implementation you can get text attributes only EE> if EE> they are explicitly set. For example, if you don't change the default EE> font size box.getFontSize() return -1 which means n/a. In this case EE> PowerPoint EE> uses the default font size which is stored in special container EE> TxMasterStyleAtom which is not decoded yet. EE> Also the object model for working with character/paragraph attributes EE> is likely to change. Current code is rather demonstration of EE> capabilities, not the final version. EE> Some documentation is available at EE> http://jakarta.apache.org/poi/hslf/how-to-shapes.html EE> Regards, Yegor EE>> I am asking about the TextRun[] return from the method EE>> org.apache.poi.hslf.model.Slide.getTextRuns(). EE>> For each TextRun, I want to know its x/y position. EE>> -----Original Message----- EE>> From: Nick Burch [mailto:[EMAIL PROTECTED] EE>> Sent: Wednesday, June 07, 2006 5:05 PM EE>> To: Erez Eisenstein EE>> Cc: POI Users List EE>> Subject: Re: org.apache.poi.hslf.model.TextRun EE>> Please always use the lists for asking POI questions. EE>> On Wed, 7 Jun 2006, Erez Eisenstein wrote: >>> How can I get the position (x,y coordinates) of a TextRun in the EE>> slide? EE>> That depends on what kind of text run it is. If it's text positioned EE>> acording to the master slide, then because we don't currently grok EE> the EE>> master slides, that information isn't available. EE>> If it's a text run stored in an Escher object EE> (EscherTextboxWrapper), EE>> you EE>> can get some information on the object's position from the parent EE> Escher EE>> objects. EE>> Nick EE>> EE> --------------------------------------------------------------------- EE>> To unsubscribe, e-mail: [EMAIL PROTECTED] EE>> Mailing List: http://jakarta.apache.org/site/mail2.html#poi EE>> The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/ EE> --------------------------------------------------------------------- EE> To unsubscribe, e-mail: [EMAIL PROTECTED] EE> Mailing List: http://jakarta.apache.org/site/mail2.html#poi EE> The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/ EE> --------------------------------------------------------------------- EE> To unsubscribe, e-mail: [EMAIL PROTECTED] EE> Mailing List: http://jakarta.apache.org/site/mail2.html#poi EE> The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/ --------------------------------------------------------------------- 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/
