Independentsoft
- any library, any programming language
Home
Purchase
Support
Company
Contact
Spreadsheet .NET
>
Tutorial
> Set Cell Border
The following example shows you how to set cell border.
C# example
using System; using Independentsoft.Office; using Independentsoft.Office.Spreadsheet; using Independentsoft.Office.Spreadsheet.Styles; namespace Sample { class Program { static void Main(string[] args) { Border border = new Border(); border.Style = BorderStyle.Thin; CellFormat format1 = new CellFormat(); format1.Border = new CellBorder(); format1.Border.Top = border; format1.Border.Bottom = border; format1.Border.Left = border; format1.Border.Right = border; Cell a1 = new Cell(999.99); a1.Format = format1; Worksheet sheet1 = new Worksheet(); sheet1["A1"] = a1; Workbook book = new Workbook(); book.Sheets.Add(sheet1); book.Save("c:\\test\\output.xlsx", true); } } }
VB example
Imports System Imports Independentsoft.Office Imports Independentsoft.Office.Spreadsheet Imports Independentsoft.Office.Spreadsheet.Styles Module Module1 Sub Main(ByVal args As String()) Dim border As New Border() border.Style = BorderStyle.Thin Dim format1 As New CellFormat() format1.Border = New CellBorder() format1.Border.Top = border format1.Border.Bottom = border format1.Border.Left = border format1.Border.Right = border Dim a1 As New Cell(999.99) a1.Format = format1 Dim sheet1 As New Worksheet() sheet1("A1") = a1 Dim book As New Workbook() book.Sheets.Add(sheet1) book.Save("c:\test\output.xlsx", True) End Sub End Module
Need help? Ask our developers:
Name*
Email*
Message*