Thank you! This was very helpful! On Wed, Apr 19, 2017 at 3:35 PM, Greg Woolsey <greg.wool...@gmail.com> wrote:
> Missed the 2nd half of the question. This class only returns rules that > match the current state of the workbook for a given cell - rules that would > be applied were it open in Excel. Note that this logic is limited to > evaluating functions actually implemented in POI, which is most of them, > but there are some exceptions and a few open bugs. > > The unit test has one example of usage: > > https://urldefense.proofpoint.com/v2/url?u=http-3A__svn. > apache.org_repos_asf_poi_trunk_src_ooxml_testcases_org_ > apache_poi_ss_usermodel_ConditionalFormattingEvalTest.java&d=DwIFaQ&c= > dmLomitc30UP5j2qU8E1rg&r=p42pHJHEwFZOHtVFHKJUdL2fYbroN33stXXb3Psthjw&m= > ftB0odLP9NpiHdLKILpfF8ePNrsTAR_3Oe2uV1pgn7s&s= > uz8szbVrYsfZxKUvlK3XJ0grjXaToTnwMnBv39ZBFrM&e= > > as does my submission to Vaadin-Spreadsheet: > > https://urldefense.proofpoint.com/v2/url?u=https-3A__github. > com_vaadin_spreadsheet_issues_461-23issuecomment-2D279091036&d=DwIFaQ&c= > dmLomitc30UP5j2qU8E1rg&r=p42pHJHEwFZOHtVFHKJUdL2fYbroN33stXXb3Psthjw&m= > ftB0odLP9NpiHdLKILpfF8ePNrsTAR_3Oe2uV1pgn7s&s=2Q- > KjSfhwqGzVNryzhoGkd0TB92h4bYfsQBwIvjZy98&e= > > On Wed, Apr 19, 2017 at 3:26 PM Greg Woolsey <greg.wool...@gmail.com> > wrote: > > > The class is org.apache.poi.ss.formula.ConditionalFormattingEvaluator in > > poi-3.16.jar. > > > > Use is something like this: > > > > WorkbookEvaluatorProvider wbEvalProv = (WorkbookEvaluatorProvider) > > workbook.getCreationHelper().createFormulaEvaluator(); > > ConditionalFormattingEvaluator cfEval = new > > ConditionalFormattingEvaluator(workbook, wbEvalProv); > > // if cell values have changed, clear cached format results > > cfEvaluator.clearAllCachedValues(); > > List<EvaluationConditionalFormatRule> rules = > > cfEvaluator.getConditionalFormattingForCell(cell); > > // check rules list for null, do what you want with results > > // EvaluationConditionalFormatRule provides a more user-friendly API to > > the disparate underlying elements for a given match > > > > > > > > On Wed, Apr 19, 2017 at 2:28 PM Blake Watson <blake.wat...@pnmac.com> > > wrote: > > > >> Greg, > >> > >> I'm having trouble figuring out how to use the conditional stuff. I > >> can't > >> seem to =find= ConditionalFormattingEvaluator in the POI jar. > >> > >> If I could find it, I'm not sure how I'd use it: > >> > >> ec = ConditionalFormattingEvaluator(Workbook wb, > WorkbookEvaluatorProvider > >> provider); > >> > >> How do I create "provider"? I don't get the "IStabilityClass" thing. > >> > >> Once having it, I would guess I call: > >> > >> list = ec.getConditionalFormattingForCell(someCell); > >> > >> and for each item in the list: > >> > >> fmt = item.getFormatting(); > >> > >> But does getConditionalFormattingForCell return all the formats > POSSIBLE > >> or > >> only the ones that apply based on the spreadsheet's current state? And > if > >> the former, how do I eliminate the ones that apply? > >> > >> I feel like I'm looking completely in the wrong direction, but I haven't > >> been able to locate any examples of how to use this. > >> > > > -- *Blake Watson* *PNMAC* Application Development Manager 5898 Condor Drive Moorpark, CA 93021 (805) 330.4911 x7742 blake.wat...@pnmac.com <melanie.petros...@pnmac.com> www.PennyMacUSA.com <http://www.pennymacusa.com/>