/java-skills:easyexcel-writefrom java-skills
Generates structured Excel files programmatically using Alibaba EasyExcel 4.0.3. Covers annotations, styles, images, hyperlinks, formulas, merged cells, dynamic headers, and web download.
Ships in java-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
官方文档:https://easyexcel.opensource.alibaba.com/docs/current/quickstart/write 官方示例:https://github.com/alibaba/easyexcel/blob/master/easyexcel-test/src/test/java/com/alibaba/easyexcel/test/demo/write/WriteTest.java 当前版本:
com.alibaba:easyexcel:4.0.3(Apache-2.0,仓库已归档,仅做 Bug 修复)
本技能专注于 "程序化生成 Excel" 场景。当用户没有预制模板、要求用 Java 对象/Map 直接生成结构化 Excel(订单、用户、财务、库存、报表、对账单、审批单)时,应当使用本技能。
@ExcelProperty({"主标题", "副标题"}))includeColumnFiledNames / excludeColumnFiledNames)@ColumnWidth @ContentRowHeight @DateTimeFormat @NumberFormat)HorizontalCellStyleStrategy)@ContentLoopMerge / LoopMergeStrategy)WriteCellData 体系)HttpServletResponseinMemory(true).xls)兼容性需用 excelType(ExcelTypeEnum.XLS)easyexcel-filleasyexcel-read本技能不收集、存储或传输任何用户数据。所有代码示例仅用于本地开发参考。
典型调用方式(3 种写法):
// 写法 1:JDK8+ 用 Supplier(since 3.0.0-beta1,最简洁)
EasyExcel.write(fileName, DemoData.class)
.sheet("模板")
.doWrite(() -> data());
// 写法 2:传统 + 已有 List
List<DemoData> data = data();
EasyExcel.write(fileName, DemoData.class)
.sheet("模板")
.doWrite(data);
// 写法 3:Builder(多次写入 / 复杂配置)
try (ExcelWriter excelWriter = EasyExcel.write(fileName, DemoData.class).build()) {
WriteSheet writeSheet = EasyExcel.writerSheet("模板").build();
excelWriter.write(data(), writeSheet);
}
官方原文:"数据量建议 5000 以内"(单 sheet 一次性写入推荐上限)。
Step 1. 定义数据模型 — 编写 DTO/VO,标注 @ExcelProperty 等注解
Step 2. 选择写入方式 — 单次 doWrite() / 多次 excelWriter.write() / 多次 doWrite() 循环
Step 3. 配置 Builder — 包含列选择、表头、样式、注册拦截器等
Step 4. 构造数据 — 准备 List<DTO> / List<List<String>>
Step 5. 执行写入 — try-with-resources 关闭 ExcelWriter
Step 6. 验证输出 — 打开生成的 .xlsx 检查表头/样式/格式/合并
| 注解 | 用途 | 关键属性 |
|---|---|---|
@ExcelProperty | 指定列名/索引/转换器 | value, index, order, converter |
@ExcelIgnore | 忽略该字段 | —— |
@ExcelIgnoreUnannotated | 类级:未标注字段不参与读写 | —— |
@DateTimeFormat | 日期格式 | value, use1904windowing |
@NumberFormat | 数字格式 | value, roundingMode |
@ColumnWidth | 列宽 | value |
@HeadRowHeight | 表头行高 | value |
@ContentRowHeight | 内容行高 | value |
@HeadStyle | 表头样式(POI 风格) | fillPatternType, fillForegroundColor, font 等 |
@HeadFontStyle | 表头字体 | fontHeightInPoints, color, bold 等 |
@ContentStyle | 内容样式 | 同 HeadStyle |
@ContentFontStyle | 内容字体 | 同 HeadFontStyle |
@ContentLoopMerge | 循环合并 | eachRow |
@OnceAbsoluteMerge | 一次性绝对合并 | firstRowIndex lastRowIndex 等 |
官方原文:
order默认Integer.MAX_VALUE;优先级:index>order>value。 官方原文:"不建议 index 和 name 同时用,要么只用index,要么只用name匹配"
详细代码与注释已拆分到 references/。按场景加载:
agents/openai.yaml (opens in a new tab)examples/advanced/15-hyperlink.md (opens in a new tab)examples/advanced/16-comment.md (opens in a new tab)examples/advanced/17-formula.md (opens in a new tab)examples/advanced/18-rich-text.md (opens in a new tab)examples/annotation/04-complex-head.md (opens in a new tab)examples/annotation/05-converter.md (opens in a new tab)examples/annotation/06-width-height.md (opens in a new tab)examples/annotation/07-index-data.md (opens in a new tab)examples/async/25-async-task.md (opens in a new tab)examples/bigdata/24-page-write.md (opens in a new tab)examples/business/29-user-export.md (opens in a new tab)examples/business/30-finance-stock.md (opens in a new tab)examples/conversion/27-custom-converter.md (opens in a new tab)examples/dynamic/26-dynamic-head.md (opens in a new tab)examples/error-handling/28-validator.md (opens in a new tab)examples/image/13-image-demo.md (opens in a new tab)examples/image/14-multi-image.md (opens in a new tab)examples/merge/11-annotation.md (opens in a new tab)examples/merge/12-strategy.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
39 skills in this plugin
/caffeine-patternsCaffeine JVM 本地缓存技能。覆盖本地缓存 vs 远程缓存(Redis)选择决策树、expireAfterWrite vs expireAfterAccess vs refreshAfterWrite 三种过期策略对比与组合规则(refresh < expire)、CacheLoader加载与reload异步刷新模式、Spring Cache @Cacheable集成、maximumSize驱逐策略、recordStats缓存统计。 纠正 LLM:用 ConcurrentHashMap+手动过期、所有缓存走Redis、refreshAfterWrite > expireAfterWrite导致永远不刷新、CacheLoader返回null导致缓存穿透。/commons-patternsApache Commons 最佳实践模式。从官方文档提炼,覆盖 Commons Lang3(StringUtils千面判空/isEmpty vs isBlank/Validate抛NullPointerException迁移)、Commons IO(IOUtils.toString大文件陷阱/FileUtils.lineIterator逐行读模式/FilenameUtils.normalize路径规范化)、Commons Collections4(CollectionUtils.union/intersection/subtract集合运算)。 纠正 LLM 误用:混淆 StringUtils.isBlank vs isEmpty、IOUtils.toString 读大文件OOM、不知道 LineIterator 逐行读模式、用 lang 而非 lang3 包名。/Generated from the plugin's indexed repository (full-stack-skills/java-skills) — no native marketplace selected
npx claudepluginhub p/full-statck-skills-java-skills