在ApachePOI中,用什么代替已弃用的CellRangeAddress.valueOf?

9

我想在区域中添加条件格式,但是我在教程中看到的一种方法已经被弃用了。请问有什么替代方法。

ConditionalFormattingRule rule2 = sheetCF.createConditionalFormattingRule(ComparisonOperator.LT, "50");
    PatternFormatting fill2 = rule2.createPatternFormatting();
    fill2.setFillBackgroundColor(IndexedColors.GREEN.index);
    fill2.setFillPattern(PatternFormatting.SOLID_FOREGROUND);

    CellRangeAddress[] regions = {
            CellRangeAddress.valueOf("A1:A6") //DEPRECATED
    };
    sheetCF.addConditionalFormatting(regions, rule);
2个回答

19

1
尝试使用这个:

org.apache.poi.ss.util.CellRangeAddress.valueOf("A1:A6") 

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接