For now you can only create tables from scratch. Reading properties of
existing tables is not yet supported. In many senses PPT Table is a
special case and many standard methods don't work with it.
Yegor
> Hello
> I am Tapan currently working on presentation module for a product
> which creates a new presentation from a existing presentation.
> I have created a presentation with a single slide consisting of a table.
> Now I am trying to copy the contents (table) in this slide to a new slide in
> a new presentation.
> I am trying to typecast the shape object into a table object
> where its throwing a java.lang.ClassCastException
> and the shape object which is expected to be a instanceof Table
> class is returning false in the following case:
> if (sh[j] instanceof Table)
> This is the code:
> try{
> Table tabl=(Table)sh[j];
> }
> catch(Exception e){
> System.out.println("Exception is caught:"+e);
> }
>
>
>
> if (sh[j] instanceof Table)
> {
> System.out.println("This is a instance of a table");
> Table tab =(Table)sh[j];
>
> //testing
> System.out.println("no. of rows:"+tab.getNumberOfRows());
> System.out.println("no. of
> columns:"+tab.getNumberOfColumns());
>
> Table table = new Table(tab.getNumberOfRows(),
> tab.getNumberOfColumns());
> for (int p = 0; p < tab.getNumberOfRows(); p++) {
> for (int q = 0; q < tab.getNumberOfColumns(); q++) {
> TableCell cellold = tab.getCell(p, q);
> String test=cellold.getText();
>
> //Testing
> System.out.println("String in the
> cell"+p+","+q+":"+test);
>
> TableCell cell=table.getCell(p,q);
> cell.setText(test);
>
> RichTextRun rt =
> cell.getTextRun().getRichTextRuns()[0];
> rt.setFontName("Arial");
> rt.setFontSize(10);
>
> cell.setVerticalAlignment(TextBox.AnchorMiddle);
>
> cell.setHorizontalAlignment(TextBox.AlignCenter);
> }
> }
> //set table borders
> Line border = table.createBorder();
> border.setLineColor(Color.black);
> border.setLineWidth(4.0);
> table.setAllBorders(border);
> //set width of the 1st column
> table.setColumnWidth(0, 300);
> //set width of the 2nd column
> table.setColumnWidth(1, 150);
> newSlide.addShape(table);
>
>
>
>
> }
> Can anyone please tell me if i am missing anything...
> Thank you.
>
> ---------------------------------
> Get the freedom to save as many mails as you wish. Click here to know how.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]