Free Support Forum -

I want to limit the coloring of rows

<w:LatentStyles DefLockedState=“false” LatentStyleCount=“156”>
<![endif]–><!–[if gte mso 10]>

/* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman"; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;}


I am using Aspose.cells.dll


I am attaching my code file with this

What I want to do is

I want to put color in the alternate rows of an excel file.

I have achieved that with my code.

But the problem is that the whole row is coming in the color.

I want to restrict the coloring only up to the last column filled, not beyond that

I also achieved that by applying a loop

And in that I used sheet.Cells.ApplyColumnStyle(j, style2, flag2);

But The way I have used is little inappropriate.

I wanted to use CellRange class,but that’s not a part of the dll I am using Currently.

Is there any feasible way of doing it.

Do I have to apply coloring of the rows cell by cell?


Well, yes, your understanding is correct, if you want to stick with older versions, then you may set style cell by cell in a row accordingly. There might not be the Range.ApplyStyle() method in the older versions as you mentioned.

Thank you.

This is what I did
Range rng = worksheet.Cells.CreateRange(1, 0, 1, 6);

I created a range according to my excel sheet in which I have written the smart Markers.
I gave a style by filling the first row with the desired color
Range range2 = worksheet.Cells.CreateRange(i, 0, i, 6);
I created another range by name range 2 .
and copied rng in that
and placed in the loop…that’s how I have limited the coloring of rows.


Good to know that you have performed your desired results even with an older version of the product.

Have a good day!

Thank you.