Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

org.odftoolkit.simple.table.Table#getCellByPosition(int, int) throw java.lang.IllegalArgumentException during autoextend if empty template has formatted 1st row #5

Closed
nekkiy opened this issue Mar 4, 2019 · 7 comments
Labels
wontfix This will not be worked on

Comments

@nekkiy
Copy link

nekkiy commented Mar 4, 2019

I have simple spreadsheet template: empty template has formatted 1st row, see firstRowFormattedTemplate.zip. I tried load this template:

import org.junit.jupiter.api.Test;

import org.odftoolkit.simple.SpreadsheetDocument;
import org.odftoolkit.simple.table.Cell;
import org.odftoolkit.simple.table.Table;

import java.io.InputStream;

public class TestFromTemplate {

    @Test
    public void testWithException() throws Exception {
        SpreadsheetDocument spreadsheetDocument;
        try (InputStream is = getClass().getResourceAsStream("firstRowFormattedTemplate.ots")) {
            spreadsheetDocument = SpreadsheetDocument.loadDocument(is);
        }
        Table table1 = spreadsheetDocument.getSheetByIndex(0);
        Cell cell = table1.getCellByPosition(0, 0);


    }

}

and I catch exception:

java.lang.IllegalArgumentException: index should be nonnegative integer.
at org.odftoolkit.simple.table.Row.getCellByIndex(Row.java:370)
at org.odftoolkit.simple.table.Table.appendColumn(Table.java:1670)
at org.odftoolkit.simple.table.Table.appendColumns(Table.java:1723)
at org.odftoolkit.simple.table.Table.getCellByPosition(Table.java:2865)
at TestFromTemplate.testWithException(TestFromTemplate.java:20)

I enabled debug and saw:
odftookit_1

odftookit_2

I.e. lastColumnIndex is -1 and autoextend down.

@svanteschubert
Copy link
Contributor

I am sorry, but I guess all the Simple API guys have left the project and there is no existing maintainer for this part of the ODF Toolkit. Even worse, it was once meant as fork from the ODFDOM by IBM and they duplicated lot of source code, but never unduplicated (merged) it when they donated it to Apache. Therefore I think the best is to drop this library after our first release. For instance, I am always working on ODFDOM library. My own fork with new collaboration features is already merged with the features of this ODFDOM and likely become the next 1.0.0-SNAPSHOT branch: you may find it at https://github.com/svanteschubert/odftoolkit/tree/odf-changes

@nekkiy
Copy link
Author

nekkiy commented Mar 5, 2019

Thanks. It is sad news for me. I still think that need have simple API for interaction with ODF, probably with different architecture than this simple-odf.

Best regards.

@svanteschubert
Copy link
Contributor

You might just keep Simple API if it suits your needs, I am working solely on ODFDOM. In addition, I am still working on adding some high level API more related to semantic than on XML to ODFDOM.

@svanteschubert
Copy link
Contributor

Still if you want to provide a fix, I would merge it, as for the next first release we are still providing Simple API as Maven JAR.
Going to close this issue after the Maven release.

@nekkiy
Copy link
Author

nekkiy commented Mar 20, 2019

If I have enough time I will work it. But I don't say for sure it now(

@svanteschubert
Copy link
Contributor

We might as well consider to move/refactor back functionality from Simple API to ODFDOM API..

@svanteschubert svanteschubert added the wontfix This will not be worked on label Jun 3, 2019
@svanteschubert
Copy link
Contributor

The Simple API has been deprecated and unless you come up with patches before the next release (where we will remove the API from the ODF Toolkit) we won't fix this issue.

Closing it ... You may reopen in case you still like to provide a patch..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants