Use for Flag.All when styling cells

Hi,


I was wondering if it is intentional that when the Flag.All flag is set as true setting any of the other flags i.e. Flag.CellShading to false no longer has any effect.

Sample code:

Style style = worksheet.Cells[0,0].GetDisplayStyle();
StyleFlag flag = new StyleFlag();
flag.All = true;
flag.CellShading = false;

Range range = worksheet.Workbook.Worksheets.GetRangeByName(“someKnownRange”);
range.ApplyStyle(style, flag);

Result:

Cells in the range are retaining the all styling including cell shading.

Hi,

Thanks for your posting and using Aspose.Cells.

When you set Flag.All = true, then other settings do not take any effect. That’s why Cells in the range are retaining the all styling including cell shading.

Hi,


Thank you for the quick response. Is this a permanent fact? or is there a possibility that changes to some of the flags can be done after calling Flag.All = true; in a future version?

Just thought I’d ask cause our code currently manually turns on each of the flags in the StyleFlag object. Not a big deal, but thought I’d ask.

Thank you

Hi,

Thanks for your posting and using Aspose.Cells.

Yes, this is a permanent fact and not going to change in future version. Changes to other properties are considered invalid after Flag.All is set to true.

Ok good to know :slight_smile:


Thank you