java – 在ApachePOI中使用而不是不推荐使用的CellRangeAddress.
发布时间:2020-12-14 05:29:43 所属栏目:Java 来源:网络整理
导读:我想在该地区添加条件格式,但是在教程中看到的一种方法已被弃用.使用什么而不是它. 样品: ConditionalFormattingRule rule2 = sheetCF.createConditionalFormattingRule(ComparisonOperator.LT,"50"); PatternFormatting fill2 = rule2.createPatternFormat
我想在该地区添加条件格式,但是在教程中看到的一种方法已被弃用.使用什么而不是它.
样品: 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); 解决方法
您使用的是错误版本的CellRangeAddress.
org.apache.poi.hssf.util.CellRangeAddress已被弃用,您应该使用的是
org.apache.poi.ss.util.CellRangeAddress.
您需要使用SS Common Spreadsheet Model类,而不是旧版HSSF (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |