Example usage for org.apache.poi.hslf.usermodel HSLFTable getNumberOfRows

List of usage examples for org.apache.poi.hslf.usermodel HSLFTable getNumberOfRows

Introduction

In this page you can find the example usage for org.apache.poi.hslf.usermodel HSLFTable getNumberOfRows.

Prototype

@Override
    public int getNumberOfRows() 

Source Link

Usage

From source file:org.apache.tika.parser.microsoft.HSLFExtractor.java

License:Apache License

private void extractTableText(XHTMLContentHandler xhtml, HSLFTable shape) throws SAXException {
    xhtml.startElement("table");
    for (int row = 0; row < shape.getNumberOfRows(); row++) {
        xhtml.startElement("tr");
        for (int col = 0; col < shape.getNumberOfColumns(); col++) {
            HSLFTableCell cell = shape.getCell(row, col);
            //insert empty string for empty cell if cell is null
            String txt = "";
            if (cell != null) {
                txt = cell.getText();/*ww  w  .  j  av  a 2  s. c  o m*/
            }
            xhtml.element("td", txt);
        }
        xhtml.endElement("tr");
    }
    xhtml.endElement("table");
}