Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
This article makes use of Excel’s built-in functions such as ROW, COLUMN, and MOD. Here are some details of these functions for a better understanding of the code snippet provided ahead.
Let’s start writing some code to accomplish this goal with the help of Aspose.Cells for .NET API.
The following snapshot shows the resultant spreadsheet loaded in the Excel application.
![]() |
|---|
In order to apply the shading to alternate columns, all you have to do is change the formula =MOD(ROW(),2)=0 to =MOD(COLUMN(),2)=0, that is, instead of getting the row index, modify the formula to retrieve the column index.
The resultant spreadsheet, in this case, will look as follows.
![]() |
|---|
|
|
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.