I want to clone worksheet int my excel template file programatically. When Using NPOI library I can use
HSSFWorkbook workbook = new HSSFWorkbook(fs, true);
workbook.CloneSheet(1);
I wonder is there something equivalent to that with EPPlus ExcelWorkbook
. I want to copy overall ExcelWorksheet
to keep my format and value, not just copy each cell or range of cell manually
Try the ExcelWorksheets.Copy
method:
public ExcelWorksheet Copy(ExcelWorkbook workbook, string existingWorksheetName, string newWorksheetName)
{
ExcelWorksheet worksheet = workbook.Worksheets.Copy(existingWorksheetName, newWorksheetName);
return worksheet;
}