You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by sailaja Nagarabettu <na...@gmail.com> on 2014/09/16 09:50:10 UTC

modify table cell value

Hi All,

I am facing a issue to modify the exisiting table cell value. I have used
below lines to change the exisiting table cell value bit its not getting
reflected in the ppt.

*if*

(sh[j] *instanceof* Table){ //got a table

Table table1 = (Table)sh[j];

cell = table1.getCell(0,1);

cell.setText(

"hello");

}

When i open the ppt & check the slide the table cell value is shown as
blank instead of hello. Even i tried the below line but it gives exception.
Please let me know how i can modify the table cell so that it gets
reflected in the output ppt.

*slide.addShape(table1);*

*java.lang.ClassCastException*

: org.apache.poi.ddf.EscherTertiaryOptRecord incompatible with
org.apache.poi.ddf.EscherOptRecord

Re: modify table cell value

Posted by narsai <na...@gmail.com>.
<http://apache-poi.1045710.n5.nabble.com/file/n5716684/test.png> 

Shape sh[] = slide.getShapes();
		ArrayList tableData = new ArrayList();
        for (int j = 0; j < sh.length; j++) 
        { 
        	 if (sh[j] instanceof Table){ //got a table
        		 Table table = (Table)sh[j];
        		 TableCell cell1 = table.getCell(0, 2);
        		if(cell1.getText().equalsIgnoreCase("{title}")){
        			TableCell cell = table.getCell(0, j);
				 cell.setText("test");
        		}
        	 }
        }

As u can see in the image one cell is not getting updated as the old value
in the table was blank.



--
View this message in context: http://apache-poi.1045710.n5.nabble.com/modify-table-cell-value-tp5716633p5716684.html
Sent from the POI - User mailing list archive at Nabble.com.

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


Re: modify table cell value

Posted by Tonni Tielens <to...@gmail.com>.
Could you provide the code you use to modify the table cell value? Without
that, it's hard to say what's going wrong.

2014-09-23 7:02 GMT+02:00 narsai <na...@gmail.com>:

> Hi,
>
> Thanks for the reply. I have replaced poi-ooxml-schemas jar with
> ooxml-schemas-1.1.jar and tried but even then its not updating the text.
>  I am using POI 3.8 version and using HSLF to work with PPTs.
>
> Also please let me know how to append a slide to a exisiting ppt(which
> already has slides) after retrieving  the slide from another ppt.
>
>
>
>
>
> --
> View this message in context:
> http://apache-poi.1045710.n5.nabble.com/modify-table-cell-value-tp5716633p5716682.html
> Sent from the POI - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org
>
>

Re: modify table cell value

Posted by narsai <na...@gmail.com>.
Hi,

I have tried with 3.10.1 also but it was not all updating the table cell
values . Please share any working code snippet if u have which is working
for u.





--
View this message in context: http://apache-poi.1045710.n5.nabble.com/modify-table-cell-value-tp5716633p5716686.html
Sent from the POI - User mailing list archive at Nabble.com.

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


Re: modify table cell value

Posted by Nick Burch <ap...@gagravarr.org>.
On Mon, 22 Sep 2014, narsai wrote:
> I am using POI 3.8 version and using HSLF to work with PPTs.

Apache POI 3.8 is rather old, try upgrading

Nick

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


Re: modify table cell value

Posted by narsai <na...@gmail.com>.
Hi,

Thanks for the reply. I have replaced poi-ooxml-schemas jar with
ooxml-schemas-1.1.jar and tried but even then its not updating the text.
 I am using POI 3.8 version and using HSLF to work with PPTs. 

Also please let me know how to append a slide to a exisiting ppt(which
already has slides) after retrieving  the slide from another ppt.





--
View this message in context: http://apache-poi.1045710.n5.nabble.com/modify-table-cell-value-tp5716633p5716682.html
Sent from the POI - User mailing list archive at Nabble.com.

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


Re: modify table cell value

Posted by Tonni Tielens <to...@gmail.com>.
This is due to the fact that the poi-ooxml-schemas is missing some classes
needed to add text to tables in PPT files. Instead you need to remove that
one from your libraries and use the ooxml-schemas-1.1.jar. See:
http://poi.apache.org/overview.html and
http://repo.maven.apache.org/maven2/org/apache/poi/ooxml-schemas/1.1/.

2014-09-16 9:50 GMT+02:00 sailaja Nagarabettu <na...@gmail.com>:

> Hi All,
>
> I am facing a issue to modify the exisiting table cell value. I have used
> below lines to change the exisiting table cell value bit its not getting
> reflected in the ppt.
>
> *if*
>
> (sh[j] *instanceof* Table){ //got a table
>
> Table table1 = (Table)sh[j];
>
> cell = table1.getCell(0,1);
>
> cell.setText(
>
> "hello");
>
> }
>
> When i open the ppt & check the slide the table cell value is shown as
> blank instead of hello. Even i tried the below line but it gives exception.
> Please let me know how i can modify the table cell so that it gets
> reflected in the output ppt.
>
> *slide.addShape(table1);*
>
> *java.lang.ClassCastException*
>
> : org.apache.poi.ddf.EscherTertiaryOptRecord incompatible with
> org.apache.poi.ddf.EscherOptRecord
>