Enum BorderType
BorderType enumeration
Enumerates the border line and diagonal line types.
[Flags]
public enum BorderType
Values
Name | Value | Description |
---|---|---|
BottomBorder | 8 | Represents bottom border line. |
DiagonalDown | 10 | Represents the diagonal line from top left to right bottom. |
DiagonalUp | 20 | Represents the diagonal line from bottom left to right top. |
LeftBorder | 1 | Represents left border line. |
RightBorder | 2 | Represents right border line exists. |
TopBorder | 4 | Represents top border line. |
Horizontal | 80 | Only for dynamic style,such as conditional formatting. |
Vertical | 40 | Only for dynamic style,such as conditional formatting. |
Examples
[C#]
namespace Demos
{
using Aspose.Cells;
using System;
using System.Drawing;
public class BorderTypeDemo
{
public static void BorderTypeExample()
{
// Create a new workbook
Workbook workbook = new Workbook();
// Access the first worksheet
Worksheet worksheet = workbook.Worksheets[0];
// Create a range of cells
var range = worksheet.Cells.CreateRange("A1:D4");
// Create a style object
Style style = workbook.CreateStyle();
// Set the borders for the range
style.SetBorder(BorderType.LeftBorder, CellBorderType.Thin, Color.Black);
style.SetBorder(BorderType.RightBorder, CellBorderType.Thin, Color.Black);
style.SetBorder(BorderType.TopBorder, CellBorderType.Thin, Color.Black);
style.SetBorder(BorderType.BottomBorder, CellBorderType.Thin, Color.Black);
style.SetBorder(BorderType.DiagonalDown, CellBorderType.Thin, Color.Red);
style.SetBorder(BorderType.DiagonalUp, CellBorderType.Thin, Color.Blue);
// Apply the style to the range
StyleFlag flag = new StyleFlag { Borders = true };
range.ApplyStyle(style, flag);
// Save the workbook
workbook.Save("BorderTypeExample.xlsx");
workbook.Save("BorderTypeExample.pdf");
}
}
}
See Also
- namespace Aspose.Cells
- assembly Aspose.Cells