Bug 68779 - Mixed cell reference is being malformatted
Summary: Mixed cell reference is being malformatted
Status: NEW
Alias: None
Product: POI
Classification: Unclassified
Component: XSSF (show other bugs)
Version: 5.2.3-FINAL
Hardware: PC
: P2 critical (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-03-14 09:35 UTC by baha.merzougui
Modified: 2024-03-14 09:35 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description baha.merzougui 2024-03-14 09:35:59 UTC
When creating a conditional formatting rule using formula String such as:
ISNUMBER(SEARCH(ADDRESS(MATCH($C1,INDIRECT(HLOOKUP($B1,CategoryLookup,4,0)),0)+1,COLUMN(INDIRECT(HLOOKUP($B1,CategoryLookup,4,0))),4),$ref.E$1))

------------------------------Code snippet------------------------------
SheetConditionalFormatting sheetCF = sheet.getSheetConditionalFormatting();

ConditionalFormattingRule rule = sheetCF.createConditionalFormattingRule(
"ISNUMBER(SEARCH(ADDRESS(MATCH($C1,INDIRECT(HLOOKUP($B1,CategoryLookup,4,0)),0)+1,COLUMN(INDIRECT(HLOOKUP($B1,CategoryLookup,4,0))),4),$ref.E$1))");


PatternFormatting fill = rule.createPatternFormatting();
fill.setFillBackgroundColor( IndexedColors.YELLOW.index);
fill.setFillPattern( PatternFormatting.SOLID_FOREGROUND);

ConditionalFormattingRule[] cfRules = new ConditionalFormattingRule[] { rule };

CellRangeAddress[] regions = new CellRangeAddress[] { CellRangeAddress.valueOf( "D1:L10000") };

sheetCF.addConditionalFormatting( regions, cfRules);
----------------------------------------------------------------------

The formatting rule from the generated xslx file is written as follow:
ISNUMBER(SEARCH(ADDRESS(MATCH($C1,INDIRECT(HLOOKUP($B1,CategoryLookup,4,0)),0)+1,COLUMN(INDIRECT(HLOOKUP($B1,CategoryLookup,4,0))),4),$ref.e$1))

The problem seems to be reproducible with every mixed cell referencing; in this example $ref.e$1 , I attempted the other way around $ref.$E1 fixed column changing row same problem.
The fact that the Alpha index of the cell is lower cased is breaking it.