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

When string tables entries exceed 1000, a ',' is being inserted in the string table number, resulting in errors opening file #721

Open
gavin-blakeman opened this issue Nov 28, 2023 · 1 comment

Comments

@gavin-blakeman
Copy link

When a worksheet with a large number of string is created, once the string index (number) rolls over to 1000, a 'c' is inserted to the number when it is written to the XML file.

999 1,000 Excel opens with an error and truncates data. LibreOffice uses the wrong string (Uses 1 and ignores the rest of the value)

Without looking at the code, I suspect this is due to the stream being imbued with a locale that then adds the thousands separator to the number when the number is converted to text.

@gavin-blakeman
Copy link
Author

Update: A work around is to ensure that the global locale is setup with a facet that does not implement thousands separators.

I used this link on stack overflow to create a solution. https://stackoverflow.com/questions/10685229/use-local-decimal-separator-but-not-grouping-character-with-stringstream

class no_separator : public std::numpunct_byname {
protected:
virtual string_type do_grouping() const
{ return "\000"; } // groups of 0 (disable)
public:
no_separator() : numpunct_byname(""){}
};

std::locale loc(std::locale(""), new no_separator);
std::locale::global(loc);

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

1 participant