Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. range of cells border question

range of cells border question

Scheduled Pinned Locked Moved C#
question
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    Blubbo
    wrote on last edited by
    #1

    I'm having trouble getting the different line weight. Let's say to have cells from A1 to A3... I would like to have the border to be medium weight continuous line around this range, while having the hairline hortizontal line inside. This is what I have:

    xlRange = (Excel.Range)xlWorkSheet.get_Range(Cell_1, Cell_2);
    xlRange.Borders.Weight = Excel.XlBorderWeight.xlMedium;
    xlRange.Borders[Excel.XlBordersIndex.xlEdgeBottom].LineStyle = Excel.XlLineStyle.xlContinuous;
    xlRange.Borders[Excel.XlBordersIndex.xlEdgeLeft].LineStyle = Excel.XlLineStyle.xlContinuous;
    xlRange.Borders[Excel.XlBordersIndex.xlEdgeTop].LineStyle = Excel.XlLineStyle.xlContinuous;
    xlRange.Borders[Excel.XlBordersIndex.xlEdgeRight].LineStyle = Excel.XlLineStyle.xlContinuous;

    xlRange.Borders.Weight = Excel.XlBorderWeight.xlHairline;
    xlRange.Borders[Excel.XlBordersIndex.xlInsideHorizontal].LineStyle = Excel.XlLineStyle.xlContinuous;

    I got hairline weight continuous line in this on around each cell in this range... huh?

    L 1 Reply Last reply
    0
    • B Blubbo

      I'm having trouble getting the different line weight. Let's say to have cells from A1 to A3... I would like to have the border to be medium weight continuous line around this range, while having the hairline hortizontal line inside. This is what I have:

      xlRange = (Excel.Range)xlWorkSheet.get_Range(Cell_1, Cell_2);
      xlRange.Borders.Weight = Excel.XlBorderWeight.xlMedium;
      xlRange.Borders[Excel.XlBordersIndex.xlEdgeBottom].LineStyle = Excel.XlLineStyle.xlContinuous;
      xlRange.Borders[Excel.XlBordersIndex.xlEdgeLeft].LineStyle = Excel.XlLineStyle.xlContinuous;
      xlRange.Borders[Excel.XlBordersIndex.xlEdgeTop].LineStyle = Excel.XlLineStyle.xlContinuous;
      xlRange.Borders[Excel.XlBordersIndex.xlEdgeRight].LineStyle = Excel.XlLineStyle.xlContinuous;

      xlRange.Borders.Weight = Excel.XlBorderWeight.xlHairline;
      xlRange.Borders[Excel.XlBordersIndex.xlInsideHorizontal].LineStyle = Excel.XlLineStyle.xlContinuous;

      I got hairline weight continuous line in this on around each cell in this range... huh?

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Blubbo wrote:

      xlRange = (Excel.Range)xlWorkSheet.get_Range(Cell_1, Cell_2); xlRange.Borders.Weight = Excel.XlBorderWeight.xlMedium; xlRange.Borders[Excel.XlBordersIndex.xlEdgeBottom].LineStyle = Excel.XlLineStyle.xlContinuous; xlRange.Borders[Excel.XlBordersIndex.xlEdgeLeft].LineStyle = Excel.XlLineStyle.xlContinuous; xlRange.Borders[Excel.XlBordersIndex.xlEdgeTop].LineStyle = Excel.XlLineStyle.xlContinuous; xlRange.Borders[Excel.XlBordersIndex.xlEdgeRight].LineStyle = Excel.XlLineStyle.xlContinuous;   xlRange.Borders.Weight = Excel.XlBorderWeight.xlHairline; xlRange.Borders[Excel.XlBordersIndex.xlInsideHorizontal].LineStyle = Excel.XlLineStyle.xlContinuous;

      ?

      Bastard Programmer from Hell :suss:

      B 2 Replies Last reply
      0
      • L Lost User

        Blubbo wrote:

        xlRange = (Excel.Range)xlWorkSheet.get_Range(Cell_1, Cell_2); xlRange.Borders.Weight = Excel.XlBorderWeight.xlMedium; xlRange.Borders[Excel.XlBordersIndex.xlEdgeBottom].LineStyle = Excel.XlLineStyle.xlContinuous; xlRange.Borders[Excel.XlBordersIndex.xlEdgeLeft].LineStyle = Excel.XlLineStyle.xlContinuous; xlRange.Borders[Excel.XlBordersIndex.xlEdgeTop].LineStyle = Excel.XlLineStyle.xlContinuous; xlRange.Borders[Excel.XlBordersIndex.xlEdgeRight].LineStyle = Excel.XlLineStyle.xlContinuous;   xlRange.Borders.Weight = Excel.XlBorderWeight.xlHairline; xlRange.Borders[Excel.XlBordersIndex.xlInsideHorizontal].LineStyle = Excel.XlLineStyle.xlContinuous;

        ?

        Bastard Programmer from Hell :suss:

        B Offline
        B Offline
        Blubbo
        wrote on last edited by
        #3

        these are the two weights I want... the medium would go around the range of cells, while the hairline is inside horizontal lines. I wish I could post an illustration in this post as an example.

        1 Reply Last reply
        0
        • L Lost User

          Blubbo wrote:

          xlRange = (Excel.Range)xlWorkSheet.get_Range(Cell_1, Cell_2); xlRange.Borders.Weight = Excel.XlBorderWeight.xlMedium; xlRange.Borders[Excel.XlBordersIndex.xlEdgeBottom].LineStyle = Excel.XlLineStyle.xlContinuous; xlRange.Borders[Excel.XlBordersIndex.xlEdgeLeft].LineStyle = Excel.XlLineStyle.xlContinuous; xlRange.Borders[Excel.XlBordersIndex.xlEdgeTop].LineStyle = Excel.XlLineStyle.xlContinuous; xlRange.Borders[Excel.XlBordersIndex.xlEdgeRight].LineStyle = Excel.XlLineStyle.xlContinuous;   xlRange.Borders.Weight = Excel.XlBorderWeight.xlHairline; xlRange.Borders[Excel.XlBordersIndex.xlInsideHorizontal].LineStyle = Excel.XlLineStyle.xlContinuous;

          ?

          Bastard Programmer from Hell :suss:

          B Offline
          B Offline
          Blubbo
          wrote on last edited by
          #4

          argh! I found this info from online source... I will try to make this change. for the medium border around the ranged cells... I should have used "Range.BorderAround()".

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups