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

The generated file does not open in Excel #82

Closed
b0bi79 opened this issue Apr 24, 2019 · 8 comments
Closed

The generated file does not open in Excel #82

b0bi79 opened this issue Apr 24, 2019 · 8 comments
Assignees
Labels
Milestone

Comments

@b0bi79
Copy link
Member

b0bi79 commented Apr 24, 2019

I am working on introducing Pivot styles. For testing tests are used PivotTests.Simple. When performing the specified test with the tPivot5_Static.xlsx template, a file is generated that does not open in Excel.

Commit #81 compiled with ClosedXML ClosedXML/ClosedXML#1189

@b0bi79 b0bi79 added the bug label Apr 24, 2019
@b0bi79 b0bi79 added this to the 0.2.0 milestone Apr 24, 2019
@igitur
Copy link
Member

igitur commented Apr 24, 2019

When you say the file doesn't open in Excel, do you mean that Excel complains that the file is corrupt?

@b0bi79
Copy link
Member Author

b0bi79 commented Apr 24, 2019

Yes

@b0bi79
Copy link
Member Author

b0bi79 commented Apr 26, 2019

I noticed that the problem does not occur if the PivotTable data is empty. From this I can assume that there may be an error related to the pivotCacheDefinition section.

@b0bi79
Copy link
Member Author

b0bi79 commented Apr 26, 2019

I found. In pivotCacheRecords1.xml, the "Tax rate" field contains no data. If I add data to this field, the error disappears.
It was:

<x:cacheField name="Tax rate">
	<x:sharedItems containsSemiMixedTypes="0" containsString="0" containsNumber="1" minValue="0" maxValue="8.5" count="3" />
</x:cacheField>

Correction:

<x:cacheField name="Tax rate">
	<x:sharedItems containsSemiMixedTypes="0" containsString="0" containsNumber="1" minValue="0" maxValue="8.5" count="3">
		<x:n v="4.5" />
		<x:n v="0" />
		<x:n v="8.5" />
	</x:sharedItems>
</x:cacheField>

The "Tax rate" field participates in the PivotTable as a ColumnField. Scenario to reproduce:

  1. Open the file in which there is a PivotTable
  2. Modify the data referenced by the PivotTable
  3. Save the file.

@b0bi79
Copy link
Member Author

b0bi79 commented Apr 26, 2019

In fact, there are two problems. This solves only one. Solution for the second problem until has not yet found.

@b0bi79
Copy link
Member Author

b0bi79 commented Apr 29, 2019

Found the second problem, because of which the file opens with an error.
In the pivotTable1.xml file, the location element has the property ref = "B3", if I change this value to ref = "B3: L211", then the file is opened without errors.

@b0bi79
Copy link
Member Author

b0bi79 commented Apr 29, 2019

The reason that in the pivotCacheDefinition the TaxRate field was not filled in was that the file was generated based on a template in which two summary tables are constructed from data from the same data table. In this case Excel creates one pivotCacheDefinition file, and ClosedXML while caches the last Pivot overwrites the cache for the first Pivot.

@b0bi79
Copy link
Member Author

b0bi79 commented May 29, 2019

Closed by ClosedXML/ClosedXML#1196

@b0bi79 b0bi79 closed this as completed May 29, 2019
@b0bi79 b0bi79 reopened this May 30, 2019
@b0bi79 b0bi79 closed this as completed Jul 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants