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

Crystal RouseTask LeadAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

leakim971PluritechnicianCommented:
what do you get for each alert?
for (row = 5; row - 5 < Hats.Count; row++)
            {
                ws.Cells[row, 1].Value = Hats[row - 5].data.Name
alert(typeof Hats[row - 5]); //alert1
alert(typeof Hats[row - 5].columns); //alert2
alert(typeof Hats[row - 5].columns.length); //alert3
foreach (var c in Hats[row - 5].columns)

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Julian HansenCommented:
What does your input data look like (Hats)?
What are you expecting to see in the output?
What are you seeing in the output?
0
Crystal RouseTask LeadAuthor Commented:
My forloop is only returning one line where in the test case I'm using I should be getting 2 lines of data.
0
Julian HansenCommented:
What does your input data look like (Hats)?
0
Crystal RouseTask LeadAuthor Commented:
I was able to figure it out using alerts.
1
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.