GitHub user bengbengbalabalabeng added a comment to the discussion: 
我想修改单元格里的文本,任意字符的的颜色。为什么不生效

You could try the following implementation  (Please refer to: 
https://fesod.apache.org/docs/sheet/write/style#code-example-2):

```java
public class PartialRedTextHandler implements CellWriteHandler {

    @Override
    public void afterCellDispose(CellWriteHandlerContext context) {
        if (BooleanUtils.isNotTrue(context.getHead())) {
            WriteCellData<?> cellData = context.getFirstCellData();
            WriteCellStyle writeCellStyle = cellData.getOrCreateStyle();
            writeCellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
            writeCellStyle.setHorizontalAlignment(HorizontalAlignment.CENTER);
            writeCellStyle.setWrapped(true);

            if (context.getCell().getCellType() == CellType.STRING) {
                WriteFont writeFont = new WriteFont();
                writeFont.setColor(IndexedColors.RED.getIndex());
                writeCellStyle.setWriteFont(writeFont);
            }
        }
    }
}
```

GitHub link: 
https://github.com/apache/fesod/discussions/894#discussioncomment-16503272

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: [email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to