dotnet / dotnet/Open-XML-SDK

Validation of CalcChain considers s attribute of a cell to be a style index

Open
#1,411 2 comments 0 reactions 1 assignee Claimed by @mikeebowen View on GitHub
Dominant language
C#
Stars
4.6k
Forks
605
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**
In the CalcChain part, there is an attribute `s` of a `c` (Cell) tag. It's a boolean flag that indicates a child chain. OpenXmlSdk considers it to be an index reference to the styles.xml and if workbook doesn't contain styles, the OpenXmlValidator reports an error.

**To Reproduce**
using var wb = SpreadsheetDocument.Open("workbook_with_child_chain.xlsx", false);
var validator = new OpenXmlValidator();
var errors = validator.Validate(wb);
Assert.Empty(errors);
[workbook_with_child_chain.xlsx](https://github.com/dotnet/Open-XML-SDK/files/11267356/workbook_with_child_chain.xlsx)

**Observed behavior**
There is an error in part '/xl/calcChain.xml' at '/x:calcChain[1]/x:c[3]' with a text
> Element 'http://schemas.openxmlformats.org/spreadsheetml/2006/main:xf' referenced by 'c@http://schemas.openxmlformats.org/spreadsheetml/2006/main:s' does not exist in part '/xl/styles.xml'.The index is '1'.

**Expected behavior**
There should be no error, it's a flag.

**Desktop (please complete the following information):**
- OS: Window 11]
- Office version: Microsoft Office 365, Version 2303 (Build 16227.20280)
- .NET Target: net6
- DocumentFormat.OpenXml Version: 2.20.0

**Additional context**
Workaround: add 2 styles to a workbook.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.