Beispiel #1
0
        public static void Create(string templateFileName, string fileName, string sheetName, DataTable table)
        {
            if (!File.Exists(templateFileName))
            {
                throw new Exception("Template file not found!");
            }

            if (File.Exists(fileName))
            {
                throw new Exception("File exists!");
            }

            IWorkbook templateWorkbook = WorkbookHelper.CreateInputWorkbook(templateFileName);

            if (templateWorkbook == null)
            {
                throw new Exception("Cannot create IWorkbook object!");
            }

            IWorkbook workbook = WorkbookHelper.Append(templateWorkbook, sheetName, table);

            Create(workbook, fileName);
        }