3

ODF Toolkit provides the method getStringValue() to get the cell string content. If the cell has or even had a comment the getStringValue() returns the existing or former existing comment + the cell content.

Cell cell = column.getCellByIndex(0);
String value = cell.getStringValue();

How do i get only the cell content without the comment?

Example output ('PDF' is the visible cell content):

2014-03-04T00:00:00
kair
media/Dateiname.pdf

PDF

Workaround is parsing the 'value' which is not error proof.

1 Answers1

0

yesterday I was struggling with the same issue and my colleague came up with an answer:

    Cell cell = column.getCellByIndex(0);
    String value = cell.getOdfElement().getLastChild().getTextContent();
ltw
  • 265
  • 2
  • 17