Workbook workbook = new Workbook(TempFolder_ + “Template.xls”);
for (int i = 0; i < lstDonVi.Count; i++)
Worksheet worksheet = workbook.Worksheets[i];
worksheet.Name = lstDonVi[i]//;
but only the first sheet is the same template
Thanks for your posting and using Aspose.Cells.
Please use the Workbook.Worksheets.AddCopy() method to achieve your requirements. Here is the correct code. I have also attached the output xls file generated by it for your reference.
Workbook workbook = new Workbook(“Template.xls”);
Worksheet worksheet = workbook.Worksheets;
//Add 5 copies of worksheet
for (int i = 0; i < 5; i++)
int idx = workbook.Worksheets.AddCopy(worksheet.Name);
Worksheet ws = workbook.Worksheets[idx];
ws.Name = worksheet.Name + “-” + i;