Column Header Borders

Posted by: sameek on 8 September 2017, 2:38 pm EST

  • Posted 8 September 2017, 2:38 pm EST

    <FONT size=2>

    </FONT><FONT size=2><FONT color=#000000 size=2>We are upgrading to the latest version of spread 5.0 from a much earlier version.  Before when we had a column header with two rows we were able to have the following code and there would be no border on the bottom of the first row.</FONT></FONT>


    After upgrading however we see there is a line between the first and second row.  I was wondering how do we get that line in between to dissapear?


    <FONT size=2><FONT size=2><FONT color=#000000><FONT size=2><FONT size=2>Dim</FONT></FONT><FONT size=2> topside </FONT><FONT size=2><FONT size=2>As</FONT></FONT><FONT size=2> </FONT><FONT size=2><FONT size=2>New</FONT></FONT></FONT><FONT size=2><FONT color=#000000> FarPoint.Win.ComplexBorderSide(Drawing.Color.Black, 0)</FONT>


    </FONT><FONT color=#000000><FONT size=2><FONT size=2>Dim</FONT></FONT><FONT size=2> leftside </FONT><FONT size=2><FONT size=2>As</FONT></FONT><FONT size=2> </FONT><FONT size=2><FONT size=2>New</FONT></FONT></FONT><FONT size=2><FONT color=#000000> FarPoint.Win.ComplexBorderSide(Drawing.Color.Black, 0)</FONT>


    </FONT><FONT color=#000000><FONT size=2><FONT size=2>Dim</FONT></FONT><FONT size=2> rightside </FONT><FONT size=2><FONT size=2>As</FONT></FONT><FONT size=2> </FONT><FONT size=2><FONT size=2>New</FONT></FONT></FONT><FONT size=2><FONT color=#000000> FarPoint.Win.ComplexBorderSide(Drawing.Color.Black, 0)</FONT>


    </FONT><FONT color=#000000><FONT size=2><FONT size=2>Dim</FONT></FONT><FONT size=2> bottomside </FONT><FONT size=2><FONT size=2>As</FONT></FONT><FONT size=2> </FONT><FONT size=2><FONT size=2>New</FONT></FONT></FONT><FONT size=2><FONT color=#000000> FarPoint.Win.ComplexBorderSide(Drawing.Color.LightGray, 1)</FONT>


    </FONT><FONT color=#000000><FONT size=2><FONT size=2>Dim</FONT></FONT><FONT size=2> border </FONT><FONT size=2><FONT size=2>As</FONT></FONT><FONT size=2> </FONT><FONT size=2><FONT size=2>New</FONT></FONT><FONT size=2> FarPoint.Win.ComplexBorder(leftside, topside, rightside, bottomside)

    </FONT></FONT><FONT size=2>

    <FONT color=#000000>spread.sheets(0).ColumnHeader.Cells(spread.sheets(0).ColumnHeader.RowCount - 2, OfferingCode).Value = </FONT></FONT><FONT size=2><FONT size=2><FONT color=#000000>"Offering"</FONT>

    </FONT></FONT><FONT size=2>

    <FONT color=#000000>spread.sheets(0).ColumnHeader.Cells(spread.sheets(0).ColumnHeader.RowCount - 1, OfferingCode).Value = </FONT></FONT><FONT size=2><FONT size=2><FONT color=#000000>"Code"</FONT>

    </FONT></FONT></FONT></FONT>

    <FONT size=2><FONT size=2><FONT color=#000000>spread.sheets(0).ColumnHeader.Cells(spread.sheets(0).ColumnHeader.RowCount - 2, OfferingCode).Border = border</FONT>

    </FONT></FONT>
  • Replied 8 September 2017, 2:38 pm EST

    Hello,

    If you want to remove the gridline between two
    rows in the column header, for doing so you need to create a new
    gridline with GridLineType to be null and set it to be the horizontal
    gridline of the column header. code for same is given below:-



    <blockquote>fpSpread1.ActiveSheet.ColumnHeader.DefaultStyle.Renderer = new FarPoint.Win.Spread.CellType.ColumnHeaderRenderer();
    fpSpread1.VisualStyles = FarPoint.Win.VisualStyles.Off;
    FarPoint.Win.Spread.GridLine cgdln = new FarPoint.Win.Spread.GridLine(FarPoint.Win.Spread.GridLineType.None);


    fpSpread1.Sheets[0].ColumnHeader.HorizontalGridLine = cgdln;
    </blockquote>
    But this would remove the line from the complete column header. In
    case you want to have the same behaviour in only one column and want to
    show the GridLine in remaining columns then firstly you have to set the
    gridline to none and then set the border for each cell in the other column
    header cells. The code for same is:



    <blockquote> fpSpread1.ActiveSheet.ColumnHeader.DefaultStyle.Renderer = new FarPoint.Win.Spread.CellType.ColumnHeaderRenderer();
     fpSpread1.VisualStyles = FarPoint.Win.VisualStyles.Off;
     FarPoint.Win.Spread.GridLine cgdln = new FarPoint.Win.Spread.GridLine(FarPoint.Win.Spread.GridLineType.None);


     fpSpread1.Sheets[0].ColumnHeader.HorizontalGridLine = cgdln;
     fpSpread1.Sheets[0].ColumnHeader.Cells[fpSpread1.Sheets[0].ColumnHeader.RowCount - 2, 1].Value = "Offering";
     fpSpread1.Sheets[0].ColumnHeader.Cells[fpSpread1.Sheets[0].ColumnHeader.RowCount - 1, 1].Value = "Code";


     FarPoint.Win.ComplexBorderSide topside = new FarPoint.Win.ComplexBorderSide(System.Drawing.Color.Black,0);
     FarPoint.Win.ComplexBorderSide leftside = new FarPoint.Win.ComplexBorderSide(System.Drawing.Color.Black, 0);


     FarPoint.Win.ComplexBorderSide rightside = new FarPoint.Win.ComplexBorderSide(System.Drawing.Color.Black, 0);
     FarPoint.Win.ComplexBorderSide bottomside = new FarPoint.Win.ComplexBorderSide(System.Drawing.Color.Red, 1);


     FarPoint.Win.ComplexBorder border = new FarPoint.Win.ComplexBorder(leftside, topside, rightside, bottomside);
     fpSpread1.ActiveSheet.ColumnHeader.RowCount = 2;
    fpSpread1.ActiveSheet.ColumnCount = 5; // "For setting the border"


     for (int j = 0; j < fpSpread1.ActiveSheet.ColumnCount; j++)
       {
           if (j != 1)
                {
                   fpSpread1.ActiveSheet.ColumnHeader.Cells[0, j].Border = border;
                 }
        }
    </blockquote>


    Hope it will help you. Thanks.
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels