menu

Xamarin.Forms

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

    Show / Hide Table of Contents

    Class WParagraphStyle

    Represents a style of paragraph.

    Inheritance
    System.Object
    OwnerHolder
    XDLSSerializableBase
    Style
    WParagraphStyle
    Implements
    IXDLSSerializable
    IWParagraphStyle
    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.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 WParagraphStyle : Style, IXDLSSerializable, IWParagraphStyle, IStyle
    Examples
    private void Button1_Click(System.Object sender, System.EventArgs e)
    {
        //Create a new Word document 
        WordDocument document = new WordDocument();
        //Add new section to the document
        IWSection section = document.AddSection();
        //Creates Paragraph styles.
        WParagraphStyle style = document.AddParagraphStyle("Heading 1") as WParagraphStyle;
        //Applies the base style.
        style.ApplyBaseStyle("Normal");
        //Applies character formats.
        style.CharacterFormat.FontName = "Calibri Light";
        style.CharacterFormat.FontSize = 16f;
        style.CharacterFormat.TextColor = System.Drawing.Color.FromArgb(46, 116, 181);
        //Applies paragraph formats.
        style.ParagraphFormat.BeforeSpacing = 12;
        style.ParagraphFormat.AfterSpacing = 0;
        style.ParagraphFormat.Keep = true;
        style.ParagraphFormat.KeepFollow = true;
        style.ParagraphFormat.OutlineLevel = OutlineLevel.Level1;
        //Add new paragraph
        WParagraph paragraph = section.AddParagraph() as WParagraph;
        //Apply style
        paragraph.ApplyStyle("Heading 1");
        paragraph.AppendText("Applying paragraph style");
        //Save and close the Word document
        document.Save("Sample1.docx", FormatType.Docx);
        document.Close();
    }
    Private Sub button_Click(sender As Object, e As EventArgs)
        'Create a new Word document 
        Dim document As New WordDocument()
        'Add new section to the document
        Dim section As IWSection = document.AddSection()
        'Creates Paragraph styles.
        Dim style As WParagraphStyle = TryCast(document.AddParagraphStyle("Heading 1"), WParagraphStyle)
        'Applies the base style.
        style.ApplyBaseStyle("Normal")
        'Applies character formats.
        style.CharacterFormat.FontName = "Calibri Light"
        style.CharacterFormat.FontSize = 16.0F
        style.CharacterFormat.TextColor = System.Drawing.Color.FromArgb(46, 116, 181)
        'Applies paragraph formats.
        style.ParagraphFormat.BeforeSpacing = 12
        style.ParagraphFormat.AfterSpacing = 0
        style.ParagraphFormat.Keep = True
        style.ParagraphFormat.KeepFollow = True
        style.ParagraphFormat.OutlineLevel = OutlineLevel.Level1
        'Add new paragraph
        Dim paragraph As WParagraph = TryCast(section.AddParagraph(), WParagraph)
        'Apply style
        paragraph.ApplyStyle("Heading 1")
        paragraph.AppendText("Applying paragraph style")
        'Save and close the Word document
        document.Save("Sample1.docx", FormatType.Docx)
        document.Close()
    End Sub

    Constructors

    WParagraphStyle(IWordDocument)

    Initializes a new instance of the WParagraphStyle class with the specified IWordDocument instance.

    Declaration
    public WParagraphStyle(IWordDocument doc)
    Parameters
    Type Name Description
    IWordDocument doc

    The IWordDocument instance.

    Fields

    m_listFormat

    Member that specifies the list format.

    Declaration
    protected WListFormat m_listFormat
    Field Value
    Type
    WListFormat

    m_prFormat

    Member that specifies the paragraph format.

    Declaration
    protected WParagraphFormat m_prFormat
    Field Value
    Type
    WParagraphFormat

    Properties

    BaseStyle

    Gets the base style of the paragraph. Read-only.

    Declaration
    public WParagraphStyle BaseStyle { get; }
    Property Value
    Type Description
    WParagraphStyle

    The WParagraphStyle instance that specifies the base style.

    ListFormat

    Gets the format of the list for the paragraph. Read-only.

    Declaration
    public WListFormat ListFormat { get; }
    Property Value
    Type Description
    WListFormat

    The WListFormat instance that specifies the list format.

    ParagraphFormat

    Gets the formatting of paragraph. Read-only.

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

    The WParagraphFormat instance that specifies the paragraph format.

    StyleType

    Gets the type of the style. Read-only.

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

    The StyleType member that specifies the type of the style.

    Overrides
    Style.StyleType

    Methods

    ApplyBaseStyle(String)

    Applies the base style for the current paragraph style.

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

    The name of the style to be applied.

    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 object.

    Overrides
    Style.Clone()

    CloneImpl()

    Creates a duplicate copy of the entity.

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

    An System.Object reference to the newly created object.

    Overrides
    Style.CloneImpl()

    InitXDLSHolder()

    Registers child objects in XDSL holder.

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

    Explicit Interface Implementations

    IWParagraphStyle.Close()

    Declaration
    void IWParagraphStyle.Close()

    Implements

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