bengbengbalabalabeng commented on issue #835:
URL: https://github.com/apache/fesod/issues/835#issuecomment-3811261871
Hi, @codeLikeO.
You may try using `AbstractCellStyleStrategy` to customize the cell styles
for either the header or the content. This class allows you to define your own
styling logic.
```java
public class CustomCellStyleWriteHandler extends AbstractCellStyleStrategy {
@Override
public int order() {
// Customize the execution order
return OrderConstant.SHEET_ORDER;
}
@Override
protected void setHeadCellStyle(Cell cell, Head head, Integer
relativeRowIndex) {
CellStyle style =
cell.getSheet().getWorkbook().createCellStyle();
style.setFillForegroundColor(IndexedColors.YELLOW.getIndex());
style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
cell.setCellStyle(style);
}
@Override
protected void setContentCellStyle(Cell cell, Head head, Integer
relativeRowIndex) {
CellStyle cellStyle = cell.getCellStyle();
if(cellStyle == null) {
cellStyle = cell.getSheet().getWorkbook().createCellStyle();
}
cellStyle.setFillForegroundColor(IndexedColors.RED.getIndex());
cellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
cell.setCellStyle(cellStyle);
}
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]