Bug in LegendEntry.isDeleted in Aspose.Cells versions higher than 25.9

After upgrading our Aspose.Cells version from 25.9 to 25.10, 25.11, or 25.12, we are experiencing unexpected behavior when setting LegendEntry.isDeleted for series legend entries.

We have a workbook containing charts that have multiple series legend entries, by default, the legend entries are set to LegendEntry.isDeleted = false. We then have code that adds two new series and sets their LegendEntry.isDeleted = true, finally it sets an existing series called “Series4” LegendEntry.isDeleted = true. This should result in the original series legend entries being visible in the chart legend, and the newly added series and “Series4” legend entries being deleted (isDeleted = true). This code is behaving as expected in Aspose.Cells version 25.9, however in later versions I am seeing strange behavior where the entries with isDeleted=true are being made visible in the legend, and entries with isDeleted = false are being deleted.

    private void DrawChart(string chartName, string datasetName, int yOffset, int chartSeries = 0) {
        ChartCollection charts = worksheet.Charts;
        Chart chart = charts[chartName];
        Series series = chart.NSeries[chartSeries];
        IEnumerable<DateTime?> dates = from row in data select row.EFF_DT;
        FieldInfo prop = typeof(Fdqs.ALPHA_EXPOSURES_LOF).GetField(datasetName);
        IEnumerable<object> dataset = data.Select(r => prop.GetValue(r));
        string xValues = $"{{{string.Join(",", dates.Select(x => x.ToString("MMM-yy")))}}}";
        string yValues = $"{{{string.Join(",", dataset)}}}";
        series.XValues = xValues;
        series.Values = yValues;
        LinkVerticalAxes(chart);
        //Add two more series to the chart and set their LegendEntry.IsDeleted = true;
        if (portfolio.STATUS != "SUPP") {
            DrawBenchmarkPMChanges(chart, "PMChange", Color.FromArgb(55, 96, 146), dates, metadataPM);
            DrawBenchmarkPMChanges(chart, "BMChange", Color.FromArgb(255, 0, 0), dates, metadataBM);
        }
        //get "Series4" and set LegendEntry.IsDeleted = true;
        IEnumerable<Series> series4 = chart.NSeries.Where(x => x.DisplayName == "Series4");
        int series4count = series4.Count();
        if (series4.Count() > 0) {
            series4.First().LegendEntry.IsDeleted = true;
        }
    }

    private void LinkVerticalAxes(Chart chart) {
        object minValue = chart.ValueAxis.MinValue;
        object maxValue = chart.ValueAxis.MaxValue;
        chart.SecondValueAxis.MinValue = minValue;
        chart.SecondValueAxis.MaxValue = maxValue;
    }

    private void DrawBenchmarkPMChanges(Chart chart, string name, Color lineColor, IEnumerable<DateTime?> axisDates, IEnumerable<Fdqs.ALPHA_EXPOSURES_BM_PM_LINK_META> metadata) {
        IEnumerable<Series> existingSeries = chart.NSeries.Where(x => x.Name == name);
        if (existingSeries.Count() > 0) {
            return;
        }
        IEnumerable<DateTime?> metaDates = from row in metadata select row.LIFE_OF_FUND_BEGIN_DT;
        IEnumerator<DateTime?> datesEnum = metaDates.GetEnumerator();
        List<string> dataset = new List<string>();
        int datasetValue = Convert.ToInt32(100 * Math.Pow(axisDates.Count(), -0.05));
        datesEnum.MoveNext();
        DateTime? nextMetaDate = datesEnum.Current;
        foreach (DateTime? axisDate in axisDates) {
            if (axisDate > nextMetaDate) {
                datasetValue = -datasetValue;
                if (datesEnum.MoveNext() == false) {
                    nextMetaDate = DateTime.Now;
                }
            }
            dataset.Add(datasetValue.ToString());
            nextMetaDate = datesEnum.Current;
        }
        string xValues = $"{{{string.Join(",", axisDates.Select(x => x.ToString("MMM-yy")))}}}";
        string yValues = $"{{{string.Join(",", dataset)}}}";
        chart.NSeries.Add(yValues, true);
        Series changeSeries = chart.NSeries[chart.NSeries.Count - 1];
        changeSeries.Type = ChartType.Line;
        changeSeries.PlotOnSecondAxis = true;
        changeSeries.Name = name;
        changeSeries.Border.Color = lineColor;
        changeSeries.Border.Style = Aspose.Cells.Drawing.LineType.Dash;
        changeSeries.Border.WeightPt = 2.0;
        changeSeries.XValues = xValues;
        changeSeries.Values = yValues;
        changeSeries.Overlap = -100;
        changeSeries.GapWidth = 100;
        changeSeries.LegendEntry.IsDeleted = true;
    }

@njburd

  • The LegendEntry.IsDeleted property behaved correctly in 25.9 but appears inverted in 25.10‑25.12 (entries marked true become visible, false are hidden).
  • The same symptom was reported in another forum thread where LegendEntry.IsDeleted did not work after series were enabled 【Free Support Forum - aspose.com】.

Next steps to isolate the issue

  1. Confirm environment – exact Aspose.Cells .NET version (including build number), .NET runtime version, and whether a license is applied.
  2. Provide a minimal reproducible workbook – a file that contains a chart with at least three series (one existing, two added in code) and the code snippet that sets LegendEntry.IsDeleted as shown.
  3. Test with the latest release (e.g., 25.13 or newer). If the problem persists, it is a regression; if it is fixed, the issue is limited to the 25.10‑25.12 range.

Once the sample and environment details are available we can log an internal defect and work on a fix. Please attach the workbook and the exact code used to reproduce the behavior.

@njburd,

Thank you for sharing the details and code segments.

We need to conduct a comprehensive assessment of the issue you have mentioned regarding the LegendEntry.IsDeleted Boolean attribute. We would appreciate it if you could share a standalone VS.NET sample (console) application (complete source code without any compilation errors) along with sample Excel files to help us replicate the issue on our side. Please zip the project (making sure to exclude Aspose.Cells.Dll to reduce the archive size) and attach the compressed archive here. We will also test it using both older and newer versions of Aspose.Cells to verify the regression. Thank you for your efforts in this matter.