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

Issue with shared strings #188

Closed
JanMarvin opened this issue May 16, 2022 · 2 comments
Closed

Issue with shared strings #188

JanMarvin opened this issue May 16, 2022 · 2 comments
Labels
bug 🐛 Something isn't working help wanted 🙏 Extra attention is needed

Comments

@JanMarvin
Copy link
Owner

JanMarvin commented May 16, 2022

There seems to be an issue with shared strings. When opening the file from #186 I get some strange warning in Excel. I have a similar warning if I load and open the xlsx file from this issue: ycphs/openxlsx#81 (this one is about styles.xml)

Unfortunately both files have a huge shared strings table. I've tried to find something but had no luck. Might be something our parses does to the file, but I'm quite clues at the moment.

Iirc copying sharedstrings.xml solved this, but if that's the only solution, we'd never be able to write shared strings.

@JanMarvin JanMarvin added bug 🐛 Something isn't working help wanted 🙏 Extra attention is needed labels May 16, 2022
@JanMarvin
Copy link
Owner Author

Replacing self$shareStrings with a custom created sst has no error in the shared strings table anymore, it must be something else. Maybe some tag is written as <foo/> and Excel expects <foo></foo> or some strange unicode encoding thing? Theres another issue with some broken cell, but lets ignore that for a minute :>

        write_file(
          head = sprintf(
            '<sst xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" count="%s" uniqueCount="%s">',
            length(self$sharedStrings),
            attr(self$sharedStrings, "uniqueCount")
          ),
          body = stri_join(set_sst(attr(self$sharedStrings, "text")), collapse = "", sep = " "),
          #body = stri_join(self$sharedStrings, collapse = "", sep = ""),
          tail = "</sst>",
          fl = file.path(xlDir, "sharedStrings.xml")
        )

@JanMarvin
Copy link
Owner Author

There is a remaining warning, when opening the file from #186. Excel complains that one or more cells on sheet 2 are damaged. Unfortunately its a 31564 x 52 data frame and even vscode complains that the filesize of sheet2.xml is a bit large. No clue where or what to look for. Numbers reads the file without any complains.

fl <- "https://github.com/JanMarvin/openxlsx2/files/8702731/fichier_complementaire_ccam_descriptive_a_usage_pmsi_2021_v2.xlsx"
wb_load(fl)$open()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something isn't working help wanted 🙏 Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant