odftoolkit icon indicating copy to clipboard operation
odftoolkit copied to clipboard

OdfSpreadsheetDocument: getTables and getTableList

Open HeikoStudt opened this issue 5 years ago • 3 comments

I tried to get a list of all the spreadsheet sheets on a 250k ods using OdfDocument::getTableList() and stopped the process after minutes of full cpu usage.

OdfDocument::getTableList() is using OdfSchemaDocument::getTables() is using fillTableList which is going recursively through all the XML.However, the comment above fillTableList says: "Only tables being on root level are being considered" which is not what fillTableList does.

According to the old "simple" API source and according to OdfDocument::getTableByName only the root level needs to be searched for ODS-Tables, so the comment seems correct. However, I did not look into the specification of ODS and do not know about other document formats and whether they need this method recursively.

I suggest to consider removing the recursive call from fillTableList or document it as a false-friend and create a new one for a list of ODS tables on root level.

HeikoStudt avatar Aug 04 '20 09:08 HeikoStudt

We should drop the old "simple" API source due to duplication - join/fork/rejoin/abundance of IBM from this project - and take over - copy parts of value - to our latest sources. Could you please try this functionality from the latest master branch?

If not available as you need it please copy (from Simple)/add it to the master in a pull request. To keep the master stable please add tests for your functionality - best you modify exiting ones. As we should provide automated tests for all features we like to depend on ;-)

Thanks in advance for any help that you are able to provide! Svante

svanteschubert avatar Aug 04 '20 09:08 svanteschubert

I am a bit confused, as I tried the 1.0.0-BETA1 maven package which, according to documentation, should have been cleaned from the "simple" stuff and does not mark the stuff as Deprecated. Furthermore, I am using the namespace org.odftoolkit.odfdom.* seemingly from the "new" API.

HeikoStudt avatar Aug 04 '20 13:08 HeikoStudt

Obviously we were cross-talking. As you did not mention the release or branch you are working on, but mentioned the "old" Simple API source, I was assuming your work was based on such. In addition, I have double-checked the BETA1 release, there is no Simple API folder accidentally included: https://github.com/tdf/odftoolkit/releases Confusion solved (partly - at least from my side) :-)

What I meant to say, I agree with the improvement of the Table handling as you suggested on the master branch and not on the Simple API deprecated source. I - and likely others - are willing to review your work if you have any suggestion to make as a pull request. Does this solve your confusion as well? ;-)

Cheers, Svante

PS: I will be travelling today and likely not be able to respond until tomorrow afternoon...

svanteschubert avatar Aug 04 '20 15:08 svanteschubert