Crystal Rouse
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;
}
}
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
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)?
ASKER
I was able to figure it out using alerts.
What are you expecting to see in the output?
What are you seeing in the output?