Search in sources :

Example 6 with XSSFShape

use of org.apache.poi.xssf.usermodel.XSSFShape in project poi by apache.

the class TestXSSFReader method getShapesString.

private String getShapesString(XSSFReader.SheetIterator it) {
    StringBuilder sb = new StringBuilder();
    while (it.hasNext()) {
        it.next();
        List<XSSFShape> shapes = it.getShapes();
        if (shapes != null) {
            for (XSSFShape shape : shapes) {
                if (shape instanceof XSSFSimpleShape) {
                    String t = ((XSSFSimpleShape) shape).getText();
                    sb.append(t).append('\n');
                }
            }
        }
    }
    return sb.toString();
}
Also used : XSSFShape(org.apache.poi.xssf.usermodel.XSSFShape) XSSFRichTextString(org.apache.poi.xssf.usermodel.XSSFRichTextString) XSSFSimpleShape(org.apache.poi.xssf.usermodel.XSSFSimpleShape)

Aggregations

XSSFShape (org.apache.poi.xssf.usermodel.XSSFShape)6 XSSFSimpleShape (org.apache.poi.xssf.usermodel.XSSFSimpleShape)4 InputStream (java.io.InputStream)2 InvalidFormatException (org.apache.poi.openxml4j.exceptions.InvalidFormatException)2 OpenXML4JException (org.apache.poi.openxml4j.exceptions.OpenXML4JException)2 OPCPackage (org.apache.poi.openxml4j.opc.OPCPackage)2 PackagePart (org.apache.poi.openxml4j.opc.PackagePart)2 XmlException (org.apache.xmlbeans.XmlException)2 HashSet (java.util.HashSet)1 Cell (org.apache.poi.ss.usermodel.Cell)1 Comment (org.apache.poi.ss.usermodel.Comment)1 DataFormatter (org.apache.poi.ss.usermodel.DataFormatter)1 Row (org.apache.poi.ss.usermodel.Row)1 Sheet (org.apache.poi.ss.usermodel.Sheet)1 XSSFBCommentsTable (org.apache.poi.xssf.binary.XSSFBCommentsTable)1 XSSFBSharedStringsTable (org.apache.poi.xssf.binary.XSSFBSharedStringsTable)1 XSSFBStylesTable (org.apache.poi.xssf.binary.XSSFBStylesTable)1 ReadOnlySharedStringsTable (org.apache.poi.xssf.eventusermodel.ReadOnlySharedStringsTable)1 XSSFBReader (org.apache.poi.xssf.eventusermodel.XSSFBReader)1 XSSFReader (org.apache.poi.xssf.eventusermodel.XSSFReader)1