> 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

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to