Re: [jopendocument] IllegalArgumentException : Cannot get sheets from an ODS file

521 views
Skip to first unread message

Douglas E Wegscheid

unread,
Jun 4, 2013, 3:22:36 PM6/4/13
to jopend...@googlegroups.com, jopend...@googlegroups.com

may want to look at Apache-Tika if you are trying to just extract content. I know it does ODF, not sure about ODS.
DOUGLAS E. WEGSCHEID // Lead Analyst, Directories
(269) 923-5278 // Douglas_E...@whirlpool.com

"A wrong note played hesitatingly is a wrong note. A wrong note played with conviction is interpretation."


Robin Naceur <robin....@gmail.com>
Sent by: jopend...@googlegroups.com

06/04/2013 05:20 AM

Please respond to
jopend...@googlegroups.com

To
jopend...@googlegroups.com
cc
Subject
[jopendocument] IllegalArgumentException : Cannot get sheets from an ODS file





Good morning !

I am working on a project right now where I need to read ODS files in order to store data in a database.

I download files from a french website (ODS Files) and I try to "parse" them. However, for some files I have downloaded, it doesn't work when I try to get the sheets.
I have been looking for a solution everywhere but I can't find anything. I can't even find someone who has the same issue.

Here code line where it generates an exception  :
sheet = SpreadSheet.createFromFile(file).getSheet(2);

And below, a part of the exception generated.

Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: Cannot change format version from org.jopendocument.dom.XMLFormatVersion@ce6e6b3 OD version null to org.jopendocument.dom.XMLFormatVersion@cfddf7f OD version 1.1
   at org.jopendocument.dom.ODPackage.checkVersion(Unknown Source)
   at org.jopendocument.dom.ODPackage.setTypeAndVersion(Unknown Source)
   at org.jopendocument.dom.ODPackage.updateTypeAndVersion(Unknown Source)
   at org.jopendocument.dom.ODPackage.putFile(Unknown Source)
   at org.jopendocument.dom.ODPackage$1.processEntry(Unknown Source)
   at org.jopendocument.util.ZippedFilesProcessor.process(Unknown Source)
   at org.jopendocument.dom.ODPackage.<init>(Unknown Source)
   at org.jopendocument.dom.ODPackage.<init>(Unknown Source)
   at org.jopendocument.dom.spreadsheet.SpreadSheet.createFromFile(Unknown Source)


I hope you can help me :)

Thank you in advance for your response and sorry for my english.

--

---
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.
For more options, visit
https://groups.google.com/groups/opt_out.

Sylvain Cuaz

unread,
Jun 10, 2013, 4:21:48 AM6/10/13
to jopend...@googlegroups.com
Le 04/06/2013 11:20, Robin Naceur a �crit :
Hi,

This means that 2 files in your spreadsheet are not in agreement over the version. From what I see,
it might be because some file lacks the required office:version attribute (e.g. content.xml has
version 1.1 and styles.xml has no version). If you could send the ODS, I will look at it. Also what
version of jOpendDocument are you using ?


> I hope you can help me :)
>
> Thank you in advance for your response and sorry for my english.

Pas de probl�me :)


Cheers,
Sylvain

Michal Rajčan

unread,
Jun 23, 2013, 7:38:43 AM6/23/13
to jopend...@googlegroups.com
Good day,
I just want to ask, if you have solved your problem? If so, how?
I need to do the same task and my project stopped with this same error as yours and i have no idea, how to fix it.

Thanks,

Michal

Sylvain Cuaz

unread,
Jun 24, 2013, 3:34:23 AM6/24/13
to jopend...@googlegroups.com
Hi,

As I've said before, it seems that the file isn't valid. If you could send the file so that I can
take a look.

Cheers,
Sylvain

Sylvain Cuaz

unread,
Aug 27, 2013, 5:11:36 AM8/27/13
to jopend...@googlegroups.com
Hi all,

One of our customers had a file causing the same exception as Douglas and Michal. The problem was
easy to spot once I had a look at the file : a file created by LibreOffice (or jOpenDocument) and
then modified by Microsoft Office will contain files with mixed versions (or more precisely with 1.1
and null versions). The next version of jOpenDocument will handle this.

Cheers,
Sylvain
Reply all
Reply to author
Forward
0 new messages