Is that possible to do some conditional format on Excel file with JXL or Apache POI or something else? API java Like Macro VBA for example?
' Mise en forme couleur pour différence
For i = 3 To fin Step 1
Range("C" & i).Select
Selection.FormatConditions.Delete
Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlNotEqual, _
Formula1:="=B" & i
Selection.FormatConditions(1).Interior.ColorIndex = 6
so, in your target language, these are the Excel Objects you need:
Excel.Application
in a variable like oXlApp Excel.Application
object to open your target workbook:
Selection
property of the oxlApp object to return an Excel Range
object modify the Selection
or Range
as below:
Execute an Add command on the FormatConditions property of the Range
'
in Excel VBA we would do something like this:
activesheet.usedrange.select
Selection.FormatConditions.Delete
Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=$B2<>$C2"
Selection.FormatConditions(1).Interior.ColorIndex = 36
this will first select the used cells, then add a conditional formatting for cols b and c
Also, see this one StackOverFlow: Manipulate Excel from Jacob/Java
and look at the JXL Guide
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.