001package top.cenze.utils.enums; 002 003/** 004 * @desc: Excel类型 005 * @author: chengze 006 * @createByDate: 2023/10/9 9:26 007 */ 008public enum ExcelTypeEnum { 009 XLS(".xls", "Microsoft Excel 97-2003版本版本的默认文件格式扩展名"), 010 XLSX(".xlsx", "Microsoft Excel 2007及以后版本的默认文件格式扩展名"), 011 XLSM(".xlsm", "带有宏的Excel默认文件格式扩展名"), 012 ; 013 014 private String extname; 015 private String desc; 016 017 ExcelTypeEnum(String _extname, String _desc) { 018 this.extname = _extname; 019 this.desc = _desc; 020 } 021 022 public String getExtname() { 023 return extname; 024 } 025 026 public String getDesc() { 027 return desc; 028 } 029 030 public static ExcelTypeEnum getByExtname(String extname) { 031 for (ExcelTypeEnum e : ExcelTypeEnum.values()) { 032 if (e.getExtname().equals(extname)) { 033 return e; 034 } 035 } 036 037 return null; 038 } 039}