Supports obtaining current row data object during writing
- Dominant language
- Java
- Stars
- 6.2k
- Forks
- 532
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 42
Description
### Search before asking
- [x] I searched in the [issues](https://github.com/fast-excel/fastexcel/issues) and found nothing similar.
### Motivation
在写入excel文件时,准备好数据后,写入文件对数据进行二次转换或者简单业务逻辑处理。不想再循环进行处理。可以在数据写入单元格的时候进行二次转换或者简单业务逻辑处理,此时,业务可能需要依赖行级完整对象数据。
示例:
```
class Data {
private int a;
private int b;
private int c;
private String text;
}
```
在生成text单元格内容,可能需要结合数据a、b、c进行逻辑判断。
### Solution
希望在converter(WriteConverterContext)或handler(CellWriteHandlerContext)中传入 oneRowData
```
Cell cell = WorkBookUtil.createCell(row, columnIndex);
cellWriteHandlerContext.setCell(cell);
WriteHandlerUtils.afterCellCreate(cellWriteHandlerContext);
cellWriteHandlerContext.setOriginalRecord(oneRowData); // 传入当前行级数据
cellWriteHandlerContext.setOriginalValue(beanMap.get(name));
cellWriteHandlerContext.setOriginalFieldClass(head.getField().getType());
converterAndSet(cellWriteHandlerContext);
WriteHandlerUtils.afterCellDispose(cellWriteHandlerContext);
beanMapHandledSet.add(name);
```
### Alternatives
_No response_
### Anything else?
_No response_
### Are you willing to submit a PR?
- [x] I'm willing to submit a PR!
Contributor guide
Assessment
This issue has not been assessed yet.