I'm thinking that this is a general rather than specific approach. Whether
you remove one or many rows, that would happen in the place called //
remove a row.

On Mon, May 14, 2018 at 10:52 AM, jsaunders2...@gmail.com <
jsaunders2...@gmail.com> wrote:

>
>
> On 2018/05/11 14:30:44, Andreas Beeker <kiwiwi...@apache.org> wrote:
> > > What is the proper way to delete a row from an XSLFTable?
> >
> > If you aren't modify the table instance further, you can use
> getCTTable().removeTr(index):
> >
> > // prepare some data
> >
> > ByteArrayOutputStream bos = new ByteArrayOutputStream(50000); try
> (XMLSlideShow ppt = new XMLSlideShow()) {
> >     XSLFTable tab = ppt.createSlide().createTable(5, 5); for (int y =
> 0; y < 5; y++) {
> >         for (int x = 0; x < 5; x++) {
> >             tab.getCell(y, x).setText(y + "" + x); }
> >     }
> >     ppt.write(bos); }
> >
> > // remove a row
> >
> > try (XMLSlideShow ppt = new XMLSlideShow(new 
> > ByteArrayInputStream(bos.toByteArray()));
> FileOutputStream fos = new FileOutputStream("test.pptx")) {
> >     XSLFTable tab = (XSLFTable)ppt.getSlides().get(0).getShapes().get(0);
> tab.getCTTable().removeTr(3); ppt.write(fos); }
> >
> >
> > Andi
> >
> >
>
>
> getCTTable().removeTr(index) results in the same exception being thrown. I
> need to delete 100+ table rows in a single powerpoint, many of them in the
> same table. It isn't practical for me to save the file after every row
> delete
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscr...@poi.apache.org
> For additional commands, e-mail: user-h...@poi.apache.org
>
>

Reply via email to