手动填充单元格
用文本填充一些单元格。
worksheet.Cells["A1"].Value = "Lorem ipsum";
worksheet.Cells["B2"].Value = "dolor sit amet";
worksheet.Cells["C3"].Value = "consectetur adipiscing";
worksheet.Cells["D4"].Value = "elit sed do eiusmod";
worksheet.Cells["E5"].Value = 12345;
worksheet.Cells["F6"].Value = DateTime.Now;
使用循环填充单元格数据,请注意行和列索引从 1 开始
for (int i = 1; i <= 30; i++)
{
for (int j = 1; j <= 15; j++)
{
worksheet.Cells[i, j].Value = "Row " + i + ", Column " + j;
}
}