[Bug 58787] [patch] Border utility to set cell styles around a range of cells
https://bz.apache.org/bugzilla/show_bug.cgi?id=58787 ithan changed: What|Removed |Added CC||ithanr...@gmail.com -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org For additional commands, e-mail: dev-h...@poi.apache.org
[Bug 58787] [patch] Border utility to set cell styles around a range of cells
https://bz.apache.org/bugzilla/show_bug.cgi?id=58787 --- Comment #43 from Mark Murphy--- r1763338 addresses issues 1,3, 6, and 7 from comment 22. Remaining is issue 2. As far as issues 4 and 5 go, I plan to add additional attributes in the CellStyleTemplate class, and I am considering ways to integrate it into the RegionUtil class, but have not yet determined how that would work. -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org For additional commands, e-mail: dev-h...@poi.apache.org
[Bug 58787] [patch] Border utility to set cell styles around a range of cells
https://bz.apache.org/bugzilla/show_bug.cgi?id=58787 --- Comment #42 from Javen O'Neal--- (In reply to Mark Murphy from comment #41) > something has changed in my environment since I last tested Try ant clean jenkins. Sometimes outdated artifacts don't get rebuilt when they should (I've been bitten on test-ss and test-ooxml-ss before), probably due to problems in the ant rules I wrote into build.xml. If you want, create an svn branch to commit your changes and merge when done. I believe we can create a Jenkins job for branches. If you're comfortable with git or git-svn, local commits is another good option. -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org For additional commands, e-mail: dev-h...@poi.apache.org
[Bug 58787] [patch] Border utility to set cell styles around a range of cells
https://bz.apache.org/bugzilla/show_bug.cgi?id=58787 --- Comment #41 from Mark Murphy--- (In reply to Javen O'Neal from comment #40) > Two other changes: > # Rather than saving all property template values as Shorts, I stored > higher-level objects (BorderStyle and BorderExtent) when available. This > user code, makes unit tests, and error messages easier to read while also > allowing us to deprecate and remove meaningless code/id fields on enums. > > public Object getTemplateProperty(CellAddress cell, String property) > from [1] > > # As a marginal performance improvement, I used 4 Map.containsKey calls > rather than for-looping over all the keys in cell style template to count > getNumBorders and getNumBorderColors [2]. > > [1] > https://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/util/ > BorderPropertyTemplate.java?revision=1748075=markup=1748292#l928 > [2] > https://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/util/ > BorderPropertyTemplate.java?revision=1748075=markup=1748292#l888 Never mind, I wasn't ready anyway, something has changed in my environment since I last tested, and I can't make things work now. Rokie mistake, won't happen again. I have reverted things until I get it cleared up in my environment. I will look at your suggestions as well. Thanks for those. -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org For additional commands, e-mail: dev-h...@poi.apache.org
[Bug 58787] [patch] Border utility to set cell styles around a range of cells
https://bz.apache.org/bugzilla/show_bug.cgi?id=58787 --- Comment #40 from Javen O'Neal--- Two other changes: # Rather than saving all property template values as Shorts, I stored higher-level objects (BorderStyle and BorderExtent) when available. This user code, makes unit tests, and error messages easier to read while also allowing us to deprecate and remove meaningless code/id fields on enums. > public Object getTemplateProperty(CellAddress cell, String property) from [1] # As a marginal performance improvement, I used 4 Map.containsKey calls rather than for-looping over all the keys in cell style template to count getNumBorders and getNumBorderColors [2]. [1] https://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/util/BorderPropertyTemplate.java?revision=1748075=markup=1748292#l928 [2] https://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/util/BorderPropertyTemplate.java?revision=1748075=markup=1748292#l888 -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org For additional commands, e-mail: dev-h...@poi.apache.org
[Bug 58787] [patch] Border utility to set cell styles around a range of cells
https://bz.apache.org/bugzilla/show_bug.cgi?id=58787 --- Comment #39 from Javen O'Neal--- When there is no significant speed or memory benefit to using (int row, int col) arguments over a more descriptive CellAddress argument to a public function, only the function using the CellAddress argument should be in the public API. This keeps classes smaller and easier to find the function that needs to be used, even if it moves the CellAddress object creation from the POI library to user code. This is probably a good thing because it encourages reuse of the CellAddress objects (hiding the object creation in the method hides that cost). I would recommend deleting the following methods: > public int getNumBorders(int row, int col) > public BorderStyle getBorderStyle(int row, int col, String property) > public int getNumBorderColors(int row, int col) > public short getTemplateProperty(int row, int col, String property) Every POI entry point is: * another function to test * another potential bug (null pointer and range check being the most likely) * mental burden for the user to figure out which variant of a function to use. These can be completely removed (no deprecation warning) without a deprecation warning up to 3.15 final release. -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org For additional commands, e-mail: dev-h...@poi.apache.org
[Bug 58787] [patch] Border utility to set cell styles around a range of cells
https://bz.apache.org/bugzilla/show_bug.cgi?id=58787 Mark Murphychanged: What|Removed |Added Attachment #33684|0 |1 is obsolete|| -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org For additional commands, e-mail: dev-h...@poi.apache.org
[Bug 58787] [patch] Border utility to set cell styles around a range of cells
https://bz.apache.org/bugzilla/show_bug.cgi?id=58787 --- Comment #37 from Mark Murphy--- Created attachment 33948 --> https://bz.apache.org/bugzilla/attachment.cgi?id=33948=edit Patch file generated by ant This leaves 2. Additional unit tests to verify reduced style creation unfinished -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org For additional commands, e-mail: dev-h...@poi.apache.org
[Bug 58787] [patch] Border utility to set cell styles around a range of cells
https://bz.apache.org/bugzilla/show_bug.cgi?id=58787 --- Comment #36 from Mark Murphy--- (In reply to comment #27) > private boolean borderIsNotSet(CellAddress cell, String borderDirection) { > Object borderLineStyle = getTemplateProperty(cell, borderDirection); > -return (borderLineStyle == null); > +return (borderLineStyle == null) || (borderLineStyle == > BorderStyle.NONE); > } Changed this to borderIsSet() because I generally do not like negative logic flags. That is, booleans with something like Not in the name. These flags tend to map a value like Found to False, and Not Found to True. Is the object notFound? Yes the object is notFound, or No the object is not notFound. Too many nots. I prefer to put the negation in the operator. -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org For additional commands, e-mail: dev-h...@poi.apache.org
[Bug 58787] [patch] Border utility to set cell styles around a range of cells
https://bz.apache.org/bugzilla/show_bug.cgi?id=58787 --- Comment #35 from Mark Murphy--- (In reply to comment #27) > When adding a border color, if a border line style is not set in the property > template, the code sets it. Was there any reason for using drawTopBorder > rather > than directly adding the property? Now that I can look at my code, this is a style thing. While it would work to just add the code here, if a bug were to rear it's ugly head in drawTopBorder(), we would potentially have two places to make the correction. One in drawTopBorderColor(), and one in drawTopBorder(). Notice that there is already one side case where we are removing a border by setting it to NONE which adds extra code. Granted the need to ensure a border exists to apply a color to would not ever be setting the top border to NONE, but say another side case appears? My time programming RPG has given me a strong appreciation for the DRY concepts because I frequently experience what happens when that isn't followed. -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org For additional commands, e-mail: dev-h...@poi.apache.org
[Bug 58787] [patch] Border utility to set cell styles around a range of cells
https://bz.apache.org/bugzilla/show_bug.cgi?id=58787 --- Comment #34 from Javen O'Neal--- (In reply to Javen O'Neal from comment #32) > I can roll back the changes for BorderPropertyTemplate and add > CellStyleTemplate. I like that idea better. Maybe rewrite RegionUtil as well > if you want a class that operates on a cell range rather than a single cell. Rolled back in r1748293, r1748294, and r1748295. -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org For additional commands, e-mail: dev-h...@poi.apache.org
[Bug 58787] [patch] Border utility to set cell styles around a range of cells
https://bz.apache.org/bugzilla/show_bug.cgi?id=58787 --- Comment #33 from Mark Murphy--- (In reply to Javen O'Neal from comment #32) > I can roll back the changes for BorderPropertyTemplate and add > CellStyleTemplate. I like that idea better. Maybe rewrite RegionUtil as well > if you want a class that operates on a cell range rather than a single cell. I have some ideas for RegionUtil that would take advantage of CellStyleTemplate. I just need to decide how to implement them. We could set up some methods that would draw a full grid, or horizontal lines or vertical lines, or full grid with an outline. Potentially other combinations, but what is the best way to do that. Then when CellStyleTemplate supports fills we could add even/odd banding in RegionUtil. Still meditating on that. This is just to make CellStyleTemplate more approachable. Maybe to keep things simple we should just have an enum of predefined CellStyleTemplates accessible from RegionUtil with a single call, and anything more complex would call for direct use of the CellStyleTemplate. -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org For additional commands, e-mail: dev-h...@poi.apache.org
[Bug 58787] [patch] Border utility to set cell styles around a range of cells
https://bz.apache.org/bugzilla/show_bug.cgi?id=58787 --- Comment #32 from Javen O'Neal--- I can roll back the changes for BorderPropertyTemplate and add CellStyleTemplate. I like that idea better. Maybe rewrite RegionUtil as well if you want a class that operates on a cell range rather than a single cell. -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org For additional commands, e-mail: dev-h...@poi.apache.org
[Bug 58787] [patch] Border utility to set cell styles around a range of cells
https://bz.apache.org/bugzilla/show_bug.cgi?id=58787 --- Comment #31 from Mark Murphy--- (In reply to Javen O'Neal from comment #27) > Mark, > > When adding a border color, if a border line style is not set in the > property template, the code sets it. Was there any reason for using > drawTopBorder rather than directly adding the property? > > > private void drawTopBorderColor(CellRangeAddress range, short color) { > > int row = range.getFirstRow(); > > int firstCol = range.getFirstColumn(); > > int lastCol = range.getLastColumn(); > > for (int i = firstCol; i <= lastCol; i++) { > > CellAddress cell = new CellAddress(row, i); > > // if BORDER_TOP is not set on BorderPropertyTemplate, make a thin > > border so that there's something to color > > if (borderIsNotSet(cell, CellUtil.BORDER_TOP)) { > > -drawTopBorder(new CellRangeAddress(row, row, i, i), > > BorderStyle.THIN); > > +addProperty(cell, CellUtil.BORDER_TOP, BorderStyle.THIN); > > } > > addProperty(cell, CellUtil.TOP_BORDER_COLOR, color); > > } > > } > > Also, what should BorderPropertyTemplate do if the border line style is set > to NONE and then drawTopBorderColor is called? Should it change the > BorderStyle to THIN? > > private boolean borderIsNotSet(CellAddress cell, String borderDirection) { > > Object borderLineStyle = getTemplateProperty(cell, borderDirection); > > -return (borderLineStyle == null); > > +return (borderLineStyle == null) || (borderLineStyle == > > BorderStyle.NONE); > > } Why use drawTopBorder? I don't have the code in front of me right now, but probably to be consistent with the others. For interior borders there is an issue with page breaks, if you do not have both the top border on one cell, and the bottom border of the cell above it, either the line at the bottom of the page or the line at the top of the next page will be missing from the printed document. This would not apply to top borders, but I suspect that all the color methods just use the draw method to ensure any special edge cases like that are handled. What to do about setting color for NONE border? I guess that the least surprising option would be to add a THIN border. -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org For additional commands, e-mail: dev-h...@poi.apache.org
[Bug 58787] [patch] Border utility to set cell styles around a range of cells
https://bz.apache.org/bugzilla/show_bug.cgi?id=58787 --- Comment #30 from Mark Murphy--- (In reply to Javen O'Neal from comment #26) > (In reply to Javen O'Neal from comment #22) > > 1. DrawingBorders example: Use CellRangeAddress("B2:D5") to make it easier > > to see what's going on > Applied in r1747888 > > > 3. Try to find more descriptive names for PropertyTemplate and Extent. > Applied in r1747884. Using BorderPropertyTemplate and BorderExtent. > > > 7. Create a blocker to this bug: a re-write/deprecation of short borderTypes > > in favor of enums. > Applied in r1747868. I converted borderTypes from short to BorderStyles enum. > The colors will remain as short values, since they are indices into the > color table (indexed+custom). Sorry for taking so long to send my patches to you. If I had added my changes, you wouldn't have had to do so much work. Instead of BorderPropertyTemplate I was using CellStyleTemplate as it would be useful for other CellStyle attributes beside Border attributes. For example I had planned to add fills to it as well. I moved away from BorderPropertyTemplate since that name seems limiting to me. If I had sent my patch sooner, you would have known that. My fault, but just to prevent too many from using BorderPropertyTemplate, we may want to change that sooner rather than later. Thanks for taking your time to work on this. -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org For additional commands, e-mail: dev-h...@poi.apache.org
[Bug 58787] [patch] Border utility to set cell styles around a range of cells
https://bz.apache.org/bugzilla/show_bug.cgi?id=58787 --- Comment #29 from Javen O'Neal--- (In reply to Javen O'Neal from comment #25) > (In reply to Mark Murphy from comment #20) > > Created attachment 33684 [details] > > Patch file generated via Ant script > > Applied in r1747851 to branches/ss_border_property_template Merged to trunk in r1748075. Deleted branches/ss_border_property_template in r1748076. Remaining: * comment 27 (question about draw(Top|Bottom|Left|Right)BorderColor) * 2. Unit test: add a test case counting up the number of styles that are in a workbook before and after. Do the same for RegionUtil and demonstrate that PropertyTemplate creates significantly fewer intermediate styles. Either look at total number of cell styles (wb.getNumCellStyles) or number of cell styles in the styles table that are not referenced by any cells. -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org For additional commands, e-mail: dev-h...@poi.apache.org
[Bug 58787] [patch] Border utility to set cell styles around a range of cells
https://bz.apache.org/bugzilla/show_bug.cgi?id=58787 --- Comment #28 from Javen O'Neal--- (In reply to Javen O'Neal from comment #22) > 6. The _propertyTemplate map is stuck/hidden from a user. What if the user > wants to build up a base template, and fork it with two variations? > Potential solution: add a PropertyTemplate(PropertyTemplate other) > constructor that would deep-copy the Map Applied in r1748071. -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org For additional commands, e-mail: dev-h...@poi.apache.org
[Bug 58787] [patch] Border utility to set cell styles around a range of cells
https://bz.apache.org/bugzilla/show_bug.cgi?id=58787 --- Comment #27 from Javen O'Neal--- Mark, When adding a border color, if a border line style is not set in the property template, the code sets it. Was there any reason for using drawTopBorder rather than directly adding the property? > private void drawTopBorderColor(CellRangeAddress range, short color) { > int row = range.getFirstRow(); > int firstCol = range.getFirstColumn(); > int lastCol = range.getLastColumn(); > for (int i = firstCol; i <= lastCol; i++) { > CellAddress cell = new CellAddress(row, i); > // if BORDER_TOP is not set on BorderPropertyTemplate, make a thin > border so that there's something to color > if (borderIsNotSet(cell, CellUtil.BORDER_TOP)) { > -drawTopBorder(new CellRangeAddress(row, row, i, i), > BorderStyle.THIN); > +addProperty(cell, CellUtil.BORDER_TOP, BorderStyle.THIN); > } > addProperty(cell, CellUtil.TOP_BORDER_COLOR, color); > } > } Also, what should BorderPropertyTemplate do if the border line style is set to NONE and then drawTopBorderColor is called? Should it change the BorderStyle to THIN? > private boolean borderIsNotSet(CellAddress cell, String borderDirection) { > Object borderLineStyle = getTemplateProperty(cell, borderDirection); > -return (borderLineStyle == null); > +return (borderLineStyle == null) || (borderLineStyle == > BorderStyle.NONE); > } -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org For additional commands, e-mail: dev-h...@poi.apache.org
[Bug 58787] [patch] Border utility to set cell styles around a range of cells
https://bz.apache.org/bugzilla/show_bug.cgi?id=58787 --- Comment #26 from Javen O'Neal--- (In reply to Javen O'Neal from comment #22) > 1. DrawingBorders example: Use CellRangeAddress("B2:D5") to make it easier > to see what's going on Applied in r1747888 > 3. Try to find more descriptive names for PropertyTemplate and Extent. Applied in r1747884. Using BorderPropertyTemplate and BorderExtent. > 7. Create a blocker to this bug: a re-write/deprecation of short borderTypes > in favor of enums. Applied in r1747868. I converted borderTypes from short to BorderStyles enum. The colors will remain as short values, since they are indices into the color table (indexed+custom). -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org For additional commands, e-mail: dev-h...@poi.apache.org
[Bug 58787] [patch] Border utility to set cell styles around a range of cells
https://bz.apache.org/bugzilla/show_bug.cgi?id=58787 --- Comment #25 from Javen O'Neal--- (In reply to Mark Murphy from comment #20) > Created attachment 33684 [details] > Patch file generated via Ant script Applied in r1747851 to branches/ss_border_property_template -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org For additional commands, e-mail: dev-h...@poi.apache.org
[Bug 58787] [patch] Border utility to set cell styles around a range of cells
https://bz.apache.org/bugzilla/show_bug.cgi?id=58787 Mark Murphychanged: What|Removed |Added Blocks||5 -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org For additional commands, e-mail: dev-h...@poi.apache.org
[Bug 58787] [patch] Border utility to set cell styles around a range of cells
https://bz.apache.org/bugzilla/show_bug.cgi?id=58787 --- Comment #24 from Javen O'Neal--- Update this documentation as well: https://poi.apache.org/faq.html#faq-N100E3 -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org For additional commands, e-mail: dev-h...@poi.apache.org
[Bug 58787] [patch] Border utility to set cell styles around a range of cells
https://bz.apache.org/bugzilla/show_bug.cgi?id=58787 Bug 58787 depends on bug 59264, which changed state. Bug 59264 Summary: Unify interface for setting cell border line styles using BorderStyle enum instead of short code https://bz.apache.org/bugzilla/show_bug.cgi?id=59264 What|Removed |Added Status|NEW |RESOLVED Resolution|--- |FIXED -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org For additional commands, e-mail: dev-h...@poi.apache.org
[Bug 58787] [patch] Border utility to set cell styles around a range of cells
https://bz.apache.org/bugzilla/show_bug.cgi?id=58787 Javen O'Nealchanged: What|Removed |Added Blocks||54593 -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org For additional commands, e-mail: dev-h...@poi.apache.org
[Bug 58787] [patch] Border utility to set cell styles around a range of cells
https://bz.apache.org/bugzilla/show_bug.cgi?id=58787 --- Comment #23 from Javen O'Neal--- (In reply to Javen O'Neal from comment #22) > 7. Create a blocker to this bug: a re-write/deprecation of short borderTypes > in > favor of enums. Opened bug 59264 to take care of this. -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org For additional commands, e-mail: dev-h...@poi.apache.org
[Bug 58787] [patch] Border utility to set cell styles around a range of cells
https://bz.apache.org/bugzilla/show_bug.cgi?id=58787 Javen O'Nealchanged: What|Removed |Added Summary|[patch] Border Drawing |[patch] Border utility to |utility that does not |set cell styles around a |create unnecessary styles |range of cells --- Comment #22 from Javen O'Neal --- Take a look at the following files: Common SS: - src/java/org/apache/poi/ss/util/RegionUtil.java - set the same border style or color on an outer edge of a cell region - almost the same as attachment 33684 except does not handle ALL, NONE, and interior edges of a region - src/java/org/apache/poi/ss/usermodel/BorderFormatting.java - get/set border styles (dot, dash, etc) and colors - implementing classes: - src/java/org/apache/poi/hssf/usermodel/HSSFBorderFormatting.java bound to a workbook, CFRuleRecord, and BorderFormatting* - src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFBorderFormatting.java bound to a CTBorder - src/java/org/apache/poi/ss/util/CellUtil.java - constants for the names of border properties to be used as keys in get/setCellStyleProperties - get/setCellStyleProperties, use a Map that is detached from cells or styles, then when setting cell style properties, search through existing styles and add a new style only if no identical style exists. HSSF: - src/java/org/apache/poi/hssf/record/cf/BorderFormatting.java - a class to handle the bit-stuffing for records used by HSSFBorderFormatting HSSF Examples: - src/examples/src/org/apache/poi/hssf/usermodel/examples/Borders.java - a cell style attached to (potentially) multiple cells can be modified one attribute at a time (border line style, border line color) HWPF: - src/scratchpad/src/org/apache/poi/hwpf/usermodel/BorderCode.java - create a border object that is detached from other objects (paragraph, table) - specifies border line width, border style (dot, dash, etc), border color, border space between text and border, etc, presumably for Text Boxes? XWPF: - src/ooxml/java/org/apache/poi/xwpf/usermodel/Borders.java - an enum to hold the ~191 border styles for Word documents Some of these features were written without enums, so it's pretty messy. Going forward, it's worthwhile to make these methods enum-friendly (and therefore type safe). All of the classes listed above operate on a single border format that could be applied to a single cell, except for RegionUtil. RegionUtil sets the styles with CellUtil.setCellStyleProperty immediately, while PropertyTemplate maintains an internal Map to a Sheet, and explicitly applies the styles to a sheet with applyBorders. If two regions do not overlap and the style of each region is homogeneous, RegionUtil may create *slightly* more intermediate styles (the corners) than PropertyTemplate. If two regions overlap, RegionUtil is likely to create many more styles than necessary. Here's what needs done: 1. DrawingBorders example: Use CellRangeAddress("B2:D5") to make it easier to see what's going on 2. Unit test: add a test case counting up the number of styles that are in a workbook before and after. Do the same for RegionUtil and demonstrate that PropertyTemplate creates significantly fewer intermediate styles. Either look at total number of cell styles (wb.getNumCellStyles) or number of cell styles in the styles table that are not referenced by any cells. 3. Try to find more descriptive names for PropertyTemplate and Extent. BorderUtil/BorderPropertyTemplate and BorderArrangement/BorderRegionEdges/BorderExtent. 4. Try to integrate your PropertyTemplate code into RegionUtil (might be easier to copy RegionUtil into PropertyTemplate and rename PropertyTemplate to RegionUtil). 5. My guess is that the inspiration for this class is to build up a template that you could stamp onto multiple similarly-formatted sheets. This is a more common usecase for POI because we deal with computer-generated templates, but it might not be the most common use case (certainly for entry-level applications). See if you can make this class more approachable to a wider audience. If not, then maybe it's better to let BorderPropertyTemplate remain a separate (higher-level) class from RegionUtil, and not plan to replace RegionUtil. 6. The _propertyTemplate map is stuck/hidden from a user. What if the user wants to build up a base template, and fork it with two variations? Potential solution: add a PropertyTemplate(PropertyTemplate other) constructor that would deep-copy the Map (I think the Java consensus is that copy constructors are preferred over clone because it's easier to subclass). 7. Create a blocker to this bug: a re-write/deprecation of short borderTypes in favor of enums. It'd be a shame to have a shiny new class that uses non-type-safe borderTypes or