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

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

Introduction

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

Prototype

@Override
    public int getNumberOfColumns() 

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();/* w w w . jav  a2  s.c  o  m*/
            }
            xhtml.element("td", txt);
        }
        xhtml.endElement("tr");
    }
    xhtml.endElement("table");
}