public void CreateTemplate(IExcel excelApp, string filePath, ExcelTemplateName excelTemplateName) { try { CreateExcel(excelApp, filePath); excelApp.OpenExcel(filePath, false); if (excelTemplateName == ExcelTemplateName.LRProduct) { CreateLRProductSheet(excelApp); } if (excelTemplateName == ExcelTemplateName.LRInsureCont) { CreateLRInsureContSheet(excelApp); } if (excelTemplateName == ExcelTemplateName.LRAccount) { CreateLRAccountSheet(excelApp); } if (excelTemplateName == ExcelTemplateName.LRCont) { CreateLRContSheet(excelApp); } if (excelTemplateName == ExcelTemplateName.LRClaim) { CreateLRClaimSheet(excelApp); } if (excelTemplateName == ExcelTemplateName.LREdor) { CreateLREdorSheet(excelApp); } if (excelTemplateName == ExcelTemplateName.LJInvoiceRelation) { CreateLJInvoiceRelationSheet(excelApp); } if (excelTemplateName == ExcelTemplateName.LJInvoice) { CreateLJInvoiceSheet(excelApp); } excelApp.Save(); excelApp.CloseExcel(); } catch (Exception ex) { throw new Exception("Create excel Template error " + ex.Message); } }