当前位置: 首页 > news >正文

西固网站建设平台建筑企业资质

西固网站建设平台,建筑企业资质,wordpress 添加付款,最新军事新闻最新消息概述在Excel中#xff0c;应用条件格式功能可以在很大程度上改进表格的设计和可读性#xff0c;用户可以指定单个或者多个单元格区域应用一种或者多种条件格式。本篇文章#xff0c;将通过Java程序示例介绍条件格式的设置方法#xff0c;设置条件格式时#xff0c;因不同设…概述在Excel中应用条件格式功能可以在很大程度上改进表格的设计和可读性用户可以指定单个或者多个单元格区域应用一种或者多种条件格式。本篇文章将通过Java程序示例介绍条件格式的设置方法设置条件格式时因不同设置需要本文分别从以下示例要点来介绍示例11. 应用条件格式用于高亮重复、唯一数值2. 应用条件格式用于高亮峰值(最高值、最低值)3. 应用条件格式用于高亮低于或高于平均值的数值示例21. 应用单元格值类型的条件格式2. 应用公式类型的条件格式3. 应用数据条类型的条件格式示例31. 删除条件格式程序环境Jdk 1.8.0(高于或等于1.6.0版本即可)Free Spire.XLS for Java (免费版)Jar获取及导入官网下载jar包并解压将lib文件夹下的jar导入Java程序(或者通过maven下载导入到maven项目程序)。如下导入效果程序代码Java示例1——应用条件格式高亮重复值、唯一值、峰值、高于或低于平均值import com.spire.xls.*;importcom.spire.xls.core.IConditionalFormat;importcom.spire.xls.core.spreadsheet.collections.XlsConditionalFormats;importcom.spire.xls.core.spreadsheet.conditionalformatting.TimePeriodType;import java.awt.*;public classAddConditionalFormat {public static voidmain(String[] args) {//创建实例加载测试文档Workbook wb newWorkbook();wb.loadFromFile(test.xlsx);//获取第一个工作表Worksheet sheet wb.getWorksheets().get(0);//添加条件格式1并指定数据范围XlsConditionalFormats format1 sheet.getConditionalFormats().add();format1.addRange(sheet.getCellRange(A2:A12));//高亮低于平均数值的单元格IConditionalFormat cf1 format1.addAverageCondition(AverageType.Below);cf1.setBackColor(new Color(230,230,250));//高亮高于平均数值的单元格IConditionalFormat cf2 format1.addAverageCondition(AverageType.Above);cf2.setBackColor(new Color(224,255,255));//添加条件格式2并指定数据范围XlsConditionalFormats format2 sheet.getConditionalFormats().add();format2.addRange(sheet.getCellRange(B2:B12));//高亮最高值IConditionalFormat cf3 format2.addTopBottomCondition(TopBottomType.Top, 1);cf3.setBackColor(new Color(144,238,144));//高亮最低值单元格IConditionalFormat cf4 format2.addTopBottomCondition(TopBottomType.Bottom, 1);cf4.setBackColor(new Color(221,160,221));//添加条件格式3并指定数据范围XlsConditionalFormats format3 sheet.getConditionalFormats().add();format3.addRange(sheet.getCellRange(C2:C12));//高亮唯一值的单元格IConditionalFormat cf5 format3.addDuplicateValuesCondition();cf5.setFormatType(ConditionalFormatType.UniqueValues);cf5.setBackColor(new Color(0,255,255));//添加条件格式4并指定数据范围XlsConditionalFormats format4 sheet.getConditionalFormats().add();format4.addRange(sheet.getCellRange(D2:D12));//高亮重复数值的单元格IConditionalFormat cf6 format4.addDuplicateValuesCondition();cf6.setFormatType(ConditionalFormatType.DuplicateValues);cf6.setBackColor(new Color(255,228,196));//添加条件格式5并指定数据范围XlsConditionalFormats format5 sheet.getConditionalFormats().add();format5.addRange(sheet.getCellRange(E2:E12));//高亮本周日期的单元格IConditionalFormat cf7 format5.addTimePeriodCondition(TimePeriodType.ThisWeek);cf7.setBackColor(new Color(255,165,0));//保存文档wb.saveToFile(AddConditionalFormat.xlsx, ExcelVersion.Version2013);wb.dispose();}}条件格式应用效果Java示例2——应用单元格值、公式及数据条类型的条件格式import com.spire.xls.*;import java.awt.*;public classAddConditionalFormat {public static voidmain(String[] args) {//创建实例加载测试文档Workbook wb newWorkbook();wb.loadFromFile(sample.xlsx);//获取第一个工作表Worksheet sheet wb.getWorksheets().get(0);//获取应用条件格式的数据范围CellRange range sheet.getCellRange(A2:H27);//添加条件格式1ConditionalFormatWrapper format1 range.getConditionalFormats().addCondition();//条件格式类型1基于单元格值format1.setFormatType(ConditionalFormatType.CellValue);//将数值在60到90之间的单元格进行字体加粗并设置字体颜色为橙色format1.setFirstFormula(90);format1.setSecondFormula(100);format1.setOperator(ComparisonOperatorType.Between);format1.setFontColor(new Color(30,144,255));//format1.setBackColor(Color.orange);//添加条件格式2ConditionalFormatWrapper format2 range.getConditionalFormats().addCondition();format2.setFormatType(ConditionalFormatType.CellValue);format2.setFirstFormula(60);format2.setOperator(ComparisonOperatorType.Less);format2.setFontColor(Color.red);//format2.setBackColor(Color.red);format2.isBold();//添加边框格式(边框颜色、边框类型)到条件格式2format2.setLeftBorderColor(Color.red);format2.setRightBorderColor(new Color(0,0,139));format2.setTopBorderColor(new Color(123,104,238));format2.setBottomBorderColor(new Color(50,205,50));format2.setLeftBorderStyle(LineStyleType.Medium);format2.setRightBorderStyle(LineStyleType.Thick);format2.setTopBorderStyle(LineStyleType.Double);format2.setBottomBorderStyle(LineStyleType.Double);//条件格式3的类型为公式ConditionalFormatWrapper format3 range.getConditionalFormats().addCondition();format3.setFormatType(ConditionalFormatType.Formula);//自定义公式将低于60的单元格所在的行填充背景色format3.setFirstFormula(OR($C260,$D260,$E260,$F260,$G260,$H260));format3.setBackColor(Color.lightGray);//获取第二个工作表Worksheet sheet2 wb.getWorksheets().get(1);//获取应用条件格式的数据范围CellRange range2 sheet2.getCellRange(B2:D7);//添加条件类型4为data barsConditionalFormatWrapper format4 range2.getConditionalFormats().addCondition();format4.setFormatType(ConditionalFormatType.DataBar);format4.getDataBar().setBarColor(new Color(152,251,152));//保存文档wb.saveToFile(AddConditionalFormat2.xlsx, ExcelVersion.Version2013);wb.dispose();}}条件格式应用效果Java示例3——删除条件格式(这里测试文档以示例1中生成的文档为例)import com.spire.xls.*;public classRemoveConditionalFormat {public static voidmain(String[] args) {Workbook wb newWorkbook();wb.loadFromFile(AddConditionalFormat.xlsx);//获取第一个工作表Worksheet sheet wb.getWorksheets().get(0);//删除指定单元格范围中的条件格式sheet.getCellRange(A5:H5).getConditionalFormats().removeAt(3);//保存并打开文档wb.saveToFile(RemoveConditionalFormat.xlsx, ExcelVersion.Version2010);wb.dispose();}}条件格式删除效果
http://www.zqtcl.cn/news/73491/

相关文章:

  • co域名网站建筑工程承包方式
  • 泰安三合一网站建设公司学销售去哪个学校好
  • 云南昆明网站建设公司湖州市南浔区建设局网站
  • 办公室装修设计网站包头网站设计推广
  • 旅游网站怎么设计两新支部网站建设
  • 上海网站制作软件wordpress怎么换回原来的编辑器
  • 郑州注册公司网上核名网站下载网站app
  • 网站建设阿华seo吴兴网站建设
  • 购物网站设计方案做网站采集
  • 网站建设销售还能做吗wordpress后台下载
  • 北京互联网公司开发的网站洛阳霞光营销型网站
  • 杭州网站制作蒙特网站建设需要哪些费用支出
  • 网站开发技术视频煤棚网架公司
  • 哪个网站做五金冲压的荣成市建设局网站是什么
  • 网站运营是什么岗位西宁知名网站设计公司
  • 东莞网站建设0769dt成都手机网站建设报价表
  • 网站开发三层wordpress 上传字体
  • 化妆品手机端网站模板关键词如何快速排名
  • 东莞 手机网站制作网站的404如何做
  • 采购网站平台宿州专业网站建设
  • 汕头网站安全开发系统做网站还是博客
  • 微信 app 微网站 整合上海平面设计公司排行榜
  • 食品 药品 监督 网站 源码 phpwordpress怎么编辑的
  • 做淘宝网站需要什么山东移动网站建设
  • 给网站做引流多少钱如何制作一个属于自己的网站
  • 自己怎么做云购网站吗wordpress炫酷站
  • 有记事本做简易网站怎么在手机上做企业网站
  • 同城分类网站建设公众号平台注册
  • 视频收费网站怎么做山东城市建设职业学院教务网网站
  • wordpress单位内网做网站网站开发html工具