You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Gerson <ge...@yahoo.com.br> on 2006/08/14 16:05:28 UTC

Extracting Tables from PowerPoint

Hi,

 

I´ve searched but haven’t found anything. Can anybody help me on how to
extract Tables from PPT using POI.

 

 

Thnx,

 

 

Gerson Albuquerque


Re: RES: Extracting Tables from PowerPoint

Posted by Yegor Kozlov <ye...@dinom.ru>.
If you need the text in cells use TextRun.getText().
Does it return the correct text?

TextRun.getRichTextRuns() is supposed to return an array of runs of
text with the same styling. The size of the array of RichTextRuns should be greater than 0.
Could you attach your ppt file and we will look at it?

Yegor

G> Hi,

G> Using your example below, I was able to identify the number of cells
G> correctly, but the text is not coming, when I ask the length of the array of
G> RichTextRuns from the text boxes, it returns 0 (Zero).

G> Do you know why this can be happening, and a possible solution?

G> Thnx again,


G> Gerson Albuquerque

G> -----Mensagem original-----
G> De: Yegor Kozlov [mailto:yegor@dinom.ru] 
G> Enviada em: segunda-feira, 14 de agosto de 2006 11:26
G> Para: POI Users List
G> Assunto: Re: Extracting Tables from PowerPoint

G> Hi,

G> A table in PowerPoint is a group of shapes.
G> It HSLF API it is represented by a org.apache.poi.hslf.model.ShapeGroup
G> class.
G> Typically a table consists of TextBox and Line objects which represent
G> text runs and borders.

G> Below is sample code how to iterate over table cells:

G>  Slide slide = ...;
G>  Shape[] sh = slide.getShapes();
G>  for (int i = 0; i < sh.length; i++) {
G>    if (sh[i] instanceof ShapeGroup){ //got a table
G>      ShapeGroup table = (ShapeGroup)sh[i];
G>      Shape[] ch = table.getShapes();
G>      for (int j=0; j<ch.length; j++){
G>        if (ch[j] instanceof TextBox){
G>          TextBox txt = (TextBox)ch[j];
G>          String text = txt.getText(); //text in a table cell
G>        }
G>      }
G>    }
G>  }

G> Creating new tables is not yet supported. It's clear how to implement
G> it, just need time.
 
G> Regards, Yegor
 
G>> Hi,

 

G>> I´ve searched but haven’t found anything. Can anybody help me on how to
G>> extract Tables from PPT using POI.

 

 

G>> Thnx,

 

 

G>> Gerson Albuquerque


G> ---------------------------------------------------------------------
G> To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
G> Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
G> The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/







G> _______________________________________________________
G> Você quer respostas para suas perguntas? Ou você sabe muito e quer compartilhar seu conhecimento? Experimente o Yahoo! Respostas !
G> http://br.answers.yahoo.com/

G> ---------------------------------------------------------------------
G> To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
G> Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
G> The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/


---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/


RES: Extracting Tables from PowerPoint

Posted by Gerson <ge...@yahoo.com.br>.
Hi,

Using your example below, I was able to identify the number of cells
correctly, but the text is not coming, when I ask the length of the array of
RichTextRuns from the text boxes, it returns 0 (Zero).

Do you know why this can be happening, and a possible solution?

Thnx again,


Gerson Albuquerque

-----Mensagem original-----
De: Yegor Kozlov [mailto:yegor@dinom.ru] 
Enviada em: segunda-feira, 14 de agosto de 2006 11:26
Para: POI Users List
Assunto: Re: Extracting Tables from PowerPoint

Hi,

A table in PowerPoint is a group of shapes.
It HSLF API it is represented by a org.apache.poi.hslf.model.ShapeGroup
class.
Typically a table consists of TextBox and Line objects which represent
text runs and borders.

Below is sample code how to iterate over table cells:

 Slide slide = ...;
 Shape[] sh = slide.getShapes();
 for (int i = 0; i < sh.length; i++) {
   if (sh[i] instanceof ShapeGroup){ //got a table
     ShapeGroup table = (ShapeGroup)sh[i];
     Shape[] ch = table.getShapes();
     for (int j=0; j<ch.length; j++){
       if (ch[j] instanceof TextBox){
         TextBox txt = (TextBox)ch[j];
         String text = txt.getText(); //text in a table cell
       }
     }
   }
 }

Creating new tables is not yet supported. It's clear how to implement
it, just need time.
 
Regards, Yegor
 
G> Hi,

 

G> I´ve searched but haven’t found anything. Can anybody help me on how to
G> extract Tables from PPT using POI.

 

 

G> Thnx,

 

 

G> Gerson Albuquerque


---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/



	

	
		
_______________________________________________________ 
Você quer respostas para suas perguntas? Ou você sabe muito e quer compartilhar seu conhecimento? Experimente o Yahoo! Respostas !
http://br.answers.yahoo.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/


Re: Extracting Tables from PowerPoint

Posted by Yegor Kozlov <ye...@dinom.ru>.
Hi,

A table in PowerPoint is a group of shapes.
It HSLF API it is represented by a org.apache.poi.hslf.model.ShapeGroup class.
Typically a table consists of TextBox and Line objects which represent
text runs and borders.

Below is sample code how to iterate over table cells:

 Slide slide = ...;
 Shape[] sh = slide.getShapes();
 for (int i = 0; i < sh.length; i++) {
   if (sh[i] instanceof ShapeGroup){ //got a table
     ShapeGroup table = (ShapeGroup)sh[i];
     Shape[] ch = table.getShapes();
     for (int j=0; j<ch.length; j++){
       if (ch[j] instanceof TextBox){
         TextBox txt = (TextBox)ch[j];
         String text = txt.getText(); //text in a table cell
       }
     }
   }
 }

Creating new tables is not yet supported. It's clear how to implement
it, just need time.
 
Regards, Yegor
 
G> Hi,

 

G> I´ve searched but haven’t found anything. Can anybody help me on how to
G> extract Tables from PPT using POI.

 

 

G> Thnx,

 

 

G> Gerson Albuquerque


---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/