BorderCollection.SetStyle
BorderCollection.SetStyle method
Sets the style of all borders of the collection.
public void SetStyle(CellBorderType style)
Parameter | Type | Description |
---|---|---|
style | CellBorderType | Borders’ style |
Examples
using System;
using Aspose.Cells;
namespace AsposeCellsExamples
{
public class BorderCollectionMethodSetStyleWithCellBorderTypeDemo
{
public static void Run()
{
// Create a new workbook
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
// Get cell C6 and its style
Cell cell = worksheet.Cells["C6"];
Style style = cell.GetStyle();
// Set border color and style
style.Borders.SetColor(System.Drawing.Color.Red);
style.Borders.SetStyle(CellBorderType.Thick);
// Apply the style to the cell
cell.SetStyle(style);
// Save the workbook
workbook.Save("BorderCollectionMethodSetStyleWithCellBorderTypeDemo_out.xlsx");
Console.WriteLine("Border style set successfully.");
}
}
}
See Also
- enum CellBorderType
- class BorderCollection
- namespace Aspose.Cells
- assembly Aspose.Cells