Bug 60314 - Make the conditional formatting range editable
Summary: Make the conditional formatting range editable
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: XSSF (show other bugs)
Version: 3.15-FINAL
Hardware: PC All
: P2 enhancement (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-10-28 12:14 UTC by Luca Martini
Modified: 2016-11-08 08:38 UTC (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Luca Martini 2016-10-28 12:14:40 UTC
While there is a method that given a ConditionalFormatting object returns the array of CellRangeAddress is applied to, there is no public method to set a new array of CellRangeAddress.

We suggest to add a method to the XSSFSheetConditionalFormatting that sets the a new formatting range

i.e.

public void setFormattingRanges(CellRangeAddress[] ranges) {
...
}
Comment 1 Luca Martini 2016-10-28 14:04:51 UTC
I just created the pull request #42 on on GitHub [1]
The pr includes the new method and and adds a simple unit test to the TestXSSFConditionalFormatting class.

This very simple contribution could be reused when implementing conditional formatting copy as see in bug 58348.

Best,
Luca


[1] https://github.com/apache/poi/pull/42
Comment 2 Nick Burch 2016-10-28 17:17:05 UTC
Two things that'd be great:
 * Any chance you could write a junit unit test for this change, so we can ensure it works, and stays working?
 * Any chance you could be inspired by the logic in CFRecordsAggregate.updateFormulasAfterCellShift to write an equivalent HSSF set method?
Comment 3 Luca Martini 2016-10-31 09:40:09 UTC
Thank you Nick for your comment.
I implemented the method also for HSSF and pulled up the method to the interface.

The pull requested already contained an unit test. I added two more unit tests and put them in the base test classes, so to exercise both HSFF and XSSF.

Best,
    Luca
Comment 4 Luca Martini 2016-11-08 08:38:20 UTC
The issue has been solved in r1768588
Thank you.
    Luca