Quantcast
Channel: EPPlus Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 2262

Commented Unassigned: Possible Beta 4 Regression When Saving 'Styles.xml' [15051]

$
0
0
The Beta 4 release appears to have introduced a regression when serializing Styles.xml. The resulting saved .xlsx file cannot be read by Google Sheets. Google Sheets fails with the error "Google Drive encountered an error. If reloading the page doesn't help, please report the error."

The problems appears to be occurring because of the way <cellXfs> is now being serialized.

On version 3.1.3, <cellXfs> was serialized as follows:

```
<cellStyleXfs count="1">
<xf numFmtId="0" fontId="0" fillId="0" borderId="0" />
</cellStyleXfs>
```

On EPPlus 4.0 Beta2 version 4.0.0.1, <cellXfs> is serialized as follows:

```
<cellXfs count="1">
<xf numFmtId="0" applyNumberFormat="1" fontId="0" applyFont="1" fillId="0" applyFill="1" borderId="0" applyBorder="1" xfId="0" />
</cellXfs>
```

The value applyFill="1" appears to be causing Google Sheets to fail when reading the .xlsx file. I was able to circumvent the problem by either removing applyFill="1" or changing it to applyFill="0". I am not sure why Google Sheets is failing, but it seems to be related to the way that the <cellXfs> and its related <fill> are declared. Fill zero specifies patternType="none". I was able to circumvent the problem in another way by specifying a patternType of "gray125" for <fill> zero. Is it possible that there is a conflict between specifying applyFill="1" in <cellXfs> and patternType="none" in <fill> zero.

```
<fills count="2">
<fill>
<patternFill patternType="none" />
</fill>
<fill>
<patternFill patternType="gray125" />
</fill>
</fills>

```
The serialization code in question is located in method 'CreateXmlNode' at line 829 in file ExcelXfsXml.cs.

I have attached a simple Excel spreadsheet that reproduces the problem. It contains the value "A" in cell A1 and the value "1" in cell A2. I read and saved this file on version 3.1.3 and 4.0.0.1 and compared the resulting styles.xml file produced by both versions.

Comments: I forgot to add that this may be a Google Sheet problem. Excel is able to read the file. I am not knowledgeable enough to tell where the problem lies.

Viewing all articles
Browse latest Browse all 2262

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>