ClosedXML / ClosedXML/ClosedXML

Can't create pivot styles for multiple value columns.

Open
#1,186 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
5.7k
Forks
933
Avg merge
12h 14m
Merged PRs (30d)
1

Description

**Do you want to request a *feature* or report a *bug*?**
- [x] Feature

**Version of ClosedXML**
0.95.0-beta1

**What is the current behavior?**
In the API pivotstyles there is a lack. We cannot assign different styles for different data fields.
```
nameField.StyleFormats.DataValuesFormat
.ForValueField(ordersField)
.Style.Fill.BackgroundColor = XLColor.Apricot;
nameField.StyleFormats.DataValuesFormat
.ForValueField(qtyField)
.Style.Fill.BackgroundColor = XLColor.ArmyGreen;
```
two styles should be created here, but it turns out that the same style will be changed

**What is the expected behavior or new feature?**
I suggest doing this:
```
nameField.StyleFormats.AddValuesFormat()
.ForValueField(ordersField)
.Style.Fill.BackgroundColor = XLColor.Apricot;
nameField.StyleFormats.AddValuesFormat()
.ForValueField(qtyField)
.Style.Fill.BackgroundColor = XLColor.ArmyGreen;
```

**Did this work in previous versions of our tool? Which versions?**
No

Contributor guide

Open the contributing guide

Research direction

Start by tracing the StyleFormats.DataValuesFormat and ForValueField API shown in the issue. Compare the current behavior when formatting ordersField and qtyField, then evaluate the proposed AddValuesFormat entry point. Done means separate styles can be assigned to multiple value fields and the resulting workbook preserves both styles.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
backend-api-design
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.