Skip to content

Instantly share code, notes, and snippets.

@johnsonz
Created September 14, 2016 08:30
Show Gist options
  • Save johnsonz/611139a7228b900cc72de84f2071738c to your computer and use it in GitHub Desktop.
Save johnsonz/611139a7228b900cc72de84f2071738c to your computer and use it in GitHub Desktop.
static void Main(string[] args)
{
IWorkbook workbook = new XSSFWorkbook();
ISheet sheet1 = workbook.CreateSheet("Sheet1");
sheet1.CreateRow(0).CreateCell(0).SetCellValue("This is a Sample");
int x = 1;
for (int i = 1; i <= 15; i++)
{
IRow row = sheet1.CreateRow(i);
for (int j = 0; j < 15; j++)
{
row.CreateCell(j).SetCellValue(x++);
}
}
FileStream sw = File.Create("test.xlsx");
workbook.Write(sw);
sw.Close();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment