menu

Xamarin.Forms

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class WTableStyle - Xamarin.Forms API Reference | Syncfusion

    Show / Hide Table of Contents

    Class WTableStyle

    Represents a style of WTable.

    Inheritance
    System.Object
    OwnerHolder
    XDLSSerializableBase
    Style
    WTableStyle
    Implements
    IXDLSSerializable
    IWTableStyle
    IStyle
    Inherited Members
    OwnerHolder.Document
    OwnerHolder.m_doc
    Style.ApplyBaseStyle(BuiltinStyle)
    Style.BuiltInStyleIdentifier
    Style.CharacterFormat
    Style.CreateBuiltinStyle(BuiltinStyle, StyleType, WordDocument)
    Style.CreateBuiltinStyle(BuiltinStyle, WordDocument)
    Style.DEF_USER_STYLE_ID
    Style.InitXDLSHolder()
    Style.IsPrimaryStyle
    Style.IStyle.Close()
    Style.LinkedStyleName
    Style.m_baseStyle
    Style.m_chFormat
    Style.m_linkedStyleName
    Style.m_nextStyle
    Style.m_tapx
    Style.m_typeCode
    Style.Name
    Style.NameToBuiltIn(String)
    Style.ReadXmlAttributes(IXDLSAttributeReader)
    Style.Remove()
    Style.RestoreReference(String, Int32)
    Style.WriteXmlAttributes(IXDLSAttributeWriter)
    XDLSSerializableBase.IXDLSSerializable.ReadXmlAttributes(IXDLSAttributeReader)
    XDLSSerializableBase.IXDLSSerializable.ReadXmlContent(IXDLSContentReader)
    XDLSSerializableBase.IXDLSSerializable.RestoreReference(String, Int32)
    XDLSSerializableBase.IXDLSSerializable.WriteXmlAttributes(IXDLSAttributeWriter)
    XDLSSerializableBase.IXDLSSerializable.WriteXmlContent(IXDLSContentWriter)
    XDLSSerializableBase.IXDLSSerializable.XDLSHolder
    XDLSSerializableBase.ReadXmlContent(IXDLSContentReader)
    XDLSSerializableBase.WriteXmlContent(IXDLSContentWriter)
    XDLSSerializableBase.XDLSHolder
    Namespace: Syncfusion.DocIO.DLS
    Assembly: Syncfusion.DocIO.Portable.dll
    Syntax
    public class WTableStyle : Style, IXDLSSerializable, IWTableStyle, IStyle

    Properties

    CellProperties

    Gets cell properties.

    Declaration
    public TableStyleCellProperties CellProperties { get; }
    Property Value
    Type
    TableStyleCellProperties

    ConditionalFormattingStyles

    Gets conditional formatting styles collection of the table style.

    Declaration
    public ConditionalFormattingStyleCollection ConditionalFormattingStyles { get; }
    Property Value
    Type
    ConditionalFormattingStyleCollection

    ParagraphFormat

    Gets the paragraph format.

    Declaration
    public WParagraphFormat ParagraphFormat { get; }
    Property Value
    Type Description
    WParagraphFormat

    The WParagraphFormat object.

    RowProperties

    Gets row properties.

    Declaration
    public TableStyleRowProperties RowProperties { get; }
    Property Value
    Type
    TableStyleRowProperties

    StyleType

    Gets the type of the style.

    Declaration
    public override StyleType StyleType { get; }
    Property Value
    Type Description
    StyleType

    The StyleTypemember that specifies the type of the style.

    Overrides
    Style.StyleType

    TableProperties

    Gets table properties.

    Declaration
    public TableStyleTableProperties TableProperties { get; }
    Property Value
    Type
    TableStyleTableProperties

    Methods

    ApplyBaseStyle(BuiltinTableStyle)

    Applies the base style for the current table style.

    Declaration
    public void ApplyBaseStyle(BuiltinTableStyle tableStyle)
    Parameters
    Type Name Description
    BuiltinTableStyle tableStyle

    The BuiltinTableStyle member that specifies the built-in table style.

    Examples
    using (WordDocument document = new WordDocument())
    {
    document.EnsureMinimal();
    WTable table = document.LastSection.AddTable() as WTable;
    table.ResetCells(3, 2);
    table[0, 0].AddParagraph().AppendText("Hi");
    table[0, 1].AddParagraph().AppendText("Hi");
    //Adds a new custom table style
    WTableStyle tableStyle = document.AddTableStyle("CustomStyle1") as WTableStyle;
    //Applies conditional formatting for first row
    ConditionalFormattingStyle firstRowStyle = tableStyle.ConditionalFormattingStyles.Add(ConditionalFormattingType.FirstRow);
    firstRowStyle.CharacterFormat.Bold = true;
    firstRowStyle.CharacterFormat.TextColor = Color.FromArgb(255, 255, 255, 255);
    firstRowStyle.CellProperties.BackColor = Color.Blue;
    //Applies conditional formatting for first column
    ConditionalFormattingStyle firstColumnStyle = tableStyle.ConditionalFormattingStyles.Add(ConditionalFormattingType.FirstColumn);
    firstColumnStyle.CharacterFormat.Bold = true;
    //Applies conditional formatting for odd row
    ConditionalFormattingStyle oddRowBandingStyle = tableStyle.ConditionalFormattingStyles.Add(ConditionalFormattingType.OddRowBanding);
    oddRowBandingStyle.CellProperties.BackColor = Color.Red;
    //Apply built in table style as base style for CustomStyle2
    tableStyle.ApplyBaseStyle(BuiltinTableStyle.TableContemporary);
    //Applies the custom table style to the table
    table.ApplyStyle("CustomStyle1");
    //Saves and closes the document instance
    document.Save("TableStyle.docx", FormatType.Docx);
    }
    Dim document As WordDocument = New WordDocument()
    document.EnsureMinimal()
    Dim table As WTable = TryCast(document.LastSection.AddTable(), WTable)
    table.ResetCells(3, 2)
    table(0, 0).AddParagraph().AppendText("Hi")
    table(0, 1).AddParagraph().AppendText("Hi")
    'Adds a new custom table style 
    Dim tableStyle As WTableStyle = TryCast(document.AddTableStyle("CustomStyle1"), WTableStyle)
    'Applies conditional formatting for first row
    Dim firstRowStyle As ConditionalFormattingStyle = tableStyle.ConditionalFormattingStyles.Add(ConditionalFormattingType.FirstRow)
    firstRowStyle.CharacterFormat.Bold = True
    firstRowStyle.CharacterFormat.TextColor = Color.FromArgb(255, 255, 255, 255)
    firstRowStyle.CellProperties.BackColor = Color.Blue
    'Applies conditional formatting for first column
    Dim firstColumnStyle As ConditionalFormattingStyle = tableStyle.ConditionalFormattingStyles.Add(ConditionalFormattingType.FirstColumn)
    firstColumnStyle.CharacterFormat.Bold = True
    'Applies conditional formatting for odd row
    Dim oddRowBandingStyle As ConditionalFormattingStyle = tableStyle.ConditionalFormattingStyles.Add(ConditionalFormattingType.OddRowBanding)
    oddRowBandingStyle.CellProperties.BackColor = Color.Red
    'Apply built in table style as base style for CustomStyle2
    tableStyle.ApplyBaseStyle(BuiltinTableStyle.TableContemporary)
    'Applies the custom table style to the table
    table.ApplyStyle("CustomStyle1")
    'Saves and closes the document instance
    document.Save("TableStyle.docx", FormatType.Docx)
    document.Close()

    ApplyBaseStyle(String)

    Apply base style for current style.

    Declaration
    public override void ApplyBaseStyle(string styleName)
    Parameters
    Type Name Description
    System.String styleName

    The string that specifies the style name.

    Overrides
    Style.ApplyBaseStyle(String)

    Clone()

    Creates a duplicate copy of the style.

    Declaration
    public override IStyle Clone()
    Returns
    Type Description
    IStyle

    The reference to the newly created style.

    Overrides
    Style.Clone()

    CloneImpl()

    Creates a duplicate copy of the entity.

    Declaration
    protected override object CloneImpl()
    Returns
    Type Description
    System.Object

    An object that can be casted as WTableStyle.

    Overrides
    Style.CloneImpl()

    Implements

    IXDLSSerializable
    IWTableStyle
    IStyle
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved