Class TableStyle
Represents a style that can be applied to a TableAdv.
Inherited Members
Namespace: Syncfusion.Windows.Controls.RichTextBoxAdv
Assembly: Syncfusion.SfRichTextBoxAdv.WPF.dll
Syntax
public class TableStyle : DocumentStyle
Constructors
TableStyle()
Initializes a new instance of the TableStyle class.
Declaration
public TableStyle()
Examples
The following code example demonstrates, how to create a table style.
TableStyle tableStyle = new TableStyle(richtextbox.Document);
tableStyle.Name = "MyStyle";
//Create heading row conditional style
TableConditionalFormattingStyle tableConditionalFormattingStyle = new TableConditionalFormattingStyle(richtextbox.Document);
//Create table conditional formatting style for first row
tableConditionalFormattingStyle.TableConditionalFormattingType = TableConditionalFormattingType.FirstRow;
//Set cell format property
tableConditionalFormattingStyle.CellFormat.Shading.BackgroundColor = Colors.LightBlue;
//Set character format property
tableConditionalFormattingStyle.CharacterFormat.Bold = true;
tableConditionalFormattingStyle.CharacterFormat.Underline = Syncfusion.Windows.Controls.RichTextBoxAdv.Underline.Dash;
//Set paragraph format property
tableConditionalFormattingStyle.ParagraphFormat.TextAlignment = TextAlignment.Right;
//Add the first row conditional style in table conditional formatting style collection
tableStyle.TableConditionalFormattingStyles.Add(tableConditionalFormattingStyle);
//Add the table style in document styles collection
richtextbox.Document.Styles.Add(tableStyle);
Private Sub SurroundingSub()
Dim tableStyle As TableStyle = New TableStyle(richtextbox.Document)
tableStyle.Name = "MyStyle"
Dim tableConditionalFormattingStyle As TableConditionalFormattingStyle = New TableConditionalFormattingStyle(richtextbox.Document)
tableConditionalFormattingStyle.TableConditionalFormattingType = TableConditionalFormattingType.FirstRow
tableConditionalFormattingStyle.CellFormat.Shading.BackgroundColor = Colors.LightBlue
tableConditionalFormattingStyle.CharacterFormat.Bold = True
tableConditionalFormattingStyle.CharacterFormat.Underline = Syncfusion.Windows.Controls.RichTextBoxAdv.Underline.Dash
tableConditionalFormattingStyle.ParagraphFormat.TextAlignment = TextAlignment.Right
tableStyle.TableConditionalFormattingStyles.Add(tableConditionalFormattingStyle)
richtextbox.Document.Styles.Add(tableStyle)
End Sub
TableStyle(DocumentAdv)
Initializes a new instance of the TableStyle class for the specified DocumentAdv.
Declaration
public TableStyle(DocumentAdv documentAdv)
Parameters
Type | Name | Description |
---|---|---|
DocumentAdv | documentAdv | The DocumentAdv to which the TableStyle is associated. |
Examples
The following code example demonstrates, how to create a table style with the document it is associated with.
TableStyle tableStyle = new TableStyle(richtextbox.Document);
tableStyle.Name = "MyStyle";
//Create heading row conditional style
TableConditionalFormattingStyle tableConditionalFormattingStyle = new TableConditionalFormattingStyle(richtextbox.Document);
//Create table conditional formatting style for first row
tableConditionalFormattingStyle.TableConditionalFormattingType = TableConditionalFormattingType.FirstRow;
//Set cell format property
tableConditionalFormattingStyle.CellFormat.Shading.BackgroundColor = Colors.LightBlue;
//Set character format property
tableConditionalFormattingStyle.CharacterFormat.Bold = true;
tableConditionalFormattingStyle.CharacterFormat.Underline = Syncfusion.Windows.Controls.RichTextBoxAdv.Underline.Dash;
//Set paragraph format property
tableConditionalFormattingStyle.ParagraphFormat.TextAlignment = TextAlignment.Right;
//Add the first row conditional style in table conditional formatting style collection
tableStyle.TableConditionalFormattingStyles.Add(tableConditionalFormattingStyle);
//Add the table style in document styles collection
richtextbox.Document.Styles.Add(tableStyle);
Private Sub SurroundingSub()
Dim tableStyle As TableStyle = New TableStyle(richtextbox.Document)
tableStyle.Name = "MyStyle"
Dim tableConditionalFormattingStyle As TableConditionalFormattingStyle = New TableConditionalFormattingStyle(richtextbox.Document)
tableConditionalFormattingStyle.TableConditionalFormattingType = TableConditionalFormattingType.FirstRow
tableConditionalFormattingStyle.CellFormat.Shading.BackgroundColor = Colors.LightBlue
tableConditionalFormattingStyle.CharacterFormat.Bold = True
tableConditionalFormattingStyle.CharacterFormat.Underline = Syncfusion.Windows.Controls.RichTextBoxAdv.Underline.Dash
tableConditionalFormattingStyle.ParagraphFormat.TextAlignment = TextAlignment.Right
tableStyle.TableConditionalFormattingStyles.Add(tableConditionalFormattingStyle)
richtextbox.Document.Styles.Add(tableStyle)
End Sub
Properties
CellFormat
Gets or sets the table cell format.
Declaration
public CellFormat CellFormat { get; set; }
Property Value
Type | Description |
---|---|
CellFormat | The CellFormat object that represents the cell properties of the specified table style. |
Examples
The following code example demonstrates, how to create a table style with cell format.
TableStyle tableStyle = new TableStyle(richtextbox.Document);
tableStyle.Name = "MyStyle";
//Create heading row conditional style
TableConditionalFormattingStyle tableConditionalFormattingStyle = new TableConditionalFormattingStyle(richtextbox.Document);
//Create table conditional formatting style for first row
tableConditionalFormattingStyle.TableConditionalFormattingType = TableConditionalFormattingType.FirstRow;
//Set cell format property
tableConditionalFormattingStyle.CellFormat.Shading.BackgroundColor = Colors.LightBlue;
//Set character format property
tableConditionalFormattingStyle.CharacterFormat.Bold = true;
tableConditionalFormattingStyle.CharacterFormat.Underline = Syncfusion.Windows.Controls.RichTextBoxAdv.Underline.Dash;
//Set paragraph format property
tableConditionalFormattingStyle.ParagraphFormat.TextAlignment = TextAlignment.Right;
//Add the first row conditional style in table conditional formatting style collection
tableStyle.TableConditionalFormattingStyles.Add(tableConditionalFormattingStyle);
//Add the table style in document styles collection
richtextbox.Document.Styles.Add(tableStyle);
Private Sub SurroundingSub()
Dim tableStyle As TableStyle = New TableStyle(richtextbox.Document)
tableStyle.Name = "MyStyle"
Dim tableConditionalFormattingStyle As TableConditionalFormattingStyle = New TableConditionalFormattingStyle(richtextbox.Document)
tableConditionalFormattingStyle.TableConditionalFormattingType = TableConditionalFormattingType.FirstRow
tableConditionalFormattingStyle.CellFormat.Shading.BackgroundColor = Colors.LightBlue
tableConditionalFormattingStyle.CharacterFormat.Bold = True
tableConditionalFormattingStyle.CharacterFormat.Underline = Syncfusion.Windows.Controls.RichTextBoxAdv.Underline.Dash
tableConditionalFormattingStyle.ParagraphFormat.TextAlignment = TextAlignment.Right
tableStyle.TableConditionalFormattingStyles.Add(tableConditionalFormattingStyle)
richtextbox.Document.Styles.Add(tableStyle)
End Sub
CharacterFormat
Gets or sets the character format.
Declaration
public CharacterFormat CharacterFormat { get; set; }
Property Value
Type | Description |
---|---|
CharacterFormat | The CharacterFormat object that represents the character format of the specified table style. |
Examples
The following code example demonstrates, how to create a table style with character format
TableStyle tableStyle = new TableStyle(richtextbox.Document);
tableStyle.Name = "MyStyle";
// Create heading row conditional style
TableConditionalFormattingStyle tableConditionalFormattingStyle = new TableConditionalFormattingStyle(richtextbox.Document);
//Create table conditional formatting style for first row
tableConditionalFormattingStyle.TableConditionalFormattingType = TableConditionalFormattingType.FirstRow;
//Set cell format property
tableConditionalFormattingStyle.CellFormat.Shading.BackgroundColor = Colors.LightBlue;
//Set character format property
tableConditionalFormattingStyle.CharacterFormat.Bold = true;
tableConditionalFormattingStyle.CharacterFormat.Underline = Syncfusion.Windows.Controls.RichTextBoxAdv.Underline.Dash;
//Set paragraph format property
tableConditionalFormattingStyle.ParagraphFormat.TextAlignment = TextAlignment.Right;
//Add the first row conditional style in table conditional formatting style collection
tableStyle.TableConditionalFormattingStyles.Add(tableConditionalFormattingStyle);
//Add the table style in document styles collection
richtextbox.Document.Styles.Add(tableStyle);
Private Sub SurroundingSub()
Dim tableStyle As TableStyle = New TableStyle(richtextbox.Document)
tableStyle.Name = "MyStyle"
Dim tableConditionalFormattingStyle As TableConditionalFormattingStyle = New TableConditionalFormattingStyle(richtextbox.Document)
tableConditionalFormattingStyle.TableConditionalFormattingType = TableConditionalFormattingType.FirstRow
tableConditionalFormattingStyle.CellFormat.Shading.BackgroundColor = Colors.LightBlue
tableConditionalFormattingStyle.CharacterFormat.Bold = True
tableConditionalFormattingStyle.CharacterFormat.Underline = Syncfusion.Windows.Controls.RichTextBoxAdv.Underline.Dash
tableConditionalFormattingStyle.ParagraphFormat.TextAlignment = TextAlignment.Right
tableStyle.TableConditionalFormattingStyles.Add(tableConditionalFormattingStyle)
richtextbox.Document.Styles.Add(tableStyle)
End Sub
ParagraphFormat
Gets or sets the paragraph format.
Declaration
public ParagraphFormat ParagraphFormat { get; set; }
Property Value
Type | Description |
---|---|
ParagraphFormat | The ParagraphFormat object that represents the paragraph properties of the specified table style. |
Examples
The following code example demonstrates, how to create a table style with paragraph format.
TableStyle tableStyle = new TableStyle(richtextbox.Document);
tableStyle.Name = "MyStyle";
//Create heading row conditional style
TableConditionalFormattingStyle tableConditionalFormattingStyle = new TableConditionalFormattingStyle(richtextbox.Document);
//Create table conditional formatting style for first row
tableConditionalFormattingStyle.TableConditionalFormattingType = TableConditionalFormattingType.FirstRow;
//Set cell format property
tableConditionalFormattingStyle.CellFormat.Shading.BackgroundColor = Colors.LightBlue;
//Set character format property
tableConditionalFormattingStyle.CharacterFormat.Bold = true;
tableConditionalFormattingStyle.CharacterFormat.Underline = Syncfusion.Windows.Controls.RichTextBoxAdv.Underline.Dash;
//Set paragraph format property
tableConditionalFormattingStyle.ParagraphFormat.TextAlignment = TextAlignment.Right;
//Add the first row conditional style in table conditional formatting style collection
tableStyle.TableConditionalFormattingStyles.Add(tableConditionalFormattingStyle);
//Add the table style in document styles collection
richtextbox.Document.Styles.Add(tableStyle);
Private Sub SurroundingSub()
Dim tableStyle As TableStyle = New TableStyle(richtextbox.Document)
tableStyle.Name = "MyStyle"
Dim tableConditionalFormattingStyle As TableConditionalFormattingStyle = New TableConditionalFormattingStyle(richtextbox.Document)
tableConditionalFormattingStyle.TableConditionalFormattingType = TableConditionalFormattingType.FirstRow
tableConditionalFormattingStyle.CellFormat.Shading.BackgroundColor = Colors.LightBlue
tableConditionalFormattingStyle.CharacterFormat.Bold = True
tableConditionalFormattingStyle.CharacterFormat.Underline = Syncfusion.Windows.Controls.RichTextBoxAdv.Underline.Dash
tableConditionalFormattingStyle.ParagraphFormat.TextAlignment = TextAlignment.Right
tableStyle.TableConditionalFormattingStyles.Add(tableConditionalFormattingStyle)
richtextbox.Document.Styles.Add(tableStyle)
End Sub
RowFormat
Gets or sets the table row format.
Declaration
public RowFormat RowFormat { get; set; }
Property Value
Type | Description |
---|---|
RowFormat | The RowFormat object that represents the row properties of the specified table style. |
Examples
The following code example demonstrates, how to create a table style with table row format.
TableStyle tableStyle = new TableStyle(richtextbox.Document);
tableStyle.Name = "MyStyle";
//Create heading row conditional style
TableConditionalFormattingStyle tableConditionalFormattingStyle = new TableConditionalFormattingStyle(richtextbox.Document);
//Create table conditional formatting style for first row
tableConditionalFormattingStyle.TableConditionalFormattingType = TableConditionalFormattingType.FirstRow;
//Set cell format property
tableConditionalFormattingStyle.CellFormat.Shading.BackgroundColor = Colors.LightBlue;
//Set character format property
tableConditionalFormattingStyle.CharacterFormat.Bold = true;
tableConditionalFormattingStyle.CharacterFormat.Underline = Syncfusion.Windows.Controls.RichTextBoxAdv.Underline.Dash;
//Set paragraph format property
tableConditionalFormattingStyle.ParagraphFormat.TextAlignment = TextAlignment.Right;
//Add the first row conditional style in table conditional formatting style collection
tableStyle.TableConditionalFormattingStyles.Add(tableConditionalFormattingStyle);
//Add the table style in document styles collection
richtextbox.Document.Styles.Add(tableStyle);
Private Sub SurroundingSub()
Dim tableStyle As TableStyle = New TableStyle(richtextbox.Document)
tableStyle.Name = "MyStyle"
Dim tableConditionalFormattingStyle As TableConditionalFormattingStyle = New TableConditionalFormattingStyle(richtextbox.Document)
tableConditionalFormattingStyle.TableConditionalFormattingType = TableConditionalFormattingType.FirstRow
tableConditionalFormattingStyle.CellFormat.Shading.BackgroundColor = Colors.LightBlue
tableConditionalFormattingStyle.CharacterFormat.Bold = True
tableConditionalFormattingStyle.CharacterFormat.Underline = Syncfusion.Windows.Controls.RichTextBoxAdv.Underline.Dash
tableConditionalFormattingStyle.ParagraphFormat.TextAlignment = TextAlignment.Right
tableStyle.TableConditionalFormattingStyles.Add(tableConditionalFormattingStyle)
richtextbox.Document.Styles.Add(tableStyle)
End Sub
TableConditionalFormattingStyles
Gets or sets the collection of special formatting applied to specified areas of a table.
Declaration
public TableConditionalFormattingStyles TableConditionalFormattingStyles { get; set; }
Property Value
Type | Description |
---|---|
TableConditionalFormattingStyles | The TableConditionalFormattingStyles object that represents the collection of table conditional formatting style TableConditionalFormattingStyle |
Examples
The following code example demonstrates, how to create a table style with conditional formatting styles.
TableStyle tableStyle = new TableStyle(richtextbox.Document);
tableStyle.Name = "MyStyle";
//Create heading row conditional style
TableConditionalFormattingStyle tableConditionalFormattingStyle = new TableConditionalFormattingStyle(richtextbox.Document);
//Create table conditional formatting style for first row
tableConditionalFormattingStyle.TableConditionalFormattingType = TableConditionalFormattingType.FirstRow;
//Set cell format property
tableConditionalFormattingStyle.CellFormat.Shading.BackgroundColor = Colors.LightBlue;
//Set character format property
tableConditionalFormattingStyle.CharacterFormat.Bold = true;
tableConditionalFormattingStyle.CharacterFormat.Underline = Syncfusion.Windows.Controls.RichTextBoxAdv.Underline.Dash;
//Set paragraph format property
tableConditionalFormattingStyle.ParagraphFormat.TextAlignment = TextAlignment.Right;
//Add the first row conditional style in table conditional formatting style collection
tableStyle.TableConditionalFormattingStyles.Add(tableConditionalFormattingStyle);
//Add the table style in document styles collection
richtextbox.Document.Styles.Add(tableStyle);
Private Sub SurroundingSub()
Dim tableStyle As TableStyle = New TableStyle(richtextbox.Document)
tableStyle.Name = "MyStyle"
Dim tableConditionalFormattingStyle As TableConditionalFormattingStyle = New TableConditionalFormattingStyle(richtextbox.Document)
tableConditionalFormattingStyle.TableConditionalFormattingType = TableConditionalFormattingType.FirstRow
tableConditionalFormattingStyle.CellFormat.Shading.BackgroundColor = Colors.LightBlue
tableConditionalFormattingStyle.CharacterFormat.Bold = True
tableConditionalFormattingStyle.CharacterFormat.Underline = Syncfusion.Windows.Controls.RichTextBoxAdv.Underline.Dash
tableConditionalFormattingStyle.ParagraphFormat.TextAlignment = TextAlignment.Right
tableStyle.TableConditionalFormattingStyles.Add(tableConditionalFormattingStyle)
richtextbox.Document.Styles.Add(tableStyle)
End Sub
TableFormat
Gets or sets the table format.
Declaration
public TableFormat TableFormat { get; set; }
Property Value
Type | Description |
---|---|
TableFormat | The TableFormat object that represents the table properties of the specified table style. |
Examples
The following code example demonstrates, how to create a table style with table format.
TableStyle tableStyle = new TableStyle(richtextbox.Document);
tableStyle.Name = "MyStyle";
//Create heading row conditional style
TableConditionalFormattingStyle tableConditionalFormattingStyle = new TableConditionalFormattingStyle(richtextbox.Document);
//Create table conditional formatting style for first row
tableConditionalFormattingStyle.TableConditionalFormattingType = TableConditionalFormattingType.FirstRow;
//Set cell format property
tableConditionalFormattingStyle.CellFormat.Shading.BackgroundColor = Colors.LightBlue;
//Set character format property
tableConditionalFormattingStyle.CharacterFormat.Bold = true;
tableConditionalFormattingStyle.CharacterFormat.Underline = Syncfusion.Windows.Controls.RichTextBoxAdv.Underline.Dash;
//Set paragraph format property
tableConditionalFormattingStyle.ParagraphFormat.TextAlignment = TextAlignment.Right;
//Set table format property
Borders borders = new Borders();
Border left = new Border();
left.LineStyle = LineStyle.Single;
borders.Left = left;
Border right = new Border();
borders.Right = right;
right.LineStyle = LineStyle.Single;
borders.Right = right;
Border top = new Border();
top.LineStyle = LineStyle.Single;
borders.Top = top;
Border bottom = new Border();
bottom.LineStyle = LineStyle.Single;
tableConditionalFormattingStyle.TableFormat.Borders = borders;
//Add the first row conditional style in table conditional formatting style collection
tableStyle.TableConditionalFormattingStyles.Add(tableConditionalFormattingStyle);
//Add the table style in document styles collection
richtextbox.Document.Styles.Add(tableStyle);
Private Sub SurroundingSub()
Dim tableStyle As TableStyle = New TableStyle(richtextbox.Document)
tableStyle.Name = "MyStyle"
Dim tableConditionalFormattingStyle As TableConditionalFormattingStyle = New TableConditionalFormattingStyle(richtextbox.Document)
tableConditionalFormattingStyle.TableConditionalFormattingType = TableConditionalFormattingType.FirstRow
tableConditionalFormattingStyle.CellFormat.Shading.BackgroundColor = Colors.LightBlue
tableConditionalFormattingStyle.CharacterFormat.Bold = True
tableConditionalFormattingStyle.CharacterFormat.Underline = Syncfusion.Windows.Controls.RichTextBoxAdv.Underline.Dash
tableConditionalFormattingStyle.ParagraphFormat.TextAlignment = TextAlignment.Right
Dim borders As Borders = New Borders()
Dim left As Border = New Border()
left.LineStyle = LineStyle.Single
borders.Left = left
Dim right As Border = New Border()
borders.Right = right
right.LineStyle = LineStyle.Single
borders.Right = right
Dim top As Border = New Border()
top.LineStyle = LineStyle.Single
borders.Top = top
Dim bottom As Border = New Border()
bottom.LineStyle = LineStyle.Single
tableConditionalFormattingStyle.TableFormat.Borders = borders
tableStyle.TableConditionalFormattingStyles.Add(tableConditionalFormattingStyle)
richtextbox.Document.Styles.Add(tableStyle)
End Sub