Click or drag to resize
BorderStyle Enumeration
Specifies line style for a border.

Namespace:  GemBox.Document
Assembly:  GemBox.Document (in GemBox.Document.dll) Version: 25.3.30.1255
Syntax
public enum BorderStyle
Members
  Member nameValueDescription
None0 No border.
Single1 Single line border.
Double2 Double line border.
Triple3 Triple line border.
Dotted4 Dotted line border.
Dashed5 Dashed line border.
DotDash6 Dot - dash line border.
DotDotDash7 Dot - dot - dash line border.
Wave8 Wave line border.
DoubleWave9 Double wave line border.
Outset10 Outset set of line borders.
Remarks

BorderStyle is specified when creating a new SingleBorder and assigning it to a CharacterFormat.Border property, or when setting a multiple borders through SetBorders(MultipleBorderTypes, BorderStyle, Color, Double) on ParagraphFormat.Borders, TableFormat.Borders or TableCellFormat.Borders properties.

Values DoubleWave, Triple, Wave and Outset are currently not supported in PDF, XPS and image file formats.

Examples

Following example shows how to create a document that demonstrates all available border styles.

// Get all border styles.
var borderStyles = (BorderStyle[])Enum.GetValues(typeof(BorderStyle));

// Create a new empty document.
var doc = new DocumentModel();

// Insert a table with 1 column and 'borderStyles.Length' rows.
doc.Sections.Add(
    new Section(doc, 
        new Table(doc, borderStyles.Length, 1, (row, column) =>
        {
            // Create a new table cell with text taken from 'borderStyles' array at index 'row'.
            var cell = new TableCell(doc, new Paragraph(doc, borderStyles[row].ToString()));

            // Set cell outside borders to red color, with width of 2 points and with border style taken from 'borderStyles' array at index 'row'.
            cell.CellFormat.Borders.SetBorders(MultipleBorderTypes.Outside, borderStyles[row], Color.Red, 2d);

            return cell;
        })));

// Document will be saved to the Desktop.
var path = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "Borders.docx");

// Save the document.
doc.Save(path);

// Open the document in Microsoft Word.
System.Diagnostics.Process.Start(path);
See Also