Author Topic: how to set multiple cell border color  (Read 1729 times)

msdnweixiao

  • Pro Enterprise
  • Newbie
  • *
  • Posts: 21
    • View Profile
how to set multiple cell border color
« on: December 02, 2020, 11:04:51 am »
when i selected multiple cell, then how to change border's color ?

not the cell color , is the selected area's border color.

thank you.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6313
    • View Profile
Re: how to set multiple cell border color
« Reply #1 on: December 02, 2020, 02:28:48 pm »
This sets the border of all cells in the Selection.

Code: [Select]
var Sel = grid.Selection();
Sel.style("border-top", "1px solid red")
Sel.style("border-right", "1px solid red")
Sel.style("border-bottom", "1px solid red")
Sel.style("border-left", "1px solid red")

msdnweixiao

  • Pro Enterprise
  • Newbie
  • *
  • Posts: 21
    • View Profile
Re: how to set multiple cell border color
« Reply #2 on: December 07, 2020, 07:00:03 am »
i use it ,but it not worked.

i want to set the border of selection, not the border of all cells in selected area;

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6313
    • View Profile
Re: how to set multiple cell border color
« Reply #3 on: December 07, 2020, 12:37:12 pm »
To apply border to Selection edges only, you can divide Selection object edges into 4 Range objects and apply border to those Range objects.

For code reference, I've added Border -> All Selection edges item in the context menu in this example:

https://paramquery.com/pro/demos/import-xlsx