Posted 3 February 2020, 9:12 am EST
Hello
Is there possibility to set selected area border as dashed or dotted?
Forums Home / Spread / SpreadJS
Posted by: vlad.goshkovych on 3 February 2020, 9:12 am EST
Posted 3 February 2020, 9:12 am EST
Hello
Is there possibility to set selected area border as dashed or dotted?
Posted 4 February 2020, 6:59 am EST
Hi Vlad,
Would you please confirm if you need to style the selected cells and set their border or do you need to modify the Selection rectangle shown to highlight the selected portion?
If it is the first case, then you get the current selection using the getSelections() method and then set the border using the setBorder() method. Please refer to the following sample demonstrating the same:
https://www.grapecity.com/spreadjs/demos/features/worksheet/borders-gridlines/purejs
API references:
• getSelections() method: https://www.grapecity.com/spreadjs/docs/v13/online/SpreadJS~GC.Spread.Sheets.Worksheet~getSelections.html
• setBorder() method: https://www.grapecity.com/spreadjs/docs/v13/online/SpreadJS~GC.Spread.Sheets.CellRange~setBorder.html
Regards
Sharad
Posted 5 February 2020, 5:43 am EST
Hi Sharad
Thanks for fast answer.
I need to style borders for the Selection rectangle shown to highlight the selected portion.
BR
V.
Posted 6 February 2020, 3:23 am EST
We are sorry but currently, SJS does not support changing the border style for the selection rectangle. However, you may change the color of the selection border/selection background according to your requirements using the selectionBackColor/selectionBorderColor options. Please refer to the following code snippet and the sample demonstrating the same:
var sheet = spread.getActiveSheet();
sheet.options.selectionBorderColor = "red";
sheet.options.selectionBackColor = "rgba(255, 255, 0, 0.2)";
https://codesandbox.io/s/spread-js-starter-9cqn3
Alternatively, you could also set the selection color for all the sheets using the following CSS:
.gc-selection {
background-color: rgba(255, 255, 0, 0.2);
border-color: red;
}
Posted 7 February 2020, 4:19 am EST
Hello
For now I see the only way to achieve this is to style corresponding borders for like “borders cells” e. g. we selected B2:D4, then for cells B2,C2,D2 style top border, for D2, D3, D4 style right border etc.
Maybe you can suggest other workaround.
This is really needed for our PoC.
BR.
V.