jOpenDocument can't read text cells created by libreoffice 7.0.1

97 views
Skip to first unread message

bdw...@gmail.com

unread,
Aug 31, 2020, 5:55:16 AM8/31/20
to jOpenDocument
I've encountered a surprising problem using jOpenDocument to read ods file created by libreoffice calc version 7.0.1:  the contents of text cells are returned as null.

I've been using jOpenDocument to read ods files for years and have never encountered any problems before.

E.g. I have an ods file with text in cell 0,0 of the first sheet, which I access with:

    File ods = new File("some_file.ods");
    SpreadSheet spreadSheet = SpreadSheet.createFromFile(ods);
    Sheet sheet = spreadSheet.getFirstSheet();
    MutableCell x = sheet.getCellAt(0,0);

Then
    x.isValid(); // returns true
    x.isEmpty(); // returns false
    x.getValueType(); // returns STRING

But

    x.getValue(); // returns null
    x.getTextValue(); // returns null

This problem turned up when I upgraded to libreoffice 7.01, specifically 1:7.0.1~rc1-1~bpo10+1 amd64. It occurs in any file created or opened by libreoffice calc version 7.0.1

FYI I'm using jOpenDocument-1.4rc2 on a debian 10 (buster) system.

Reverting to version 1.6.5-3 (1:6.1.5-3+deb10u6) solves the problem.  In fact, a file created with version 7.01 that has subsequently been opened with version 1.6.5-3 is readable.

The problem does not occur reading 'float' cells.  I have not tested other cell types.

Does anyone have any idea what might be causing a problem like this?

It would be a quite serious problem if jOpenDocument can't read files created by future versions of libreoffice.

Thanks,






 

Guillaume Maillard

unread,
Aug 31, 2020, 5:58:02 AM8/31/20
to jopend...@googlegroups.com
Hi,

Could you provide us the smallest document having this issue in order to investigate
and to make it works on the next jOpenDocument version?

Thanks.

Guillaume

--

---
You received this message because you are subscribed to the Google Groups "jOpenDocument" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jopendocumen...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jopendocument/03bb8601-a2a7-4afd-8bb6-e78d823e906dn%40googlegroups.com.

Barnet Wagman

unread,
Sep 1, 2020, 1:19:37 PM9/1/20
to jOpenDocument
I've attached an ods that has this problem.  FYI the file name includes the string "DO_NOT_OPEN".  That's just a reminder (to me):  if this file is opened with a version of libreoffice calc prior to 7.0.1, the problem seems to get fixed.

Also, the 'new' version of google groups does not support attaching files.  I reverted to the old version to send this.  If you don't get the file, let me know.

Thanks.
To unsubscribe from this group and stop receiving emails from it, send an email to jopend...@googlegroups.com.
xc_0_BAD_V7_eg.DO_NOT_OPEN.ods

bdw...@gmail.com

unread,
Sep 1, 2020, 1:19:37 PM9/1/20
to jOpenDocument
There's an error in my description of the problem.

x.getValue() and  x.getTextValue() do not return null.  They throw NullPointerExceptions. E.g.

Exception in thread "main" java.lang.NullPointerException
    at org.jopendocument.dom.text.TextNode.getCharacterContent(Unknown Source)
    at org.jopendocument.dom.text.TextNode.getChildrenCharacterContent(Unknown Source)
    at org.jopendocument.dom.text.TextNode.getChildrenCharacterContent(Unknown Source)
    at org.jopendocument.dom.spreadsheet.Cell.getTextValue(Unknown Source)
    at org.jopendocument.dom.spreadsheet.Cell.getTextValue(Unknown Source)
    at org.jopendocument.dom.spreadsheet.Cell.getTextValue(Unknown Source)
    at org.jopendocument.dom.spreadsheet.Cell.getValue(Unknown Source)
    at test.ODSTEst.main(ODSTEst.java:35)

Sylvain Cuaz

unread,
Sep 14, 2020, 12:27:22 PM9/14/20
to jopend...@googlegroups.com
> /But/
> /
> /
>     x.getValue(); // returns null
>     x.getTextValue(); // returns null
>
> This problem turned up when I upgraded to libreoffice 7.01, specifically
> 1:7.0.1~rc1-1~bpo10+1 amd64. It occurs in any file created /or opened /by libreoffice calc
> version 7.0.1
>
> FYI I'm using jOpenDocument-1.4rc2 on a debian 10 (buster) system.
>
> Reverting to version 1.6.5-3 (1:6.1.5-3+deb10u6) solves the problem.  In fact, a file
> created with version 7.01 that has subsequently been opened with version 1.6.5-3 is readable.
>
> The problem does not occur reading 'float' cells.  I have not tested other cell types.
>
> Does anyone have any idea what might be causing a problem like this?
>
Hi,

    Yes, LO 7 switched to OpenDocument 1.3. We're working on supporting it. In the mean time, you
can change the format to "1.2 extended". Go to Options, then Load/Save, then General, then ODF
format version.

Cheers,

Sylvain

bdw...@gmail.com

unread,
Sep 14, 2020, 2:17:31 PM9/14/20
to jOpenDocument
Thanks.  I was unaware of the change in LO. Please post a notice when 1.3 is supported.
Reply all
Reply to author
Forward
0 new messages