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

Fix invalid xml when pivot table created with more than one column in data field #123

Merged
merged 1 commit into from
Jan 28, 2022

Conversation

westonganger
Copy link
Contributor

Solves #110

@@ -173,7 +173,8 @@ def relationships
# @return [String]
def to_xml_string(str = '')
str << '<?xml version="1.0" encoding="UTF-8"?>'
str << ('<pivotTableDefinition xmlns="' << XML_NS << '" name="' << name << '" cacheId="' << cache_definition.cache_id.to_s << '" dataOnRows="1" applyNumberFormats="0" applyBorderFormats="0" applyFontFormats="0" applyPatternFormats="0" applyAlignmentFormats="0" applyWidthHeightFormats="1" dataCaption="Data" showMultipleLabel="0" showMemberPropertyTips="0" useAutoFormatting="1" indent="0" compact="0" compactData="0" gridDropZones="1" multipleFieldFilters="0">')

str << %Q(<pivotTableDefinition xmlns="#{XML_NS}" name="#{name}" cacheId="#{cache_definition.cache_id.to_s}" #{'dataOnRows="1"' if data.size <= 1} applyNumberFormats="0" applyBorderFormats="0" applyFontFormats="0" applyPatternFormats="0" applyAlignmentFormats="0" applyWidthHeightFormats="1" dataCaption="Data" showMultipleLabel="0" showMemberPropertyTips="0" useAutoFormatting="1" indent="0" compact="0" compactData="0" gridDropZones="1" multipleFieldFilters="0">)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this also check columns.size?

@straydogstudio
Copy link
Contributor

@simi @noniq Do you see any reason we shouldn't merge this? I don't. It has tests now, and it passes.

@straydogstudio
Copy link
Contributor

@kiskoza You too. Any comments

@simi simi merged commit c8eb5fe into caxlsx:master Jan 28, 2022
@straydogstudio
Copy link
Contributor

@westonganger Nice work. Thanks everyone.

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

Successfully merging this pull request may close these issues.

5 participants