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

error: unexpected attribute 'aca' #473

Closed
fcojavmc opened this issue May 28, 2020 · 6 comments
Closed

error: unexpected attribute 'aca' #473

fcojavmc opened this issue May 28, 2020 · 6 comments

Comments

@fcojavmc
Copy link

fcojavmc commented May 28, 2020

I have found this error when loading Excel file (xlsx):

<f aca="false">SUM(G12:G212)</f>

terminate called after throwing an instance of 'xml::parsing'
what(): xl/worksheets/sheet2.xml:2:4178: error: unexpected attribute 'aca'

@linville
Copy link

linville commented Jun 5, 2020

I believe this is related to #436. I had a similar error on a cell: <f ca="1">"5 Jun 2020"</f>. Using the workaround described in one of the comments of #436 worked for me.

@tfussell
Copy link
Owner

tfussell commented Jun 9, 2020

I will fix this soon. It looks like it's aca (Always Calculate Array) attribute on formula elements.

@nschlia
Copy link

nschlia commented Nov 25, 2020

As a work around, I changed xlsx_consumer.cpp at line 226 to call parser->attribute("aca") so that the attribute is marked handled. I guess the correct handling of the attribute needs to be added, but at least the file is opened and read:

index 62d9c418..e3e27ae7 100644
--- a/source/detail/serialization/xlsx_consumer.cpp
+++ b/source/detail/serialization/xlsx_consumer.cpp
@@ -222,6 +222,8 @@ xlnt::detail::Cell parse_cell(xlnt::row_t row_arg, xml::parser *parser)
             else if (string_equal(parser->name(), "f"))
             {
                 c.formula_string += std::move(parser->value());
+
+                    parser->attribute("aca");   // ignore attribute, see https://github.com/tfussell/xlnt/issues/473
             }
         }
         else if (level == 3)

nschlia added a commit to nschlia/xlnt that referenced this issue Nov 25, 2020
nschlia added a commit to nschlia/xlnt that referenced this issue Nov 25, 2020
nschlia pushed a commit to nschlia/xlnt that referenced this issue Nov 26, 2020
…", "ref", "t" and "si" in <f> (formula)

This is *not* a fix, attributes may require to be handled!
@nschlia
Copy link

nschlia commented Nov 28, 2020

I have cloned the project and added a workaround, i.e, the offending attributes (and only those) are simply ignored. Probably these need no further handling and that could remain the final solution. Thats up to @tfussell. Maybe he wants to take my code as a starter to fix this issue. Anyway, the problem files can be loaded with these additions.

@doomlaur
Copy link
Contributor

I can confirm that this issue is present in xlnt v1.5.0 (latest stable release). The fix from @nschlia worked very well, thank you! However, compiling xlnt from the latest commit (currently 3a279fc from 2021-08-22) fixed this issue, so it seems that no fix is needed anymore.

nschlia pushed a commit to nschlia/xlnt that referenced this issue Dec 1, 2021
…ore "aca", "ref", "t" and "si" in <f> (formula)"

This reverts commit cee2a58.
nschlia pushed a commit to nschlia/xlnt that referenced this issue Dec 1, 2021
@nschlia
Copy link

nschlia commented Dec 30, 2021

Confirmed. Fixed with current version. Can be closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants