Xamarin.Android

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class CellFormat

    Show / Hide Table of Contents

    Class CellFormat

    Represents the cell formatting options for table cell.

    Inheritance
    System.Object
    OwnerHolder
    XDLSSerializableBase
    FormatBase
    CellFormat
    Implements
    IXDLSSerializable
    Inherited Members
    FormatBase.m_propertiesHash
    FormatBase.m_oldPropertiesHash
    FormatBase.HasKey(Int32)
    FormatBase.HasBoolKey(Int32)
    FormatBase.ClearFormatting()
    FormatBase.EnsureComposites(Int32[])
    FormatBase.GetBaseKey(Int32)
    FormatBase.GetFullKey(Int32)
    FormatBase.GetDefComposite(Int32, FormatBase)
    FormatBase.Item[Int32]
    XDLSSerializableBase.IXDLSSerializable.WriteXmlAttributes(IXDLSAttributeWriter)
    XDLSSerializableBase.IXDLSSerializable.WriteXmlContent(IXDLSContentWriter)
    XDLSSerializableBase.IXDLSSerializable.ReadXmlAttributes(IXDLSAttributeReader)
    XDLSSerializableBase.IXDLSSerializable.ReadXmlContent(IXDLSContentReader)
    XDLSSerializableBase.IXDLSSerializable.RestoreReference(String, Int32)
    XDLSSerializableBase.CloneImpl()
    XDLSSerializableBase.WriteXmlContent(IXDLSContentWriter)
    XDLSSerializableBase.ReadXmlContent(IXDLSContentReader)
    XDLSSerializableBase.RestoreReference(String, Int32)
    XDLSSerializableBase.IXDLSSerializable.XDLSHolder
    XDLSSerializableBase.XDLSHolder
    OwnerHolder.m_doc
    OwnerHolder.Document
    Namespace: Syncfusion.DocIO.DLS
    Assembly: Syncfusion.DocIO.Portable.dll
    Syntax
    public class CellFormat : FormatBase, IXDLSSerializable
    Examples

    The following code example demonstrates how to apply cell formatting options to a WTableCell

    private void Button1_Click(System.Object sender, System.EventArgs e)
    {
        WordDocument document = new WordDocument();
        document.Open("Table.docx", FormatType.Docx);
        WSection section = document.Sections[0];
        WTable table = section.Tables[0] as WTable;
        //Access the instance of the first row in the table
        WTableRow row = table.Rows[0];
        //Specify the row height
        row.Height = 20;
        //Specify the row height type
        row.HeightType = TableRowHeightType.AtLeast;
        //Access the instance of the first cell in the row
        WTableCell cell = row.Cells[0];
        //Specify the cell back ground color
        cell.CellFormat.BackColor = Color.FromArgb(192, 192, 192);
        //Specify the same padding as table option as false to preserve current cell padding
        cell.CellFormat.SamePaddingsAsTable = false;
        //Specify the left, right, top and bottom padding of the cell
        cell.CellFormat.Paddings.Left = 5;
        cell.CellFormat.Paddings.Right = 5;
        cell.CellFormat.Paddings.Top = 5;
        cell.CellFormat.Paddings.Bottom = 5;
        //Specify the vertical alignment of content of text
        cell.CellFormat.VerticalAlignment = VerticalAlignment.Middle;
        //Access the instance of the second cell in the row
        cell = row.Cells[1];
        cell.CellFormat.BackColor = Color.FromArgb(192, 192, 192);
        cell.CellFormat.SamePaddingsAsTable = false;
        //Specify the left, right, top and bottom padding of the cell
        cell.CellFormat.Paddings.All = 5;
        cell.CellFormat.VerticalAlignment = VerticalAlignment.Middle;
        document.Save("TableCellFormatting.docx", FormatType.Docx);
        document.Close();
    }
    Private Sub button_Click(sender As Object, e As EventArgs)
        Dim document As New WordDocument()
        document.Open("Table.docx", FormatType.Docx)
        Dim section As WSection = document.Sections(0)
        Dim table As WTable = TryCast(section.Tables(0), WTable)
        'Access the instance of the first row in the table
        Dim row As WTableRow = table.Rows(0)
        'Specify the row height
        row.Height = 20
        'Specify the row height type
        row.HeightType = TableRowHeightType.AtLeast
        'Access the instance of the first cell in the row
        Dim cell As WTableCell = row.Cells(0)
        'Specify the cell back ground color
        cell.CellFormat.BackColor = Color.FromArgb(192, 192, 192)
        'Specify the same padding as table option as false to preserve current cell padding
        cell.CellFormat.SamePaddingsAsTable = False
        'Specify the left, right, top and bottom padding of the cell
        cell.CellFormat.Paddings.Left = 5
        cell.CellFormat.Paddings.Right = 5
        cell.CellFormat.Paddings.Top = 5
        cell.CellFormat.Paddings.Bottom = 5
        'Specify the vertical alignment of content of text
        cell.CellFormat.VerticalAlignment = VerticalAlignment.Middle
        'Access the instance of the second cell in the row
        cell = row.Cells(1)
        cell.CellFormat.BackColor = Color.FromArgb(192, 192, 192)
        cell.CellFormat.SamePaddingsAsTable = False
        'Specify the left, right, top and bottom padding of the cell
        cell.CellFormat.Paddings.All = 5
        cell.CellFormat.VerticalAlignment = VerticalAlignment.Middle
        document.Save("TableCellFormatting.docx", FormatType.Docx)
        document.Close()
    End Sub

    Constructors

    CellFormat()

    Initializes a new instance of the CellFormat class.

    Declaration
    public CellFormat()

    Properties

    BackColor

    Gets or sets the background color for cell.

    Declaration
    public Color BackColor { get; set; }
    Property Value
    Type Description
    Color

    The for cell background.

    Borders

    Gets the borders for the cell.

    Declaration
    public Borders Borders { get; }
    Property Value
    Type Description
    Borders

    The Borders that specifies the borders of the cell.

    FitText

    Gets or sets fit text option of the cell.

    Declaration
    public bool FitText { get; set; }
    Property Value
    Type Description
    System.Boolean

    True if the fit text option is enabled; otherwise, false.

    HorizontalMerge

    Gets or sets the way of combining of the cell horizontally.

    Declaration
    public CellMerge HorizontalMerge { get; set; }
    Property Value
    Type Description
    CellMerge

    The CellMerge member that specifies the way of horizontal merging.

    Paddings

    Gets the cell paddings. Read-only.

    Declaration
    public Paddings Paddings { get; }
    Property Value
    Type Description
    Paddings

    The Paddings for the cell.

    SamePaddingsAsTable

    Gets or sets value indicating whether to use same paddings as the table.

    Declaration
    public bool SamePaddingsAsTable { get; set; }
    Property Value
    Type Description
    System.Boolean

    True if it has same padding values as table; otherwise, false.

    TextDirection

    Gets or sets cell text direction.

    Declaration
    public TextDirection TextDirection { get; set; }
    Property Value
    Type Description
    TextDirection

    The TextDirection member that specifies the type of text direction.

    TextWrap

    Gets or sets a value indicating whether the text wrapping is set.

    Declaration
    public bool TextWrap { get; set; }
    Property Value
    Type Description
    System.Boolean

    True if it has text wrapping properties; otherwise, false.

    VerticalAlignment

    Gets or sets the vertical alignment of the cell content.

    Declaration
    public VerticalAlignment VerticalAlignment { get; set; }
    Property Value
    Type Description
    VerticalAlignment

    The VerticalAlignment member that specifies the vertical alignment of cell content.

    VerticalMerge

    Gets or sets the way of combining of the cell vertically.

    Declaration
    public CellMerge VerticalMerge { get; set; }
    Property Value
    Type Description
    CellMerge

    The CellMerge member that specifies the way of vertical merging.

    Methods

    EnsureComposites()

    Ensures the composites.

    Declaration
    protected override void EnsureComposites()
    Overrides
    FormatBase.EnsureComposites()

    GetDefComposite(Int32)

    Gets the composite values.

    Declaration
    protected override FormatBase GetDefComposite(int key)
    Parameters
    Type Name Description
    System.Int32 key

    The integer that specifies the key.

    Returns
    Type Description
    FormatBase

    The FormatBase object.

    Overrides
    FormatBase.GetDefComposite(Int32)

    GetDefValue(Int32)

    Returns the default values.

    Declaration
    protected override object GetDefValue(int key)
    Parameters
    Type Name Description
    System.Int32 key

    The integer specifying the key value of the property.

    Returns
    Type Description
    System.Object

    An object that specifies the default value.

    Overrides
    FormatBase.GetDefValue(Int32)

    ImportContainer(FormatBase)

    Imports the container.

    Declaration
    protected void ImportContainer(FormatBase format)
    Parameters
    Type Name Description
    FormatBase format

    The FormatBase object.

    ImportMembers(FormatBase)

    Imports the members.

    Declaration
    protected override void ImportMembers(FormatBase format)
    Parameters
    Type Name Description
    FormatBase format

    The FormatBase object.

    Overrides
    FormatBase.ImportMembers(FormatBase)

    InitXDLSHolder()

    Registers child objects in XDSL holder.

    Declaration
    protected override void InitXDLSHolder()
    Overrides
    XDLSSerializableBase.InitXDLSHolder()

    OnChange(FormatBase, Int32)

    Occurs on format change.

    Declaration
    protected override void OnChange(FormatBase format, int propKey)
    Parameters
    Type Name Description
    FormatBase format

    The FormatBase object.

    System.Int32 propKey

    The integer that represents the property key.

    Overrides
    FormatBase.OnChange(FormatBase, Int32)

    ReadXmlAttributes(IXDLSAttributeReader)

    Reads object data from xml attributes.

    Declaration
    protected override void ReadXmlAttributes(IXDLSAttributeReader reader)
    Parameters
    Type Name Description
    IXDLSAttributeReader reader

    The IXDLSAttributeReader object.

    Overrides
    XDLSSerializableBase.ReadXmlAttributes(IXDLSAttributeReader)

    WriteXmlAttributes(IXDLSAttributeWriter)

    Writes object data as xml attributes.

    Declaration
    protected override void WriteXmlAttributes(IXDLSAttributeWriter writer)
    Parameters
    Type Name Description
    IXDLSAttributeWriter writer

    The IXDLSAttributeWriter object.

    Overrides
    XDLSSerializableBase.WriteXmlAttributes(IXDLSAttributeWriter)

    Implements

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