Spread Silverlight Documentation
SetBorder(CellRange,BorderLine,SetBorderOptions) Method
Example 


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

Parameters

cellRange
The cell area.
borderLine
The border line.
option
Determines which part of the cell range to set.
Example
This example uses the SetBorder method.
gcSpreadSheet1.Sheets[0].Cells[1, 1].BorderTop = new GrapeCity.Windows.SpreadSheet.Data.BorderLine(Color.FromArgb(255, 100, 50, 100));
gcSpreadSheet1.Sheets[0].Cells[1, 1].BorderLeft = new GrapeCity.Windows.SpreadSheet.Data.BorderLine();
gcSpreadSheet1.Sheets[0].Cells[1, 1].BorderRight = new GrapeCity.Windows.SpreadSheet.Data.BorderLine(Color.FromArgb(255, 255, 122, 5), GrapeCity.Windows.SpreadSheet.Data.BorderLineStyle.DashDot);
gcSpreadSheet1.Sheets[0].Cells[1, 1].BorderBottom = new GrapeCity.Windows.SpreadSheet.Data.BorderLine(Color.FromArgb(255, 255, 50, 200));
GrapeCity.Windows.SpreadSheet.Data.CellRange r;
r = new GrapeCity.Windows.SpreadSheet.Data.CellRange(2, 2, 2, 2);            
//gcSpreadSheet1.Sheets[0].SetBorder(r, new GrapeCity.Windows.SpreadSheet.Data.BorderLine(Color.FromArgb(255, 25,25,200)), GrapeCity.Windows.SpreadSheet.Data.SetBorderOptions.All);
gcSpreadSheet1.Sheets[0].SetBorder(r, GrapeCity.Windows.SpreadSheet.Data.SheetArea.Cells, new GrapeCity.Windows.SpreadSheet.Data.BorderLine(Color.FromArgb(255, 25, 25, 200)), GrapeCity.Windows.SpreadSheet.Data.SetBorderOptions.All);
gcSpreadSheet1.Sheets[0].Columns[5].BorderTop = new GrapeCity.Windows.SpreadSheet.Data.BorderLine(Color.FromArgb(255, 100, 50, 100));
gcSpreadSheet1.Sheets[0].Columns[5].BorderLeft = new GrapeCity.Windows.SpreadSheet.Data.BorderLine(Color.FromArgb(255, 255, 122, 5));
gcSpreadSheet1.Sheets[0].Columns[5].BorderRight = new GrapeCity.Windows.SpreadSheet.Data.BorderLine(Color.FromArgb(255, 255, 122, 5), GrapeCity.Windows.SpreadSheet.Data.BorderLineStyle.DashDot);
gcSpreadSheet1.Sheets[0].Columns[5].BorderBottom = new GrapeCity.Windows.SpreadSheet.Data.BorderLine(Color.FromArgb(255, 255, 50, 200));
gcSpreadSheet1.Sheets[0].SetBorder(r, GrapeCity.Windows.SpreadSheet.Data.SheetArea.Cells, new GrapeCity.Windows.SpreadSheet.Data.BorderLine(Color.FromArgb(255,25, 25, 200)), GrapeCity.Windows.SpreadSheet.Data.SetBorderOptions.All);
gcSpreadSheet1.Sheets[0].Rows[5].BorderTop = new GrapeCity.Windows.SpreadSheet.Data.BorderLine(Color.FromArgb(255, 100, 50, 100));
gcSpreadSheet1.Sheets[0].Rows[5].BorderLeft = new GrapeCity.Windows.SpreadSheet.Data.BorderLine(Color.FromArgb(255, 255, 122, 5));
gcSpreadSheet1.Sheets[0].Rows[5].BorderRight = new GrapeCity.Windows.SpreadSheet.Data.BorderLine(Color.FromArgb(255, 255, 122, 5), GrapeCity.Windows.SpreadSheet.Data.BorderLineStyle.DashDot);
gcSpreadSheet1.Sheets[0].Rows[5].BorderBottom = new GrapeCity.Windows.SpreadSheet.Data.BorderLine(Color.FromArgb(255, 255, 50, 200));
gcSpreadSheet1.Invalidate();

private void button1_Click(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();
            gcSpreadSheet1.Invalidate();
        }
GcSpreadSheet1.Sheets(0).Cells(1, 1).BorderTop = New GrapeCity.Windows.SpreadSheet.Data.BorderLine(Color.FromArgb(255, 100, 50, 100))
GcSpreadSheet1.Sheets(0).Cells(1, 1).BorderLeft = New GrapeCity.Windows.SpreadSheet.Data.BorderLine()
GcSpreadSheet1.Sheets(0).Cells(1, 1).BorderRight = New GrapeCity.Windows.SpreadSheet.Data.BorderLine(Color.FromArgb(255, 255, 122, 5), GrapeCity.Windows.SpreadSheet.Data.BorderLineStyle.DashDot)
GcSpreadSheet1.Sheets(0).Cells(1, 1).BorderBottom = New GrapeCity.Windows.SpreadSheet.Data.BorderLine(Color.FromArgb(255, 255, 50, 200))
Dim r As New GrapeCity.Windows.SpreadSheet.Data.CellRange(2, 2, 2, 2)
 'GcSpreadSheet1.Sheets(0).SetBorder(r, new GrapeCity.Windows.SpreadSheet.Data.BorderLine(Color.FromArgb(255, 25,25,200)), GrapeCity.Windows.SpreadSheet.Data.SetBorderOptions.All)
GcSpreadSheet1.Sheets(0).SetBorder(r, GrapeCity.Windows.SpreadSheet.Data.SheetArea.Cells, New GrapeCity.Windows.SpreadSheet.Data.BorderLine(Color.FromArgb(255,25, 25, 200)), GrapeCity.Windows.SpreadSheet.Data.SetBorderOptions.All)
GcSpreadSheet1.Sheets(0).Columns(5).BorderTop = New GrapeCity.Windows.SpreadSheet.Data.BorderLine(Color.FromArgb(255, 100, 50, 100))
GcSpreadSheet1.Sheets(0).Columns(5).BorderLeft = New GrapeCity.Windows.SpreadSheet.Data.BorderLine(Color.FromArgb(255, 255, 122, 5))
GcSpreadSheet1.Sheets(0).Columns(5).BorderRight = New GrapeCity.Windows.SpreadSheet.Data.BorderLine(Color.FromArgb(255, 255, 122, 5), GrapeCity.Windows.SpreadSheet.Data.BorderLineStyle.DashDot)
GcSpreadSheet1.Sheets(0).Columns(5).BorderBottom = New GrapeCity.Windows.SpreadSheet.Data.BorderLine(Color.FromArgb(255, 255, 50, 200))
GcSpreadSheet1.Sheets(0).SetBorder(r, GrapeCity.Windows.SpreadSheet.Data.SheetArea.Cells, New GrapeCity.Windows.SpreadSheet.Data.BorderLine(Color.FromArgb(255,25, 25, 200)), GrapeCity.Windows.SpreadSheet.Data.SetBorderOptions.All)
GcSpreadSheet1.Sheets(0).Rows(5).BorderTop = New GrapeCity.Windows.SpreadSheet.Data.BorderLine(Color.FromArgb(255, 100, 50, 100))
GcSpreadSheet1.Sheets(0).Rows(5).BorderLeft = New GrapeCity.Windows.SpreadSheet.Data.BorderLine(Color.FromArgb(255, 255, 122, 5))
GcSpreadSheet1.Sheets(0).Rows(5).BorderRight = New GrapeCity.Windows.SpreadSheet.Data.BorderLine(Color.FromArgb(255, 255, 122, 5), GrapeCity.Windows.SpreadSheet.Data.BorderLineStyle.DashDot)
GcSpreadSheet1.Sheets(0).Rows(5).BorderBottom = New GrapeCity.Windows.SpreadSheet.Data.BorderLine(Color.FromArgb(255, 255, 50, 200))
GcSpreadSheet1.Invalidate()

Private Sub Button1_Click(sender As System.Object, e As System.Windows.RoutedEventArgs) Handles Button1.Click
       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()
            GcSpreadSheet1.Invalidate()
    End Sub
Requirements

Target Platforms: Windows 7, Windows 8 Desktop, Windows Vista SP1 or later, Windows Server 2000, Windows 2000 Professional, Windows XP Professional, Windows NT 4.0 Workstation, SP6, Windows NT 4.0 Server, SP6

See Also

Reference

Worksheet Class
Worksheet Members
Overload List

 

 


Copyright © GrapeCity, inc. All rights reserved.