GrapeCity.Xaml.SpreadSheet.Data
SetBorder(CellRange,SheetArea,BorderLine,SetBorderOptions) Method
Example 


The cell area.
The sheet area.
The border line.
Determines which part of the cell range to set.
Sets the border for the specified area in the specified sheet area.
Syntax
'Declaration
 
Public Overloads Sub SetBorder( _
   ByVal cellRange As CellRange, _
   ByVal sheetArea As SheetArea, _
   ByVal borderLine As BorderLine, _
   ByVal option As SetBorderOptions _
) 
'Usage
 
Dim instance As Worksheet
Dim cellRange As CellRange
Dim sheetArea As SheetArea
Dim borderLine As BorderLine
Dim option As SetBorderOptions
 
instance.SetBorder(cellRange, sheetArea, borderLine, option)
public void SetBorder( 
   CellRange cellRange,
   SheetArea sheetArea,
   BorderLine borderLine,
   SetBorderOptions option
)

Parameters

cellRange
The cell area.
sheetArea
The sheet area.
borderLine
The border line.
option
Determines which part of the cell range to set.
Example
This example uses the SetBorder method.
private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            gcSpreadSheet1.Sheets[0].Cells[1, 1].BorderTop = new GrapeCity.Xaml.SpreadSheet.Data.BorderLine(Windows.UI.Colors.Aquamarine);
            gcSpreadSheet1.Sheets[0].Cells[1, 1].BorderLeft = new GrapeCity.Xaml.SpreadSheet.Data.BorderLine();
            gcSpreadSheet1.Sheets[0].Cells[1, 1].BorderRight = new GrapeCity.Xaml.SpreadSheet.Data.BorderLine(Windows.UI.Colors.BlueViolet, GrapeCity.Xaml.SpreadSheet.Data.BorderLineStyle.DashDot);
            gcSpreadSheet1.Sheets[0].Cells[1, 1].BorderBottom = new GrapeCity.Xaml.SpreadSheet.Data.BorderLine(Windows.UI.Colors.Chartreuse);
            GrapeCity.Xaml.SpreadSheet.Data.CellRange r;
            r = new GrapeCity.Xaml.SpreadSheet.Data.CellRange(2, 2, 2, 2);
            //gcSpreadSheet1.Sheets[0].SetBorder(r, new GrapeCity.Xaml.SpreadSheet.Data.BorderLine(Windows.UI.Colors.Green, GrapeCity.Xaml.SpreadSheet.Data.SetBorderOptions.All);
            gcSpreadSheet1.Sheets[0].SetBorder(r, GrapeCity.Xaml.SpreadSheet.Data.SheetArea.Cells, new GrapeCity.Xaml.SpreadSheet.Data.BorderLine(Windows.UI.Colors.Cornsilk), GrapeCity.Xaml.SpreadSheet.Data.SetBorderOptions.All);
            gcSpreadSheet1.Sheets[0].Columns[5].BorderTop = new GrapeCity.Xaml.SpreadSheet.Data.BorderLine(Windows.UI.Colors.Crimson);
            gcSpreadSheet1.Sheets[0].Columns[5].BorderLeft = new GrapeCity.Xaml.SpreadSheet.Data.BorderLine(Windows.UI.Colors.DarkBlue);
            gcSpreadSheet1.Sheets[0].Columns[5].BorderRight = new GrapeCity.Xaml.SpreadSheet.Data.BorderLine(Windows.UI.Colors.DarkGray, GrapeCity.Xaml.SpreadSheet.Data.BorderLineStyle.DashDot);
            gcSpreadSheet1.Sheets[0].Columns[5].BorderBottom = new GrapeCity.Xaml.SpreadSheet.Data.BorderLine(Windows.UI.Colors.DarkOliveGreen);
            gcSpreadSheet1.Sheets[0].SetBorder(r, GrapeCity.Xaml.SpreadSheet.Data.SheetArea.Cells, new GrapeCity.Xaml.SpreadSheet.Data.BorderLine(Windows.UI.Colors.DarkOrchid), GrapeCity.Xaml.SpreadSheet.Data.SetBorderOptions.All);
            gcSpreadSheet1.Sheets[0].Rows[5].BorderTop = new GrapeCity.Xaml.SpreadSheet.Data.BorderLine(Windows.UI.Colors.DarkSlateBlue);
            gcSpreadSheet1.Sheets[0].Rows[5].BorderLeft = new GrapeCity.Xaml.SpreadSheet.Data.BorderLine(Windows.UI.Colors.Firebrick);
            gcSpreadSheet1.Sheets[0].Rows[5].BorderRight = new GrapeCity.Xaml.SpreadSheet.Data.BorderLine(Windows.UI.Colors.ForestGreen, GrapeCity.Xaml.SpreadSheet.Data.BorderLineStyle.DashDot);
            gcSpreadSheet1.Sheets[0].Rows[5].BorderBottom = new GrapeCity.Xaml.SpreadSheet.Data.BorderLine(Windows.UI.Colors.Gold);                      
        }

        private void Button_Click_2(object sender, RoutedEventArgs e)
        {
            listBox1.Items.Add(gcSpreadSheet1.Sheets[0].Cells[1, 1].ActualBorderBottom.ToString());
            gcSpreadSheet1.Sheets[0].Cells[1, 1].ResetBorderBottom();
            gcSpreadSheet1.Sheets[0].Cells[1, 1].ResetBorderLeft();
            gcSpreadSheet1.Sheets[0].Cells[1, 1].ResetBorderRight();
            gcSpreadSheet1.Sheets[0].Cells[1, 1].ResetBorderTop();     
        }
Private Sub Button_Click_1(sender As Object, e As RoutedEventArgs)
        gcSpreadSheet1.Sheets(0).Cells(1, 1).BorderTop = New GrapeCity.Xaml.SpreadSheet.Data.BorderLine(Windows.UI.Colors.Aquamarine)
        gcSpreadSheet1.Sheets(0).Cells(1, 1).BorderLeft = New GrapeCity.Xaml.SpreadSheet.Data.BorderLine()
        gcSpreadSheet1.Sheets(0).Cells(1, 1).BorderRight = New GrapeCity.Xaml.SpreadSheet.Data.BorderLine(Windows.UI.Colors.BlueViolet, GrapeCity.Xaml.SpreadSheet.Data.BorderLineStyle.DashDot)
        gcSpreadSheet1.Sheets(0).Cells(1, 1).BorderBottom = New GrapeCity.Xaml.SpreadSheet.Data.BorderLine(Windows.UI.Colors.Chartreuse)
        Dim r As New GrapeCity.Xaml.SpreadSheet.Data.CellRange(2, 2, 2, 2)
        'gcSpreadSheet1.Sheets(0).SetBorder(r, New GrapeCity.Xaml.SpreadSheet.Data.BorderLine(Windows.UI.Colors.Green), GrapeCity.Xaml.SpreadSheet.Data.SetBorderOptions.All)
        gcSpreadSheet1.Sheets(0).SetBorder(r, GrapeCity.Xaml.SpreadSheet.Data.SheetArea.Cells, New GrapeCity.Xaml.SpreadSheet.Data.BorderLine(Windows.UI.Colors.Cornsilk), GrapeCity.Xaml.SpreadSheet.Data.SetBorderOptions.All)
        gcSpreadSheet1.Sheets(0).Columns(5).BorderTop = New GrapeCity.Xaml.SpreadSheet.Data.BorderLine(Windows.UI.Colors.Crimson)
        gcSpreadSheet1.Sheets(0).Columns(5).BorderLeft = New GrapeCity.Xaml.SpreadSheet.Data.BorderLine(Windows.UI.Colors.DarkBlue)
        gcSpreadSheet1.Sheets(0).Columns(5).BorderRight = New GrapeCity.Xaml.SpreadSheet.Data.BorderLine(Windows.UI.Colors.DarkGray, GrapeCity.Xaml.SpreadSheet.Data.BorderLineStyle.DashDot)
        gcSpreadSheet1.Sheets(0).Columns(5).BorderBottom = New GrapeCity.Xaml.SpreadSheet.Data.BorderLine(Windows.UI.Colors.DarkOliveGreen)
        gcSpreadSheet1.Sheets(0).SetBorder(r, GrapeCity.Xaml.SpreadSheet.Data.SheetArea.Cells, New GrapeCity.Xaml.SpreadSheet.Data.BorderLine(Windows.UI.Colors.DarkOrchid), GrapeCity.Xaml.SpreadSheet.Data.SetBorderOptions.All)
        gcSpreadSheet1.Sheets(0).Rows(5).BorderTop = New GrapeCity.Xaml.SpreadSheet.Data.BorderLine(Windows.UI.Colors.DarkSlateBlue)
        gcSpreadSheet1.Sheets(0).Rows(5).BorderLeft = New GrapeCity.Xaml.SpreadSheet.Data.BorderLine(Windows.UI.Colors.Firebrick)
        gcSpreadSheet1.Sheets(0).Rows(5).BorderRight = New GrapeCity.Xaml.SpreadSheet.Data.BorderLine(Windows.UI.Colors.ForestGreen, GrapeCity.Xaml.SpreadSheet.Data.BorderLineStyle.DashDot)
        gcSpreadSheet1.Sheets(0).Rows(5).BorderBottom = New GrapeCity.Xaml.SpreadSheet.Data.BorderLine(Windows.UI.Colors.Gold)
    End Sub
    
    Private Sub Button_Click_2(sender As Object, e As RoutedEventArgs)
        ListBox1.Items.Add(gcSpreadSheet1.Sheets(0).Cells(1, 1).ActualBorderBottom.ToString())
        gcSpreadSheet1.Sheets(0).Cells(1, 1).ResetBorderBottom()
        gcSpreadSheet1.Sheets(0).Cells(1, 1).ResetBorderLeft()
        gcSpreadSheet1.Sheets(0).Cells(1, 1).ResetBorderRight()
        gcSpreadSheet1.Sheets(0).Cells(1, 1).ResetBorderTop()
    End Sub
Requirements

Target Platforms: Windows Server 2012, Windows RT

See Also

Reference

Worksheet Class
Worksheet Members
Overload List

 

 


Copyright © GrapeCity, inc. All rights reserved.

Support Options