Datalabels Font color is not updated

Hi All,
I am trying to change the font color of data labels but it is not reflected in the excel chart.
However, it is reflected in the color box in excel. So very surprising.

image.png (49.6 KB)

If I just change “solid fill” to “No Fill” and after just revert, the color is visible in the excel chart like I wish.

image.png (20.8 KB)

Please find below an example of code in order to reproduce the issue.
Note: the “+” and “-” are the datalabel I want to display with the color of my choice.
And below the xlsx file to test:
TestHadrienMarker.zip (12.1 KB)

Blockquote
var pathWorkbook = @“pathtodefine”;
var wbtest = new Workbook(pathWorkbook);
Worksheet sheettest = wbtest.Worksheets[0];
Chart charttest = sheettest.Charts[0];
//Change the color to blue for the data labels.
charttest.NSeries[0].DataLabels.Font.Color = Color.BlueViolet;
wbtest.Save(pathWorkbook);

Thanks a lot for your help

@hormancey,

Thanks for the sample file and screenshots.

Please try the following (updated) sample code to accomplish your task.
e.g.,
Sample code:

var pathWorkbook = @“pathtodefine”;
var wbtest = new Workbook(pathWorkbook);
Worksheet sheettest = wbtest.Worksheets[0];
Chart charttest = sheettest.Charts[0];
Series series = charttest.NSeries[0];
int pointCount = series.Points.Count;
for (int i = 0; i < pointCount; i++)
{
  ChartPoint pointIndex = series.Points[i];
  pointIndex.DataLabels.Font.Color = System.Drawing.Color.BlueViolet;
}
wbtest.Save(pathWorkbook);

Let us know if you still find the issue.

@hormancey
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): CELLSNET-56119

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

@hormancey,

We are pleased to inform you that your issue (logged as “CELLSNET-56119”) has been resolved. You no longer need to use the workaround/updated code segment. We have now added the ApplyFont method in the Series.DataLabels, which will set the font for all the data points in the series. This enhancement will be included in the next release (Aspose.Cells v24.7) scheduled for next week. We will inform you when the next version is released.

Hi @hormancey
For this issue, we have optimized it so that after version 23.7, you can easily apply the font attributes of the parent node to the child node by:

book = new Workbook(path + “TestHadrienMarker.xlsx”);
chart000 = book.Worksheets[0].Charts[0];
Series series = chart000.NSeries[0];
series.DataLabels.Font.Color = Color.Green;
series.DataLabels.ApplyFont();
book.Save(path + “Output.xlsx”);

The “ApplyFont” will take effect in version 23.7 and is expected to be released in early July.

Thanks a lot. I will test it asap!

@hormancey
Thank you for your feedback. Once the version v24.7 is released, we will notify you promptly. Please take your time to try the suggested solutions. Hopefully, your issue will be sorted out. Please let us know your feedback.

The issues you have found earlier (filed as CELLSNET-56119) have been fixed in this update. This message was posted using Bugs notification tool by johnson.shi

Hi Guys,
Thanks for your new version. It is working perfectly.
Thanks for the quick fix!!!

@hormancey,

Thank you for your feedback. It’s good to hear that the newer version is working well for your needs. Please feel free to reach out to us if you have any further queries or comments, and we will be happy to assist you soon.

1 Like