Link to home
Create AccountLog 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
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
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.