Link to home
Start Free TrialLog in
Avatar of Crystal Rouse
Crystal RouseFlag for United States of America

asked on

Help updating a ForLoop

I need help with this For Loop.  I should be writing more than one line.  I am building an Excel file.  The Hats.Count is more than one but I am only writing one line in the for loop.

for (row = 5; row - 5 < Hats.Count; row++)
            {
                ws.Cells[row, 1].Value = Hats[row - 5].data.Name

                foreach (var c in Hats[row - 5].columns)
                {
                    ws.Cells[row, c].Value = "X";
                    ws.Cells[row, c].Style.HorizontalAlignment = HorizontalAlignmentStyle.Center;
                    ws.Cells[row, c].Style.Font.Weight = ExcelFont.BoldWeight;
                }
            }

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of leakim971
leakim971
Flag of Guadeloupe image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
What does your input data look like (Hats)?
What are you expecting to see in the output?
What are you seeing in the output?
Avatar of Crystal Rouse

ASKER

My forloop is only returning one line where in the test case I'm using I should be getting 2 lines of data.
What does your input data look like (Hats)?
I was able to figure it out using alerts.