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

Can't load basic spreadsheets created in Google Docs #64

Closed
grin opened this issue May 11, 2019 · 4 comments · Fixed by #69
Closed

Can't load basic spreadsheets created in Google Docs #64

grin opened this issue May 11, 2019 · 4 comments · Fixed by #69
Assignees
Labels
bug Something isn't working

Comments

@grin
Copy link
Contributor

grin commented May 11, 2019

Version
'~> 0.6.1'

Describe the bug
Error I'm getting when trying to load very basic spreadsheets:

error: valueNotFound(CoreXLSX.Fonts, Swift.DecodingError.Context(codingPath: [CodingKeys(stringValue: "fonts", intValue: nil)], debugDescription: "Expected Fonts value but found null instead.", underlyingError: nil))

To Reproduce
HelloWorld.xlsx
Blank.xlsx

Attaching two files which fail to load with the below code:

        let f = Bundle.main.url(forResource: "Models.scnassets/levels/HelloWorld", withExtension: "xlsx")!
        guard let file = XLSXFile(filepath: f.path) else {
            fatalError("XLSX file corrupted or does not exist")
        }
      
        do {
            let styles = try file.parseStyles()
            
            let ws = try file.parseWorksheet(at: "xl/worksheets/sheet1.xml")
            for row in ws.data?.rows ?? [] {
                for c in row.cells {
                    print(c)
                }
            }
        } catch CoreXLSXError.archiveEntryNotFound {
              print("CoreXLSXError.archiveEntryNotFound")
        } catch {
            print("error: \(error)")
        }

Expected behavior
The files should load and just ignore empty border/font tags similar to this:

<borders count="1"><border/></borders>
<fonts count="2"><font><sz val="10.0"/><color rgb="FF000000"/><name val="Arial"/></font><font/></fonts>

@grin grin changed the title Can't load basic Google Spreadsheets Can't load basic spreadsheets created in Google Docs May 11, 2019
@MaxDesiatov MaxDesiatov added the bug Something isn't working label May 11, 2019
@MaxDesiatov
Copy link
Collaborator

Hi @grin, thank you for the detailed report, great catch! This is currently blocked by CoreOffice/XMLCoder#101, which is our main dependency. But it should be an easy fix overall. As soon as that PR is merged I'll tag a new XMLCoder release and bump the dependency here, which will fix the reported styles issue.

@grin
Copy link
Contributor Author

grin commented May 11, 2019

@MaxDesiatov Thanks a lot, that was fast! ...and thanks for a great library.

MaxDesiatov added a commit that referenced this issue May 25, 2019
Fix #64

* Fix decoding of Borders model type
* Restore compatibility with previous model types
* Fix test after adding Border model type changes
@MaxDesiatov
Copy link
Collaborator

This is now fixed in master and will be included in 0.6.2 bugfix release.

@MaxDesiatov
Copy link
Collaborator

Uh, looking at it more closely now, there's no way that it will be backward compatible, optionality of a few properties will have to change. This means 0.7.0 instead of 0.6.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants