Class TableFormat
Represents the TableFormat class.
Namespace: Syncfusion.Windows.Controls.RichTextBoxAdv
Assembly: Syncfusion.SfRichTextBoxAdv.WPF.dll
Syntax
public sealed class TableFormat : BaseNode
Constructors
TableFormat()
Initializes a new instance of the TableFormat class.
Declaration
public TableFormat()
TableFormat(BaseNode)
Initializes a new instance of the TableFormat class for the specified BaseNode.
Declaration
public TableFormat(BaseNode owner)
Parameters
Type | Name | Description |
---|---|---|
BaseNode | owner | The owner of the TableFormat. The value can be null or an instance of TableAdv. |
Fields
BackgroundProperty
Identifies the Background dependency property.
Declaration
public static readonly DependencyProperty BackgroundProperty
Field Value
Type | Description |
---|---|
System.Windows.DependencyProperty | The identifier for the Background dependency property. |
BidiProperty
Identifies the Bidi dependency property.
Declaration
public static readonly DependencyProperty BidiProperty
Field Value
Type | Description |
---|---|
System.Windows.DependencyProperty | The identifier for the Bidi dependency property. |
BordersProperty
Identifies the Borders dependency property.
Declaration
public static readonly DependencyProperty BordersProperty
Field Value
Type | Description |
---|---|
System.Windows.DependencyProperty | The identifier for the Borders dependency property. |
BottomMarginProperty
Identifies the BottomMargin dependency property.
Declaration
public static readonly DependencyProperty BottomMarginProperty
Field Value
Type | Description |
---|---|
System.Windows.DependencyProperty | The identifier for the BottomMargin dependency property. |
CellSpacingProperty
Identifies the CellSpacing dependency property.
Declaration
public static readonly DependencyProperty CellSpacingProperty
Field Value
Type | Description |
---|---|
System.Windows.DependencyProperty | The identifier for the CellSpacing dependency property. |
LeftIndentProperty
Identifies the LeftIndent dependency property.
Declaration
public static readonly DependencyProperty LeftIndentProperty
Field Value
Type | Description |
---|---|
System.Windows.DependencyProperty | The identifier for the LeftIndent dependency property. |
LeftMarginProperty
Identifies the LeftMargin dependency property.
Declaration
public static readonly DependencyProperty LeftMarginProperty
Field Value
Type | Description |
---|---|
System.Windows.DependencyProperty | The identifier for the LeftMargin dependency property. |
PreferredWidthProperty
Identifies the PreferredWidth dependency property.
Declaration
public static readonly DependencyProperty PreferredWidthProperty
Field Value
Type | Description |
---|---|
System.Windows.DependencyProperty | The identifier for the PreferredWidth dependency property. |
PreferredWidthTypeProperty
Identifies the PreferredWidthType dependency property.
Declaration
public static readonly DependencyProperty PreferredWidthTypeProperty
Field Value
Type | Description |
---|---|
System.Windows.DependencyProperty | The identifier for the PreferredWidthType dependency property. |
RightMarginProperty
Identifies the RightMargin dependency property.
Declaration
public static readonly DependencyProperty RightMarginProperty
Field Value
Type | Description |
---|---|
System.Windows.DependencyProperty | The identifier for the RightMargin dependency property. |
ShadingProperty
Identifies the Shading dependency property.
Declaration
public static readonly DependencyProperty ShadingProperty
Field Value
Type | Description |
---|---|
System.Windows.DependencyProperty | The identifier for the Shading dependency property. |
TableAlignmentProperty
Identifies the TableAlignment dependency property.
Declaration
public static readonly DependencyProperty TableAlignmentProperty
Field Value
Type | Description |
---|---|
System.Windows.DependencyProperty | The identifier for the TableAlignment dependency property. |
TopMarginProperty
Identifies the TopMargin dependency property.
Declaration
public static readonly DependencyProperty TopMarginProperty
Field Value
Type | Description |
---|---|
System.Windows.DependencyProperty | The identifier for the TopMargin dependency property. |
Properties
Background
Gets or sets the background color of the TableAdv.
Declaration
public Color Background { get; set; }
Property Value
Type | Description |
---|---|
System.Windows.Media.Color | The background color for the TableAdv. |
Bidi
Gets or sets a direction of the TableAdv. The default value is false.
Declaration
public bool Bidi { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | True. If right-to-left direction; Otherwise, false. |
Examples
The following code example demonstrates how to define right-to-left direction(bidirectional) for the table.
<!-- Defines a table with right-to-left direction. -->
<RichTextBoxAdv:TableAdv>
<RichTextBoxAdv:TableAdv.TableFormat>
<RichTextBoxAdv:TableFormat Bidi="True"/>
</RichTextBoxAdv:TableAdv.TableFormat>
<!-- Define the rows of the table. -->
</RichTextBoxAdv:TableAdv>
// Defines a table that indents 48 pixels from the left.
TableAdv table = new TableAdv();
TableFormat tableFormat = new TableFormat();
tableFormat.Bidi = true;
table.TableFormat = tableFormat;
// Define the row of the table.
' Defines a table that indents 48 pixels from the left.
Dim table As New TableAdv()
Dim tableFormat As New TableFormat()
tableFormat.Bidi = True
table.TableFormat = tableFormat
' Define the row of the table.
Borders
Declaration
public Borders Borders { get; set; }
Property Value
Type | Description |
---|---|
Borders | The borders for the TableAdv. |
Examples
The following code example demonstrates how to define the borders for the table
<!-- Defines the borders for the table -->
<RichTextBoxAdv:TableAdv>
<RichTextBoxAdv:TableAdv.TableFormat>
<RichTextBoxAdv:TableFormat>
<RichTextBoxAdv:TableFormat.Borders>
<RichTextBoxAdv:Borders>
<RichTextBoxAdv:Borders.Left>
<RichTextBoxAdv:Border LineStyle="Single"/>
</RichTextBoxAdv:Borders.Left>
<RichTextBoxAdv:Borders.Right>
<RichTextBoxAdv:Border LineStyle="Single"/>
</RichTextBoxAdv:Borders.Right>
<RichTextBoxAdv:Borders.Top>
<RichTextBoxAdv:Border LineStyle="Single"/>
</RichTextBoxAdv:Borders.Top>
<RichTextBoxAdv:Borders.Bottom>
<RichTextBoxAdv:Border LineStyle="Single"/>
</RichTextBoxAdv:Borders.Bottom>
<RichTextBoxAdv:Borders.DiagonalUp>
<RichTextBoxAdv:Border LineStyle="Single"/>
</RichTextBoxAdv:Borders.DiagonalUp>
<RichTextBoxAdv:Borders.DiagonalDown>
<RichTextBoxAdv:Border LineStyle="Single"/>
</RichTextBoxAdv:Borders.DiagonalDown>
<RichTextBoxAdv:Borders.Horizontal>
<RichTextBoxAdv:Border LineStyle="Single"/>
</RichTextBoxAdv:Borders.Horizontal>
<RichTextBoxAdv:Borders.Vertical>
<RichTextBoxAdv:Border LineStyle="Single"/>
</RichTextBoxAdv:Borders.Vertical>
</RichTextBoxAdv:Borders>
</RichTextBoxAdv:TableFormat.Borders>
</RichTextBoxAdv:TableFormat>
</RichTextBoxAdv:TableAdv.TableFormat>
<!-- Define the borders of the table. -->
</RichTextBoxAdv:TableAdv>
// Defines the borders for the table.
TableAdv table = new TableAdv();
TableFormat tableFormat = new TableFormat();
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;
borders.Bottom = bottom;
Border diagonalUp= new Border();
diagonalUp.LineStyle = LineStyle.Single;
borders.DiagonalUp = diagonalUp;
Border diagonalDown = new Border();
diagonalDown.LineStyle = LineStyle.Single;
borders.DiagonalDown = diagonalDown;
Border horizontal = new Border();
horizontal.LineStyle = LineStyle.Single;
borders.Horizontal = horizontal;
Border vertical = new Border();
vertical.LineStyle = LineStyle.Single;
borders.Vertical = vertical;
tableFormat.Borders = borders;
table.TableFormat = tableFormat;
// Defines the borders of the table.
' Defines the borders for the table.
Dim table As New TableAdv()
Dim tableFormat As New TableFormat()
Dim borders As New Borders()
Dim left As New Border()
left.LineStyle = LineStyle.Single
borders.Left = left
Dim right As New Border()
right.LineStyle = LineStyle.Single
borders.Right = right
Dim top As New Border()
top.LineStyle = LineStyle.Single
borders.Top = top
Dim bottom As New Border()
bottom.LineStyle = LineStyle.Single
borders.Bottom = bottom
Dim diagonalUp As New Border()
diagonalUp.LineStyle = LineStyle.Single
borders.DiagonalUp = diagonalUp
Dim diagonalDown As New Border()
diagonalDown.LineStyle = LineStyle.Single
borders.DiagonalDown = diagonalDown
Border horizontal = new Border()
horizontal.LineStyle = LineStyle.Single
borders.Horizontal = horizontal
Border vertical = new Border()
vertical.LineStyle = LineStyle.Single
borders.Vertical = vertical
tableFormat.Borders = borders
table.TableFormat = tableFormat
'Defines the borders of the table.
BottomMargin
Gets or sets the default cell bottom margin of the TableAdv.
Declaration
public double BottomMargin { get; set; }
Property Value
Type | Description |
---|---|
System.Double | The default cell bottom margin for the TableAdv. |
Examples
The following code example demonstrates how to define the default cell bottom margin for the table.
<!-- Defines the default cell bottom margin for the table with 13 pixels -->
<RichTextBoxAdv:TableAdv>
<RichTextBoxAdv:TableAdv.TableFormat>
<RichTextBoxAdv:TableFormat BottomMargin ="13"/>
</RichTextBoxAdv:TableAdv.TableFormat>
<!-- Define the default cell bottom margin of the table. -->
</RichTextBoxAdv:TableAdv>
// Defines the default cell bottom margin for the table with 13 pixels.
TableAdv table = new TableAdv();
TableFormat tableFormat = new TableFormat();
tableFormat.BottomMargin = 13;
table.TableFormat = tableFormat;
// Define the default cell bottom margin of the table.
' Defines the default cell bottom margin for the table with 13 pixels.
Dim table As New TableAdv()
Dim tableFormat As New TableFormat()
tableFormat.BottomMargin = 13
table.TableFormat = tableFormat
' Define the default cell bottom margin of the table.
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException | The measuremnet must be between -0 px and 2112px px. |
CellSpacing
Gets or sets the spacing between the cells in the TableAdv.
Declaration
public double CellSpacing { get; set; }
Property Value
Type | Description |
---|---|
System.Double | The cell spacing for the TableAdv. |
Examples
The following code example demonstrates how to define cell spacing for the table.
<!-- Defines the cell spacing for a table with 2 pixes -->
<RichTextBoxAdv:TableAdv>
<RichTextBoxAdv:TableAdv.TableFormat>
<RichTextBoxAdv:TableFormat CellSpacing="2"/>
</RichTextBoxAdv:TableAdv.TableFormat>
<!-- Define the cell spacing of the table. -->
</RichTextBoxAdv:TableAdv>
// Defines the cell spacing for a table with 20 pixels.
TableAdv table = new TableAdv();
TableFormat tableFormat = new TableFormat();
tableFormat.CellSpacing = 2;
table.TableFormat = tableFormat;
// Define the cell spacing of the table.
' Defines the cell spacing for a table with 20 pixels.
Dim table As New TableAdv()
Dim tableFormat As New TableFormat()
tableFormat.CellSpacing = 2
table.TableFormat = tableFormat
' Define the cell spacing of the table.
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException | The measuremnet must be between 0 px and 264.6 px. |
LeftIndent
Gets or sets the left indent of the TableAdv.
Declaration
public double LeftIndent { get; set; }
Property Value
Type | Description |
---|---|
System.Double | The left indent for the TableAdv. |
Examples
The following code example demonstrates how to define left indent for a table.
<!-- Defines a table that indents 48 pixels from the left. -->
<RichTextBoxAdv:TableAdv>
<RichTextBoxAdv:TableAdv.TableFormat>
<RichTextBoxAdv:TableFormat LeftIndent="48"/>
</RichTextBoxAdv:TableAdv.TableFormat>
<!-- Define the rows of the table. -->
</RichTextBoxAdv:TableAdv>
// Defines a table that indents 48 pixels from the left.
TableAdv table = new TableAdv();
TableFormat tableFormat = new TableFormat();
tableFormat.LeftIndent = 48;
table.TableFormat = tableFormat;
// Define the row of the table.
' Defines a table that indents 48 pixels from the left.
Dim table As New TableAdv()
Dim tableFormat As New TableFormat()
tableFormat.LeftIndent = 48
table.TableFormat = tableFormat
' Define the row of the table.
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException | The measurement must be between -1440 px and 1440 px. |
LeftMargin
Gets or sets the default cell left margin of the TableAdv.
Declaration
public double LeftMargin { get; set; }
Property Value
Type | Description |
---|---|
System.Double | The default cell left margin for the TableAdv. |
Examples
The following code example demonstrates how to define the default cell left margin for the table.
<!-- Defines the default cell left margin for the table with 13 pixels -->
<RichTextBoxAdv:TableAdv>
<RichTextBoxAdv:TableAdv.TableFormat>
<RichTextBoxAdv:TableFormat LeftMargin ="13"/>
</RichTextBoxAdv:TableAdv.TableFormat>
<!-- Define the default cell left margin of the table. -->
</RichTextBoxAdv:TableAdv>
// Defines the default cell left margin for the table with 13 pixels.
TableAdv table = new TableAdv();
TableFormat tableFormat = new TableFormat();
tableFormat.LeftMargin = 13;
table.TableFormat = tableFormat;
// Define the default cell left margin of the table.
' Defines the default cell left margin for the table with 13 pixels.
Dim table As New TableAdv()
Dim tableFormat As New TableFormat()
tableFormat.LeftMargin = 13
table.TableFormat = tableFormat
' Define the default cell left margin of the table.
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException | The measuremnet must be between -0 px and 2112px px. |
PreferredWidth
Gets or sets the preferred width of the TableAdv.
Declaration
public double PreferredWidth { get; set; }
Property Value
Type | Description |
---|---|
System.Double | The preferred width for the TableAdv. |
Examples
The following code example demonstrates how to define preferred width for the table.
<!-- Defines the preferred width for the table. -->
<RichTextBoxAdv:TableAdv>
<RichTextBoxAdv:TableAdv.TableFormat>
<RichTextBoxAdv:TableFormat PreferredWidthType = "Pixel"; PreferredWidth = "500" />
</RichTextBoxAdv:TableAdv.TableFormat>
<!-- Define the preferred width of the table. -->
</RichTextBoxAdv:TableAdv>
// Defines the preferred width of the table.
TableAdv table = new TableAdv();
TableFormat tableFormat = new TableFormat();
tableFormat.PreferredWidthType = WidthType.Pixel;
tableFormat.PreferredWidth = 500;
table.TableFormat = tableFormat;
// Define the preferred width of the table.
' Defines the preferred width of the table.
Dim table As New TableAdv()
Dim tableFormat As New TableFormat()
tableFormat.PreferredWidthType = WidthType.Pixel
tableFormat.PreferredWidth = 500
table.TableFormat = tableFormat
' Define the preferred width of the table.
PreferredWidthType
Declaration
public WidthType PreferredWidthType { get; set; }
Property Value
Type | Description |
---|---|
WidthType | The preferred width type for the TableAdv. |
Examples
The following code example demonstrates how to define preferred width type for the table.
<!-- Defines the preferred width type for the table. -->
<RichTextBoxAdv:TableAdv>
<RichTextBoxAdv:TableAdv.TableFormat>
<RichTextBoxAdv:TableFormat PreferredWidthType = "Pixel"; PreferredWidth = "500"/>
</RichTextBoxAdv:TableAdv.TableFormat>
<!-- Define the preferred width type of the table. -->
</RichTextBoxAdv:TableAdv>
// Defines the preferred width type of the table.
TableAdv table = new TableAdv();
TableFormat tableFormat = new TableFormat();
tableFormat.PreferredWidthType = WidthType.Pixel;
tableFormat.PreferredWidth = 500;
table.TableFormat = tableFormat;
// Define the preferred width type of the table.
' Defines the preferred width type of the table.
Dim table As New TableAdv()
Dim tableFormat As New TableFormat()
tableFormat.PreferredWidthType = WidthType.Pixel
tableFormat.PreferredWidth = 500
table.TableFormat = tableFormat
' Define the preferred width type of the table.
RightMargin
Gets or sets the default cell right margin of the TableAdv.
Declaration
public double RightMargin { get; set; }
Property Value
Type | Description |
---|---|
System.Double | The default cell right margin for the TableAdv. |
Examples
The following code example demonstrates how to define default cell right margin for the table.
<!-- Defines the default cell right margin for the table with 13 pixels -->
<RichTextBoxAdv:TableAdv>
<RichTextBoxAdv:TableAdv.TableFormat>
<RichTextBoxAdv:TableFormat RightMargin ="13"/>
</RichTextBoxAdv:TableAdv.TableFormat>
<!-- Define the default cell right margin of the table. -->
</RichTextBoxAdv:TableAdv>
// Defines the default cell right margin for the table with 13 pixels.
TableAdv table = new TableAdv();
TableFormat tableFormat = new TableFormat();
tableFormat.RightMargin = 13;
table.TableFormat = tableFormat;
// Define the default cell right margin of the table.
' Defines the default cell right margin for the table with 13 pixels.
Dim table As New TableAdv()
Dim tableFormat As New TableFormat()
tableFormat.RightMargin = 13
table.TableFormat = tableFormat
' Define the default cell right margin of the table.
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException | The measuremnet must be between -0 px and 2112px px. |
Shading
Declaration
public Shading Shading { get; set; }
Property Value
Type |
---|
Shading |
StyleName
Gets or sets the name of table style.
Declaration
public string StyleName { get; set; }
Property Value
Type | Description |
---|---|
System.String | The string that specifies the table style name. |
Examples
The following code example demonstrates, how to set the table style name.
// Initializes a document.
DocumentAdv document = new DocumentAdv();
// Initialize a section.
SectionAdv section = new SectionAdv();
// Initialize a table.
TableAdv tableAdv = new TableAdv();
// Set table stlye name
tableAdv.TableFormat.StyleName = "MyStyle";
// Initialize a row.
TableRowAdv tableRowAdv = new TableRowAdv();
// Initialize a table cell.
TableCellAdv tableCellAdv = new TableCellAdv();
tableCellAdv.CellFormat.CellWidth = 240;
// Initializes a paragraph.
ParagraphAdv paragraphAdv = new ParagraphAdv();
SpanAdv spanAdv = new SpanAdv();
spanAdv.Text = "Cell 1";
paragraphAdv.Inlines.Add(spanAdv);
tableCellAdv.Blocks.Add(paragraphAdv);
// Initialize and add any number of blocks to the cell here.
tableRowAdv.Cells.Add(tableCellAdv);
// Initialize and add any number of cells to the row here.
tableAdv.Rows.Add(tableRowAdv);
// Initialize and add any number of rows to the table here.
section.Blocks.Add(tableAdv);
// Initialize and add any number of blocks to the section here.
richtextbox.Document.Sections.Add(section);
Private Sub SurroundingSub()
Dim document As DocumentAdv = New DocumentAdv()
Dim section As SectionAdv = New SectionAdv()
Dim tableAdv As TableAdv = New TableAdv()
tableAdv.TableFormat.StyleName = "MyStyle"
Dim tableRowAdv As TableRowAdv = New TableRowAdv()
Dim tableCellAdv As TableCellAdv = New TableCellAdv()
tableCellAdv.CellFormat.CellWidth = 240
Dim paragraphAdv As ParagraphAdv = New ParagraphAdv()
Dim spanAdv As SpanAdv = New SpanAdv()
spanAdv.Text = "Cell 1"
paragraphAdv.Inlines.Add(spanAdv)
tableCellAdv.Blocks.Add(paragraphAdv)
tableRowAdv.Cells.Add(tableCellAdv)
tableAdv.Rows.Add(tableRowAdv)
section.Blocks.Add(tableAdv)
document.Sections.Add(section)
richtextbox.Document = document
End Sub
TableAlignment
Gets or sets the TableAlignment of the TableAdv.
Declaration
public TableAlignment TableAlignment { get; set; }
Property Value
Type | Description |
---|---|
TableAlignment | The table alignment for the TableAdv. |
Examples
The following code example demonstrates how to define alignment for the table.
<!-- Defines the alignment for the table. -->
<RichTextBoxAdv:TableAdv>
<RichTextBoxAdv:TableAdv.TableFormat>
<RichTextBoxAdv:TableFormat TableAlignment = "Center"/>
</RichTextBoxAdv:TableAdv.TableFormat>
<!-- Define the alignment of the table. -->
</RichTextBoxAdv:TableAdv>
// Defines the alignment of the table.
TableAdv table = new TableAdv();
TableFormat tableFormat = new TableFormat();
tableFormat.TableAlignment = TableAlignment.Center;
table.TableFormat = tableFormat;
// Define the alignment of the table.
' Defines the alignment of the table.
Dim table As New TableAdv()
Dim tableFormat As New TableFormat()
tableFormat.TableAlignment = TableAlignment.Center
table.TableFormat = tableFormat
' Define the alignment of the table.
TopMargin
Gets or sets the default cell top margin of the TableAdv.
Declaration
public double TopMargin { get; set; }
Property Value
Type | Description |
---|---|
System.Double | The default cell top margin for the TableAdv. |
Examples
The following code example demonstrates how to define the default cell top margin for the table.
<!-- Defines the default cell top margin for the table with 13 pixels -->
<RichTextBoxAdv:TableAdv>
<RichTextBoxAdv:TableAdv.TableFormat>
<RichTextBoxAdv:TableFormat TopMargin ="13"/>
</RichTextBoxAdv:TableAdv.TableFormat>
<!-- Define the default cell top margin of the table. -->
</RichTextBoxAdv:TableAdv>
// Defines the default cell top margin for the table with 13 pixels.
TableAdv table = new TableAdv();
TableFormat tableFormat = new TableFormat();
tableFormat.TopMargin = 13;
table.TableFormat = tableFormat;
// Define the default cell top margin of the table.
' Defines the default cell top margin for the table with 13 pixels.
Dim table As New TableAdv()
Dim tableFormat As New TableFormat()
tableFormat.TopMargin = 13
table.TableFormat = tableFormat
' Define the default cell top margin of the table.
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException | The measuremnet must be between -0 px and 2112px px. |