In older versions you could type something like:
propertyTemplate.drawBorders(cellsRegionRange, BorderStyle.THICK, IndexedColors.YELLOW1.index, BorderExtent.OUTSIDE);
That results in an exterior border - even around merged cells, with selected color. Unfortunately with new version of POI it seems that I cannot use Indexed colors, since the methods of getting an index of a custom RGB color are not working and are being depricated or tagged as TEST ONLY.
So because of coloring I had to drop propertyTemplate class. Now I know how to color the border using XSSFColor constructor and XSSFCellStyle:
XSSFColor borderColorXSF = new XSSFColor(rgbB, null);
But I dont know how to apply the XSSFCellStyle to the merged region of cells, I have tried RegionUtil which I think results only in overwriting the XSSFCellStyle so everything is black, even the fill color.
So my question is whats the correct way to get around propertyTemplate class?
The only solution I have found was to iterate over each cell, check if any of its border is Inner or Outer and set the cell style border accordingly. I have basically wrote some of the HSSF PropertyTemplate class methods on my own. Note that I have found out that you cannot mix HSSF and XSSF methods or objects as it then starts to behave unpredictably even though the program runs without exceptions.