Highlight Highest and Lowest Value in Excel Using Java

import com.spire.xls.*;

import java.awt.*;

public class HighlightTopBottom {

public static void main(String[] args) {

//Create a Workbook object
Workbook workbook = new Workbook();

//Load the sample Excel file

//Get the first worksheet
Worksheet sheet = workbook.getWorksheets().get(0);

//Apply conditional formatting to range "D1:D9" to highlight the highest value
ConditionalFormatWrapper format1 = sheet.getCellRange("D1:D9").getConditionalFormats().addCondition();

//Apply conditional formatting to range "D1:D9" to highlight the lowest value
ConditionalFormatWrapper format2 = sheet.getCellRange("D1:D9").getConditionalFormats().addCondition();

//Save the document
workbook.saveToFile("output/HighestLowestValue.xlsx", ExcelVersion.Version2016);




Sharing Java Code

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Advice from a Test Journeyman

C373 Fall 2021 Week 7: Gregory Raper

Nature of Rust — Particles

Cheat Sheet: Mapping out a Powerful File Handling System

Securing your GCP workflow using Secrets Engines on HashiCorp Vault

The Problem With Heroes In Software Development

Python — ETL and yield

Code Smell 77 — Timestamps

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Andrew Wilson

Andrew Wilson

Sharing Java Code

More from Medium

Solution for “Not able to find Java executable or version” in Jenkins

Java: Convert Word to PCL

Log4Shell in SQL ? JNDI exploit for Java H2 (CVE-2021–42392)

Java Apache httpclient interceptor for Spring MVC Configuration