Bugfix/document properties namespaces #460
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello, we have encountered a bug with rubyXL which appears to have been reported already. We have forked the project and created a pull request. If you'd like some changes before merging the pull request, please let us know.
Fixes Issue #332
The error reported in #332 was caused by editing a xlsx file with very minimal extended document properties. For example a xlsx file with the following docProps/app.xml:
RubyXL currently adds the worksheet count to the extended document properties, but uses only the namespaces defined in the original file (see lib/rubyXL/objects/ooxml_object.rb:315). This leads to an invalid app.xml, because in the original file the "vt" namspace is not defined.
This pull request fixes the issue, so the default namespaces for the document properties object are always set (xmlns && xmlns:vt). Should the document define additional namespaces (or different hrefs for the prefixes) the values of the document are preferred to the default ones (like before).
Related to Issue #446
This error is just a re-report. So this pull request should fix the underlying cause as well. But the attached xlsx file (rubyxl_issue_332_example.xlsx) is already corrupted (meaning the "vt" namespace is missing), and because of this still causes an error:
Maybe this could be fixed, but considering Excel shows an alert when opening the file, it might be better to just keep the error, so it does not go unnoticed.