Search in sources :

Example 1 with XSLFTableRow

use of org.apache.poi.xslf.usermodel.XSLFTableRow in project poi by apache.

the class XSLFPowerPointExtractor method extractText.

private static void extractText(XSLFShapeContainer data, boolean skipPlaceholders, StringBuilder text) {
    for (XSLFShape s : data) {
        if (s instanceof XSLFShapeContainer) {
            extractText((XSLFShapeContainer) s, skipPlaceholders, text);
        } else if (s instanceof XSLFTextShape) {
            XSLFTextShape ts = (XSLFTextShape) s;
            // Skip non-customised placeholder text
            if (!(skipPlaceholders && ts.isPlaceholder())) {
                text.append(ts.getText());
                text.append("\n");
            }
        } else if (s instanceof XSLFTable) {
            XSLFTable ts = (XSLFTable) s;
            // Skip non-customised placeholder text
            for (XSLFTableRow r : ts) {
                for (XSLFTableCell c : r) {
                    text.append(c.getText());
                    text.append("\t");
                }
                text.append("\n");
            }
        }
    }
}
Also used : XSLFTableRow(org.apache.poi.xslf.usermodel.XSLFTableRow) XSLFShapeContainer(org.apache.poi.xslf.usermodel.XSLFShapeContainer) XSLFTextShape(org.apache.poi.xslf.usermodel.XSLFTextShape) XSLFTable(org.apache.poi.xslf.usermodel.XSLFTable) XSLFShape(org.apache.poi.xslf.usermodel.XSLFShape) XSLFTableCell(org.apache.poi.xslf.usermodel.XSLFTableCell)

Aggregations

XSLFShape (org.apache.poi.xslf.usermodel.XSLFShape)1 XSLFShapeContainer (org.apache.poi.xslf.usermodel.XSLFShapeContainer)1 XSLFTable (org.apache.poi.xslf.usermodel.XSLFTable)1 XSLFTableCell (org.apache.poi.xslf.usermodel.XSLFTableCell)1 XSLFTableRow (org.apache.poi.xslf.usermodel.XSLFTableRow)1 XSLFTextShape (org.apache.poi.xslf.usermodel.XSLFTextShape)1