SingleBorderType Enumeration |
Represents single border type.
Namespace: SautinSoft.DocumentAssembly: SautinSoft.Document (in SautinSoft.Document.dll) Version: 2024.11.20
Syntax public enum SingleBorderType
Public Enumeration SingleBorderType
Members Member name | Value | Description |
---|
Left | 0 |
Left border.
|
Top | 1 |
Top border.
|
Right | 2 |
Right border.
|
Bottom | 3 |
Bottom border.
|
InsideHorizontal | 4 |
Inside horizontal border.
|
InsideVertical | 5 |
Inside vertical border.
|
DiagonalDown | 6 |
Diagonal down border (from top-left to bottom-right).
|
DiagonalUp | 7 |
Diagonal up border (from bottom-left to top-right).
|
Example See Developer Guide: Detect cell borders with the same color
Detect cell borders with the same color using C#
using System;
using SautinSoft.Document;
using SautinSoft.Document.Tables;
namespace Example
{
class Program
{
static void Main(string[] args)
{
DetectBorders();
}
private static void DetectBorders()
{
DocumentCore dc = DocumentCore.Load(@"..\..\..\example.docx");
foreach (TableCell itemTC in dc.GetChildElements(true, ElementType.TableCell))
{
SingleBorder sbLeft = itemTC.CellFormat.Borders[SingleBorderType.Left];
SingleBorder sbTop = itemTC.CellFormat.Borders[SingleBorderType.Top];
SingleBorder sbRight = itemTC.CellFormat.Borders[SingleBorderType.Right];
SingleBorder sbBottom = itemTC.CellFormat.Borders[SingleBorderType.Bottom];
if (sbLeft.Color == sbTop.Color && sbTop.Color == sbRight.Color && sbRight.Color == sbBottom.Color)
{
itemTC.Content.Start.Insert("This cell has the same border color.\r\n");
}
}
string filePath = "ResultDetectBorder.docx";
dc.Save(filePath);
System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(filePath) { UseShellExecute = true });
}
}
}
Detect cell borders with the same color using VB.Net
Imports Microsoft.VisualBasic
Imports System
Imports SautinSoft.Document
Imports SautinSoft.Document.Tables
Namespace Example
Friend Class Program
Shared Sub Main(ByVal args() As String)
DetectBorders()
End Sub
Private Shared Sub DetectBorders()
Dim dc As DocumentCore = DocumentCore.Load("..\..\..\example.docx")
For Each itemTC As TableCell In dc.GetChildElements(True, ElementType.TableCell)
Dim sbLeft As SingleBorder = itemTC.CellFormat.Borders(SingleBorderType.Left)
Dim sbTop As SingleBorder = itemTC.CellFormat.Borders(SingleBorderType.Top)
Dim sbRight As SingleBorder = itemTC.CellFormat.Borders(SingleBorderType.Right)
Dim sbBottom As SingleBorder = itemTC.CellFormat.Borders(SingleBorderType.Bottom)
If sbLeft.Color = sbTop.Color AndAlso sbTop.Color = sbRight.Color AndAlso sbRight.Color = sbBottom.Color Then
itemTC.Content.Start.Insert("This cell has the same border color." & vbCrLf)
End If
Next itemTC
Dim filePath As String = "ResultDetectBorder.docx"
dc.Save(filePath)
System.Diagnostics.Process.Start(New System.Diagnostics.ProcessStartInfo(filePath) With {.UseShellExecute = True})
End Sub
End Class
End Namespace
See Also