This is an explanation of two techniques for using the 4D View command PV SET BORDER STYLE to set the borders of a range of cells.
Setting cell borders is a two-step process. First, you must specify the border style of an edge or edges using PV SET BORDER STYLE. Then you must apply that style to a range of cells using PV SET RANGE BORDER. Two examples follow:
Example 1:
Passing one border edge constant at a time to PV SET BORDER STYLE (that is using separate calls to PV SET BORDER STYLE), the border edges are additive. The following code results in a range of cells that are surrounded by a blue border, and the top edge of that border is a thicker blue line.
PV SET BORDER STYLE (pv_ area;pv border edge left ;pv border style 2 ;PV Index to color (Blue ))
PV SET RANGE BORDER (pv_ area;$iLeftCellNb;$iRowNb;$iRightCellNb; iRowNb)
PV SET BORDER STYLE (pv_ area;pv border edge right ;pv border style 2 ;PV Index to color (Blue ))
PV SET RANGE BORDER (pv_ area;$iLeftCellNb;$iRowNb;$iRightCellNb; iRowNb)
PV SET BORDER STYLE (pv_ area;pv border edge bottom ;pv border style 2 ;PV Index to color (Blue ))
PV SET RANGE BORDER (pv_ area;$iLeftCellNb;$iRowNb;$iRightCellNb; iRowNb)
PV SET BORDER STYLE (pv_ area;pv border edge top ;pv border style 4 ;PV Index to color (Blue ))
PV SET RANGE BORDER (pv_ area;$iLeftCellNb;$iRowNb;$iRightCellNb; iRowNb)
This technique of setting one border at a time provides the flexibility to have different style edges for the range of cells.
Example 2:
Passing all 4 border edge constants to PV SET BORDER STYLE in one call, the borders are also additive. The following code results in a range of cells that are surrounded by a blue border in which the lines for all of the edges are the same thickness.
PV SET BORDER STYLE (pv_ area; pv border edge top +pv border edge bottom +pv border edge left +pv border edge right ;pv border style 2 ;PV Index to color (Blue ))
PV SET RANGE BORDER (pv_ area;$iLeftCellNb;$iRowNb;$iRightCellNb; iRowNb)
This technique of setting all the borders of a range of cells at one time requires less code than the technique presented in example 1, but it is not quite as flexible; all of the cell edges of the range of cells will be the same style line.
A closing thought:
Supposing you want to set the same exact cell range borders as in example 1. After considering the code for examples 1 and 2, you might think that you could get the desired result with the following code:
PV SET BORDER STYLE (pv_ area;pv border edge top ;pv border style 4 ;PV Index to color (Blue ))
PV SET RANGE BORDER (pv_ area;$iLeftCellNb;$iRowNb;$iRightCellNb; iRowNb)
PV SET BORDER STYLE (pv_ area;pv border edge bottom +pv border edge left +pv border edge right ;pv border style 2 ;PV Index to color (Blue ))
PV SET RANGE BORDER (pv_ area;$iLeftCellNb;$iRowNb;$iRightCellNb; iRowNb)
However, if you pass one border edge constant, say the top edge, to PV SET BORDER STYLE, and then pass the remaining three border edge constants to a single subsequent call to PV SET BORDER, the lack of a top border edge in that execution of PV SET BORDER STYLE is taken to mean that no border is desired for the missing border edge, and the border that was set in the first execution of PV SET BORDER STYLE will be removed. So, separate calls to PV SET BORDER STYLE are additive, or passing all 4 border constants to a single execution of PV SET BORDER STYLE is additive. But, if you pass more than one border edge constant and fewer than four to PV SET BORDER STYLE, the border edge constants that are missing will cause any borders on those edges to be removed.