https://issues.apache.org/bugzilla/show_bug.cgi?id=54853

            Bug ID: 54853
           Summary: getText on AutoShape with "-" gives null value
           Product: POI
           Version: unspecified
          Hardware: PC
            Status: NEW
          Severity: major
          Priority: P2
         Component: HSLF
          Assignee: [email protected]
          Reporter: [email protected]
    Classification: Unclassified

Created attachment 30201
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=30201&action=edit
Check the table cell with the value -

I have written code to extract the text from the table in the PPT file.

Sample Code :-

//Import POI classes
import org.apache.poi.poifs.filesystem.*;
import org.apache.poi.hslf.*;
import org.apache.poi.hslf.model.*;
import org.apache.poi.hslf.usermodel.*;

public class createTextFrmPPTTable
{
public static void main( String[] args )
{
String filename = args[ 0 ];
try
{

  SlideShow ppt = new SlideShow( new HSLFSlideShow( filename ) );
  Slide[] slides = ppt.getSlides();
  for( int i=0; i<slides.length; i++ )
  {
   System.out.println("\tTable Object");
   Shape[] sh = slides[i].getShapes();

   for (int k = 0; k < sh.length; k++) {  
     if (sh[k] instanceof ShapeGroup){ //got a table 
       ShapeGroup table = (ShapeGroup)sh[k]; 
       Shape[] ch = table.getShapes(); 

       for (int l=0; l<ch.length; l++){            
         if (ch[l] instanceof TextBox){ 
           TextBox txt = (TextBox)ch[l]; 
           String text = txt.getText(); //text in a table cell
           System.out.println("Textbox text :" + text);
         } else if (ch[l] instanceof AutoShape){
            AutoShape t = (AutoShape)ch[l];
             System.out.println("AutoShape text :" +t.getText());
         }  
     } 
   }
   }
  }
}
catch( Exception e )
{
  e.printStackTrace();
}
}
}

===============================

When you run this code against the given sample file , it gives "null" for the
table cell where you have "-" .

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to