michael-mammut
michael-mammut

Reputation: 2783

How to modify a tabl value in a Powerpoint with Apache POI?

I read an existing file into my programm an add an new slide (slide 3) with a table. On slide 2 there is also a table, an I have to change some values there. How can I access this table, get the values to recalculate and set the new values in this table.

Apache POI 3.14-20160307

Upvotes: 0

Views: 972

Answers (1)

michael-mammut
michael-mammut

Reputation: 2783

I've done this way. To check it out, I set the name of the shape in powerpoint ( klick in it and then press STRG + F10 ). This is my solution

for(XSLFShape shape : slide){
        shape.getAnchor();

        if (shape instanceof XSLFTable){
            XSLFTable t = (XSLFTable) shape;

            if(t.getShapeName().equals("Table1")){
                t.getCell(1,1).clearText();
                t.getCell(1,1).addNewTextParagraph().addNewTextRun().setText("TABELE 1");
            }
          }
        }

Upvotes: 1

Related Questions